From 219bace46f7f53b1113273d724227e56377c9788 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Thu, 30 Jan 2020 22:30:26 +0000 Subject: [PATCH] Generated from 881f67bc9e6b97c9f4f08246f7abd99dafdfb243 fix --- sdk/billing/mgmt-v2018_11_01_preview/pom.xml | 135 ++ .../AcceptTransferRequest.java | 46 + .../AddressValidationStatus.java | 41 + .../v2018_11_01_preview/Addresses.java | 29 + .../v2018_11_01_preview/Agreement.java | 64 + .../v2018_11_01_preview/Agreements.java | 38 + .../billing/v2018_11_01_preview/Amount.java | 58 + .../v2018_11_01_preview/AvailableBalance.java | 40 + .../AvailableBalances.java | 29 + .../v2018_11_01_preview/BillingAccount.java | 171 ++ .../BillingAccountUpdateProperties.java | 249 +++ .../v2018_11_01_preview/BillingAccounts.java | 36 + .../v2018_11_01_preview/BillingFrequency.java | 44 + .../BillingPermissions.java | 58 + .../BillingPermissionsListResult.java | 26 + .../BillingPermissionsProperties.java | 49 + .../v2018_11_01_preview/BillingProfile.java | 158 ++ .../BillingProfileCreationParameters.java | 149 ++ .../v2018_11_01_preview/BillingProfiles.java | 48 + .../BillingProfilesCreateHeaders.java | 95 + .../BillingProfilesUpdateHeaders.java | 70 + .../v2018_11_01_preview/BillingProperty.java | 95 + .../v2018_11_01_preview/BillingPropertys.java | 27 + .../BillingRoleAssignment.java | 70 + .../BillingRoleAssignmentListResult.java | 27 + .../BillingRoleAssignmentPayload.java | 69 + .../BillingRoleAssignments.java | 143 ++ .../BillingRoleDefinition.java | 51 + .../BillingRoleDefinitionListResult.java | 27 + .../BillingRoleDefinitions.java | 80 + .../BillingSubscriptionStatusType.java | 50 + .../BillingSubscriptionSummary.java | 106 ++ .../BillingSubscriptions.java | 104 ++ .../BillingSubscriptionsTransferHeaders.java | 95 + .../billing/v2018_11_01_preview/Customer.java | 53 + .../v2018_11_01_preview/Customers.java | 38 + .../v2018_11_01_preview/Department.java | 58 + .../v2018_11_01_preview/Departments.java | 38 + .../DetailedTransferStatus.java | 90 + .../DownloadProperties.java | 48 + .../v2018_11_01_preview/DownloadUrl.java | 31 + .../EligibleProductType.java | 44 + .../v2018_11_01_preview/EnabledAzureSKUs.java | 58 + .../v2018_11_01_preview/Enrollment.java | 175 ++ .../EnrollmentAccount.java | 73 + .../EnrollmentAccountContext.java | 122 ++ .../EnrollmentAccounts.java | 38 + .../EnrollmentPolicies.java | 77 + .../billing/v2018_11_01_preview/Error.java | 47 + .../v2018_11_01_preview/ErrorDetails.java | 62 + .../v2018_11_01_preview/ErrorResponse.java | 44 + .../ErrorResponseException.java | 44 + .../InitiateTransferRequest.java | 71 + .../v2018_11_01_preview/InvoiceSection.java | 86 + .../InvoiceSectionCreationRequest.java | 69 + .../InvoiceSectionListResult.java | 32 + .../v2018_11_01_preview/InvoiceSections.java | 78 + .../InvoiceSectionsCreateHeaders.java | 95 + .../InvoiceSectionsUpdateHeaders.java | 70 + .../v2018_11_01_preview/InvoiceSummary.java | 97 + .../billing/v2018_11_01_preview/Invoices.java | 53 + .../v2018_11_01_preview/LineOfCredit.java | 55 + .../v2018_11_01_preview/LineOfCredits.java | 37 + .../LineOfCreditsUpdateHeaders.java | 95 + .../v2018_11_01_preview/Operation.java | 30 + .../v2018_11_01_preview/OperationDisplay.java | 62 + .../v2018_11_01_preview/OperationStatus.java | 84 + .../v2018_11_01_preview/Operations.java | 27 + .../v2018_11_01_preview/Participants.java | 63 + .../v2018_11_01_preview/PaymentMethod.java | 56 + .../PaymentMethodType.java | 41 + .../v2018_11_01_preview/PaymentMethods.java | 38 + .../PaymentProperties.java | 63 + .../billing/v2018_11_01_preview/Policies.java | 41 + .../billing/v2018_11_01_preview/Policy.java | 50 + .../PriceSheetDownloadHeaders.java | 123 ++ .../v2018_11_01_preview/PriceSheets.java | 29 + .../v2018_11_01_preview/ProductDetails.java | 70 + .../ProductStatusType.java | 59 + .../v2018_11_01_preview/ProductSummary.java | 126 ++ .../ProductTransferStatus.java | 47 + .../ProductTransferValidationErrorCode.java | 62 + .../v2018_11_01_preview/ProductType.java | 41 + .../billing/v2018_11_01_preview/Products.java | 94 + .../ProductsTransferHeaders.java | 95 + .../RecipientTransferDetails.java | 67 + .../RecipientTransfers.java | 54 + .../billing/v2018_11_01_preview/Reseller.java | 47 + .../v2018_11_01_preview/ReservationType.java | 41 + .../billing/v2018_11_01_preview/Status.java | 41 + ...bscriptionTransferValidationErrorCode.java | 59 + .../TransactionTypeKind.java | 41 + .../v2018_11_01_preview/Transactions.java | 66 + .../TransactionsSummary.java | 136 ++ .../TransferBillingSubscriptionRequest.java | 71 + ...rBillingSubscriptionRequestProperties.java | 69 + .../TransferBillingSubscriptionResult.java | 25 + .../v2018_11_01_preview/TransferDetails.java | 72 + .../TransferProductRequestProperties.java | 69 + .../v2018_11_01_preview/TransferStatus.java | 56 + .../v2018_11_01_preview/Transfers.java | 63 + .../v2018_11_01_preview/UpdateAutoRenew.java | 41 + .../UpdateAutoRenewOperationSummary.java | 26 + .../UpdateAutoRenewRequest.java | 44 + .../ValidateAddressResponse.java | 37 + ...lidateProductTransferEligibilityError.java | 100 + ...idateProductTransferEligibilityResult.java | 30 + ...eSubscriptionTransferEligibilityError.java | 99 + ...SubscriptionTransferEligibilityResult.java | 30 + .../implementation/AddressInner.java | 277 +++ .../implementation/AddressesImpl.java | 42 + .../implementation/AddressesInner.java | 138 ++ .../implementation/AgreementImpl.java | 84 + .../implementation/AgreementInner.java | 109 ++ .../implementation/AgreementsImpl.java | 69 + .../implementation/AgreementsInner.java | 572 ++++++ .../implementation/AvailableBalanceImpl.java | 47 + .../implementation/AvailableBalanceInner.java | 36 + .../implementation/AvailableBalancesImpl.java | 42 + .../AvailableBalancesInner.java | 143 ++ .../implementation/BillingAccountImpl.java | 214 +++ .../implementation/BillingAccountInner.java | 246 +++ .../implementation/BillingAccountsImpl.java | 65 + .../implementation/BillingAccountsInner.java | 706 ++++++++ .../BillingManagementClientImpl.java | 520 ++++++ .../implementation/BillingManager.java | 375 ++++ .../BillingPermissionsImpl.java | 78 + .../BillingPermissionsInner.java | 397 ++++ .../BillingPermissionsListResultImpl.java | 33 + .../BillingPermissionsListResultInner.java | 34 + .../implementation/BillingProfileImpl.java | 169 ++ .../implementation/BillingProfileInner.java | 212 +++ .../implementation/BillingProfilesImpl.java | 82 + .../implementation/BillingProfilesInner.java | 914 ++++++++++ .../implementation/BillingPropertyImpl.java | 101 ++ .../implementation/BillingPropertyInner.java | 200 ++ .../implementation/BillingPropertysImpl.java | 42 + .../implementation/BillingPropertysInner.java | 132 ++ .../BillingRoleAssignmentImpl.java | 76 + .../BillingRoleAssignmentInner.java | 125 ++ .../BillingRoleAssignmentListResultImpl.java | 32 + .../BillingRoleAssignmentListResultInner.java | 33 + .../BillingRoleAssignmentsImpl.java | 176 ++ .../BillingRoleAssignmentsInner.java | 1143 ++++++++++++ .../BillingRoleDefinitionImpl.java | 58 + .../BillingRoleDefinitionInner.java | 67 + .../BillingRoleDefinitionListResultImpl.java | 32 + .../BillingRoleDefinitionListResultInner.java | 33 + .../BillingRoleDefinitionsImpl.java | 103 ++ .../BillingRoleDefinitionsInner.java | 585 ++++++ .../BillingSubscriptionSummaryImpl.java | 119 ++ .../BillingSubscriptionSummaryInner.java | 257 +++ .../BillingSubscriptionsImpl.java | 158 ++ .../BillingSubscriptionsInner.java | 1485 +++++++++++++++ .../implementation/CustomerImpl.java | 74 + .../implementation/CustomerInner.java | 101 ++ .../implementation/CustomersImpl.java | 69 + .../implementation/CustomersInner.java | 578 ++++++ .../implementation/DepartmentImpl.java | 85 + .../implementation/DepartmentInner.java | 126 ++ .../implementation/DepartmentsImpl.java | 69 + .../implementation/DepartmentsInner.java | 583 ++++++ .../implementation/DownloadUrlImpl.java | 37 + .../implementation/DownloadUrlInner.java | 48 + .../implementation/EnrollmentAccountImpl.java | 98 + .../EnrollmentAccountInner.java | 204 +++ .../EnrollmentAccountsImpl.java | 69 + .../EnrollmentAccountsInner.java | 583 ++++++ .../implementation/IdParsingUtils.java | 57 + .../implementation/InvoiceSectionImpl.java | 115 ++ .../implementation/InvoiceSectionInner.java | 73 + .../InvoiceSectionListResultImpl.java | 37 + .../InvoiceSectionListResultInner.java | 48 + .../implementation/InvoiceSectionsImpl.java | 120 ++ .../implementation/InvoiceSectionsInner.java | 1390 ++++++++++++++ .../implementation/InvoiceSummaryImpl.java | 110 ++ .../implementation/InvoiceSummaryInner.java | 207 +++ .../implementation/InvoicesImpl.java | 83 + .../implementation/InvoicesInner.java | 658 +++++++ .../implementation/LineOfCreditImpl.java | 63 + .../implementation/LineOfCreditInner.java | 105 ++ .../implementation/LineOfCreditsImpl.java | 54 + .../implementation/LineOfCreditsInner.java | 289 +++ .../implementation/OperationImpl.java | 37 + .../implementation/OperationInner.java | 59 + .../implementation/OperationsImpl.java | 49 + .../implementation/OperationsInner.java | 283 +++ .../implementation/PageImpl.java | 75 + .../implementation/PaymentMethodImpl.java | 67 + .../implementation/PaymentMethodInner.java | 93 + .../implementation/PaymentMethodsImpl.java | 71 + .../implementation/PaymentMethodsInner.java | 531 ++++++ .../implementation/PoliciesImpl.java | 54 + .../implementation/PoliciesInner.java | 241 +++ .../implementation/PolicyImpl.java | 56 + .../implementation/PolicyInner.java | 98 + .../implementation/PriceSheetsImpl.java | 42 + .../implementation/PriceSheetsInner.java | 217 +++ .../implementation/ProductSummaryImpl.java | 139 ++ .../implementation/ProductSummaryInner.java | 318 ++++ .../implementation/ProductsImpl.java | 134 ++ .../implementation/ProductsInner.java | 1424 +++++++++++++++ .../RecipientTransferDetailsImpl.java | 76 + .../RecipientTransferDetailsInner.java | 161 ++ .../RecipientTransfersImpl.java | 85 + .../RecipientTransfersInner.java | 593 ++++++ .../implementation/TransactionsImpl.java | 107 ++ .../implementation/TransactionsInner.java | 1605 +++++++++++++++++ .../TransactionsSummaryImpl.java | 149 ++ .../TransactionsSummaryInner.java | 347 ++++ ...TransferBillingSubscriptionResultImpl.java | 31 + ...ransferBillingSubscriptionResultInner.java | 45 + .../implementation/TransferDetailsImpl.java | 87 + .../implementation/TransferDetailsInner.java | 175 ++ .../implementation/TransfersImpl.java | 89 + .../implementation/TransfersInner.java | 576 ++++++ .../UpdateAutoRenewOperationSummaryImpl.java | 32 + .../UpdateAutoRenewOperationSummaryInner.java | 46 + .../ValidateAddressResponseImpl.java | 43 + .../ValidateAddressResponseInner.java | 98 + ...eProductTransferEligibilityResultImpl.java | 37 + ...ProductTransferEligibilityResultInner.java | 59 + ...criptionTransferEligibilityResultImpl.java | 37 + ...riptionTransferEligibilityResultInner.java | 59 + .../implementation/package-info.java | 11 + .../v2018_11_01_preview/package-info.java | 11 + 226 files changed, 32481 insertions(+) create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/pom.xml create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/AcceptTransferRequest.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/AddressValidationStatus.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Addresses.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Agreement.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Agreements.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Amount.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/AvailableBalance.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/AvailableBalances.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingAccount.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingAccountUpdateProperties.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingAccounts.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingFrequency.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPermissions.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPermissionsListResult.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPermissionsProperties.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProfile.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProfileCreationParameters.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProfiles.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProfilesCreateHeaders.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProfilesUpdateHeaders.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProperty.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPropertys.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleAssignment.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleAssignmentListResult.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleAssignmentPayload.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleAssignments.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleDefinition.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleDefinitionListResult.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleDefinitions.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingSubscriptionStatusType.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingSubscriptionSummary.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingSubscriptions.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingSubscriptionsTransferHeaders.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Customer.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Customers.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Department.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Departments.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/DetailedTransferStatus.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/DownloadProperties.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/DownloadUrl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EligibleProductType.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EnabledAzureSKUs.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Enrollment.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EnrollmentAccount.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EnrollmentAccountContext.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EnrollmentAccounts.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EnrollmentPolicies.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Error.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ErrorDetails.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ErrorResponse.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ErrorResponseException.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InitiateTransferRequest.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSection.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSectionCreationRequest.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSectionListResult.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSections.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSectionsCreateHeaders.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSectionsUpdateHeaders.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSummary.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Invoices.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/LineOfCredit.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/LineOfCredits.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/LineOfCreditsUpdateHeaders.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Operation.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/OperationDisplay.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/OperationStatus.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Operations.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Participants.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PaymentMethod.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PaymentMethodType.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PaymentMethods.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PaymentProperties.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Policies.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Policy.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PriceSheetDownloadHeaders.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PriceSheets.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductDetails.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductStatusType.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductSummary.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductTransferStatus.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductTransferValidationErrorCode.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductType.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Products.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductsTransferHeaders.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/RecipientTransferDetails.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/RecipientTransfers.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Reseller.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ReservationType.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Status.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/SubscriptionTransferValidationErrorCode.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransactionTypeKind.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Transactions.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransactionsSummary.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransferBillingSubscriptionRequest.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransferBillingSubscriptionRequestProperties.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransferBillingSubscriptionResult.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransferDetails.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransferProductRequestProperties.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransferStatus.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Transfers.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/UpdateAutoRenew.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/UpdateAutoRenewOperationSummary.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/UpdateAutoRenewRequest.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ValidateAddressResponse.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ValidateProductTransferEligibilityError.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ValidateProductTransferEligibilityResult.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ValidateSubscriptionTransferEligibilityError.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ValidateSubscriptionTransferEligibilityResult.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AddressInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AddressesImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AddressesInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementsImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementsInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AvailableBalanceImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AvailableBalanceInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AvailableBalancesImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AvailableBalancesInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountsImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountsInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManagementClientImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManager.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsListResultImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsListResultInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfileImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfileInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfilesImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfilesInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPropertyImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPropertyInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPropertysImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPropertysInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentListResultImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentListResultInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentsImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentsInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionListResultImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionListResultInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionsImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionsInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionSummaryImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionSummaryInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionsImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionsInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomerImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomerInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomersImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomersInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DepartmentImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DepartmentInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DepartmentsImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DepartmentsInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DownloadUrlImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DownloadUrlInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountsImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountsInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/IdParsingUtils.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionListResultImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionListResultInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionsImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionsInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSummaryImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSummaryInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoicesImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoicesInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/LineOfCreditImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/LineOfCreditInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/LineOfCreditsImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/LineOfCreditsInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/OperationImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/OperationInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/OperationsImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/OperationsInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PageImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PaymentMethodImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PaymentMethodInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PaymentMethodsImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PaymentMethodsInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PoliciesImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PoliciesInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PolicyImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PolicyInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PriceSheetsImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PriceSheetsInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductSummaryImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductSummaryInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductsImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductsInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/RecipientTransferDetailsImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/RecipientTransferDetailsInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/RecipientTransfersImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/RecipientTransfersInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsSummaryImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsSummaryInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransferBillingSubscriptionResultImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransferBillingSubscriptionResultInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransferDetailsImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransferDetailsInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransfersImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransfersInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/UpdateAutoRenewOperationSummaryImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/UpdateAutoRenewOperationSummaryInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ValidateAddressResponseImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ValidateAddressResponseInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ValidateProductTransferEligibilityResultImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ValidateProductTransferEligibilityResultInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ValidateSubscriptionTransferEligibilityResultImpl.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ValidateSubscriptionTransferEligibilityResultInner.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/package-info.java create mode 100644 sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/package-info.java diff --git a/sdk/billing/mgmt-v2018_11_01_preview/pom.xml b/sdk/billing/mgmt-v2018_11_01_preview/pom.xml new file mode 100644 index 0000000000000..325391271b463 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.billing.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/AcceptTransferRequest.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/AcceptTransferRequest.java new file mode 100644 index 0000000000000..77a5f498082a2 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/AddressValidationStatus.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/AddressValidationStatus.java new file mode 100644 index 0000000000000..e4f8148b9d53e --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Addresses.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Addresses.java new file mode 100644 index 0000000000000..89ec8a5e1a516 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Addresses.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.AddressInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.AddressesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Addresses. + */ +public interface Addresses extends HasInner { + /** + * Validates the address. + * + * @param address the AddressInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable validateAsync(AddressInner address); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Agreement.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Agreement.java new file mode 100644 index 0000000000000..5ec5db3113d84 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Agreement.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.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2018_11_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.v2018_11_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 agreementLink value. + */ + String agreementLink(); + + /** + * @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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Agreements.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Agreements.java new file mode 100644 index 0000000000000..0b69e41a84be1 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.AgreementsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Agreements. + */ +public interface Agreements extends HasInner { + /** + * Get the agreement by name. + * + * @param billingAccountName Billing Account Id. + * @param agreementName Agreement Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String agreementName); + + /** + * Lists all agreements for a billing account. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountNameAsync(final String billingAccountName); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Amount.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Amount.java new file mode 100644 index 0000000000000..808838bb403fd --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/AvailableBalance.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/AvailableBalance.java new file mode 100644 index 0000000000000..9bee76b910ea7 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/AvailableBalances.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/AvailableBalances.java new file mode 100644 index 0000000000000..a78f8c4389772 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/AvailableBalances.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.AvailableBalancesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing AvailableBalances. + */ +public interface AvailableBalances extends HasInner { + /** + * The latest available credit balance for a given billingAccountName and billingProfileName. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingAccount.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingAccount.java new file mode 100644 index 0000000000000..c2248772a31d3 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingAccount.java @@ -0,0 +1,171 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.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.v2018_11_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.AddressInner; +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.InvoiceSectionInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingProfileInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.DepartmentInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.EnrollmentAccountInner; + +/** + * Type representing BillingAccount. + */ +public interface BillingAccount extends HasInner, Indexable, Updatable, Refreshable, HasManager { + /** + * @return the accountType value. + */ + String accountType(); + + /** + * @return the address value. + */ + AddressInner address(); + + /** + * @return the billingProfiles value. + */ + List billingProfiles(); + + /** + * @return the company value. + */ + String company(); + + /** + * @return the country value. + */ + String country(); + + /** + * @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 hasReadAccess value. + */ + Boolean hasReadAccess(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the invoiceSections value. + */ + List invoiceSections(); + + /** + * @return the name value. + */ + String name(); + + /** + * @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, UpdateStages.WithInvoiceSections { + } + + /** + * 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 billing account + * @return the next update stage + */ + Update withAddress(AddressInner address); + } + + /** + * The stage of the billingaccount update allowing to specify BillingProfiles. + */ + interface WithBillingProfiles { + /** + * Specifies billingProfiles. + * @param billingProfiles The billing profiles associated to 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); + } + + /** + * The stage of the billingaccount update allowing to specify InvoiceSections. + */ + interface WithInvoiceSections { + /** + * Specifies invoiceSections. + * @param invoiceSections The invoice sections associated to the billing account. By default this is not populated, unless it's specified in $expand + * @return the next update stage + */ + Update withInvoiceSections(List invoiceSections); + } + + } +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingAccountUpdateProperties.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingAccountUpdateProperties.java new file mode 100644 index 0000000000000..cc2d102d82d72 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingAccountUpdateProperties.java @@ -0,0 +1,249 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.AddressInner; +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.InvoiceSectionInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingProfileInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.DepartmentInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.EnrollmentAccountInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The properties of the billing account that can be updated. + */ +@JsonFlatten +public class BillingAccountUpdateProperties { + /** + * The billing account name. + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * The billing account Type. Possible values include: 'Organization', + * 'Enrollment'. + */ + @JsonProperty(value = "properties.accountType", access = JsonProperty.Access.WRITE_ONLY) + private String accountType; + + /** + * The address associated with billing account. + */ + @JsonProperty(value = "properties.address") + private AddressInner address; + + /** + * Company Name. + */ + @JsonProperty(value = "properties.company", access = JsonProperty.Access.WRITE_ONLY) + private String company; + + /** + * Country Name. + */ + @JsonProperty(value = "properties.country", access = JsonProperty.Access.WRITE_ONLY) + private String country; + + /** + * The invoice sections associated to the billing account. By default this + * is not populated, unless it's specified in $expand. + */ + @JsonProperty(value = "properties.invoiceSections") + private List invoiceSections; + + /** + * The billing profiles associated to 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; + + /** + * Specifies whether the user has read access on billing account. + */ + @JsonProperty(value = "properties.hasReadAccess", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasReadAccess; + + /** + * Get the billing account name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the billing account Type. Possible values include: 'Organization', 'Enrollment'. + * + * @return the accountType value + */ + public String accountType() { + return this.accountType; + } + + /** + * Get the address associated with billing account. + * + * @return the address value + */ + public AddressInner address() { + return this.address; + } + + /** + * Set the address associated with billing account. + * + * @param address the address value to set + * @return the BillingAccountUpdateProperties object itself. + */ + public BillingAccountUpdateProperties withAddress(AddressInner address) { + this.address = address; + return this; + } + + /** + * Get company Name. + * + * @return the company value + */ + public String company() { + return this.company; + } + + /** + * Get country Name. + * + * @return the country value + */ + public String country() { + return this.country; + } + + /** + * Get the invoice sections associated to the billing account. By default this is not populated, unless it's specified in $expand. + * + * @return the invoiceSections value + */ + public List invoiceSections() { + return this.invoiceSections; + } + + /** + * Set the invoice sections associated to the billing account. By default this is not populated, unless it's specified in $expand. + * + * @param invoiceSections the invoiceSections value to set + * @return the BillingAccountUpdateProperties object itself. + */ + public BillingAccountUpdateProperties withInvoiceSections(List invoiceSections) { + this.invoiceSections = invoiceSections; + return this; + } + + /** + * Get the billing profiles associated to 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 to the billing account. By default this is not populated, unless it's specified in $expand. + * + * @param billingProfiles the billingProfiles value to set + * @return the BillingAccountUpdateProperties object itself. + */ + public BillingAccountUpdateProperties 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 BillingAccountUpdateProperties object itself. + */ + public BillingAccountUpdateProperties 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 BillingAccountUpdateProperties object itself. + */ + public BillingAccountUpdateProperties withEnrollmentAccounts(List enrollmentAccounts) { + this.enrollmentAccounts = enrollmentAccounts; + return this; + } + + /** + * Get specifies whether the user has read access on billing account. + * + * @return the hasReadAccess value + */ + public Boolean hasReadAccess() { + return this.hasReadAccess; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingAccounts.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingAccounts.java new file mode 100644 index 0000000000000..a9d73991f4880 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingAccounts.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingAccountsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BillingAccounts. + */ +public interface BillingAccounts extends HasInner { + /** + * Get the billing account by id. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName); + + /** + * Lists all billing accounts for which a user has access. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingFrequency.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingFrequency.java new file mode 100644 index 0000000000000..375af04d43cdc --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPermissions.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPermissions.java new file mode 100644 index 0000000000000..50aff2e494d6d --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPermissions.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.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingPermissionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BillingPermissions. + */ +public interface BillingPermissions extends HasInner { + /** + * Lists all billing permissions for the caller under a billing account. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountAsync(String billingAccountName); + + /** + * Lists all billing permissions for the caller under customer. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByCustomersAsync(String billingAccountName, String customerName); + + /** + * Lists all billing permissions for the caller under invoice section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByInvoiceSectionsAsync(String billingAccountName, String invoiceSectionName); + + /** + * Lists all billingPermissions for the caller has for a billing account. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPermissionsListResult.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPermissionsListResult.java new file mode 100644 index 0000000000000..b1753fcf1ddd8 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPermissionsProperties.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPermissionsProperties.java new file mode 100644 index 0000000000000..226ab8b1023ff --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPermissionsProperties.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The set of allowed action and not allowed actions a caller has on a billing + * account. + */ +public class BillingPermissionsProperties { + /** + * The set of actions that the caller is allowed to do. + */ + @JsonProperty(value = "actions", access = JsonProperty.Access.WRITE_ONLY) + private List actions; + + /** + * The set of actions the caller is not allowed to do. + */ + @JsonProperty(value = "notActions", access = JsonProperty.Access.WRITE_ONLY) + private List notActions; + + /** + * Get the set of actions that the caller is allowed to do. + * + * @return the actions value + */ + public List actions() { + return this.actions; + } + + /** + * Get the set of actions the caller is not allowed to do. + * + * @return the notActions value + */ + public List notActions() { + return this.notActions; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProfile.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProfile.java new file mode 100644 index 0000000000000..34b5e460a82df --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProfile.java @@ -0,0 +1,158 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.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.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.AddressInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.InvoiceSectionInner; + +/** + * Type representing BillingProfile. + */ +public interface BillingProfile extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the address value. + */ + AddressInner address(); + + /** + * @return the currency value. + */ + String currency(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the enabledAzureSKUs value. + */ + List enabledAzureSKUs(); + + /** + * @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 isClassic value. + */ + Boolean isClassic(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the poNumber value. + */ + String poNumber(); + + /** + * @return the type value. + */ + String type(); + + /** + * The template for a BillingProfile update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAddress, UpdateStages.WithDisplayName, UpdateStages.WithEnabledAzureSKUs, 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(AddressInner address); + } + + /** + * The stage of the billingprofile update allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The billing profile name + * @return the next update stage + */ + Update withDisplayName(String displayName); + } + + /** + * The stage of the billingprofile update allowing to specify EnabledAzureSKUs. + */ + interface WithEnabledAzureSKUs { + /** + * Specifies enabledAzureSKUs. + * @param enabledAzureSKUs Information about the product + * @return the next update stage + */ + Update withEnabledAzureSKUs(List enabledAzureSKUs); + } + + /** + * 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 Purchase order number + * @return the next update stage + */ + Update withPoNumber(String poNumber); + } + + } +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProfileCreationParameters.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProfileCreationParameters.java new file mode 100644 index 0000000000000..06a7cdfaf9956 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProfileCreationParameters.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.v2018_11_01_preview; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.AddressInner; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The parameters for creating a new billing profile. + */ +public class BillingProfileCreationParameters { + /** + * The billing profile name. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Purchase order number. + */ + @JsonProperty(value = "poNumber") + private String poNumber; + + /** + * Billing address. + */ + @JsonProperty(value = "address") + private AddressInner address; + + /** + * If the billing profile is opted in to receive invoices via email. + */ + @JsonProperty(value = "invoiceEmailOptIn") + private Boolean invoiceEmailOptIn; + + /** + * Azure skus to enable for this billing profile.. + */ + @JsonProperty(value = "enableAzureSKUs") + private List enableAzureSKUs; + + /** + * Get the billing profile name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the billing profile name. + * + * @param displayName the displayName value to set + * @return the BillingProfileCreationParameters object itself. + */ + public BillingProfileCreationParameters withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get purchase order number. + * + * @return the poNumber value + */ + public String poNumber() { + return this.poNumber; + } + + /** + * Set purchase order number. + * + * @param poNumber the poNumber value to set + * @return the BillingProfileCreationParameters object itself. + */ + public BillingProfileCreationParameters withPoNumber(String poNumber) { + this.poNumber = poNumber; + return this; + } + + /** + * Get billing address. + * + * @return the address value + */ + public AddressInner address() { + return this.address; + } + + /** + * Set billing address. + * + * @param address the address value to set + * @return the BillingProfileCreationParameters object itself. + */ + public BillingProfileCreationParameters withAddress(AddressInner address) { + this.address = address; + return this; + } + + /** + * Get if the billing profile is opted in to receive invoices via email. + * + * @return the invoiceEmailOptIn value + */ + public Boolean invoiceEmailOptIn() { + return this.invoiceEmailOptIn; + } + + /** + * Set if the billing profile is opted in to receive invoices via email. + * + * @param invoiceEmailOptIn the invoiceEmailOptIn value to set + * @return the BillingProfileCreationParameters object itself. + */ + public BillingProfileCreationParameters withInvoiceEmailOptIn(Boolean invoiceEmailOptIn) { + this.invoiceEmailOptIn = invoiceEmailOptIn; + return this; + } + + /** + * Get azure skus to enable for this billing profile.. + * + * @return the enableAzureSKUs value + */ + public List enableAzureSKUs() { + return this.enableAzureSKUs; + } + + /** + * Set azure skus to enable for this billing profile.. + * + * @param enableAzureSKUs the enableAzureSKUs value to set + * @return the BillingProfileCreationParameters object itself. + */ + public BillingProfileCreationParameters withEnableAzureSKUs(List enableAzureSKUs) { + this.enableAzureSKUs = enableAzureSKUs; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProfiles.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProfiles.java new file mode 100644 index 0000000000000..a7b1876c09dba --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProfiles.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingProfilesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BillingProfiles. + */ +public interface BillingProfiles extends HasInner { + /** + * Get the billing profile by id. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String billingProfileName); + + /** + * Lists all billing profiles for a user which that user has access to. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountNameAsync(final String billingAccountName); + + /** + * The operation to create a BillingProfile. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the Create BillingProfile operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createAsync(String billingAccountName, BillingProfileCreationParameters parameters); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProfilesCreateHeaders.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProfilesCreateHeaders.java new file mode 100644 index 0000000000000..9f09af3387bc8 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProfilesCreateHeaders.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Create operation. + */ +public class BillingProfilesCreateHeaders { + /** + * Location URI to poll for result. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Recommends the retryable time after receiving this. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * URI to poll for the operation status. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Get location URI to poll for result. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set location URI to poll for result. + * + * @param location the location value to set + * @return the BillingProfilesCreateHeaders object itself. + */ + public BillingProfilesCreateHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get recommends the retryable time after receiving this. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set recommends the retryable time after receiving this. + * + * @param retryAfter the retryAfter value to set + * @return the BillingProfilesCreateHeaders object itself. + */ + public BillingProfilesCreateHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get uRI to poll for the operation status. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set uRI to poll for the operation status. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the BillingProfilesCreateHeaders object itself. + */ + public BillingProfilesCreateHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProfilesUpdateHeaders.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProfilesUpdateHeaders.java new file mode 100644 index 0000000000000..304beb7e5c296 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProperty.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProperty.java new file mode 100644 index 0000000000000..771d9d00876f8 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingProperty.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingPropertyInner; + +/** + * Type representing BillingProperty. + */ +public interface BillingProperty extends HasInner, HasManager { + /** + * @return the billingAccountId value. + */ + String billingAccountId(); + + /** + * @return the billingAccountName value. + */ + String billingAccountName(); + + /** + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * @return the billingProfileName value. + */ + String billingProfileName(); + + /** + * @return the billingTenantId value. + */ + String billingTenantId(); + + /** + * @return the costCenter value. + */ + String costCenter(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * @return the invoiceSectionName value. + */ + String invoiceSectionName(); + + /** + * @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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPropertys.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingPropertys.java new file mode 100644 index 0000000000000..106e710651344 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingPropertysInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BillingPropertys. + */ +public interface BillingPropertys extends HasInner { + /** + * Get billing property by subscription Id. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleAssignment.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleAssignment.java new file mode 100644 index 0000000000000..39a9ee660f727 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleAssignment.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.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingRoleAssignmentInner; + +/** + * Type representing BillingRoleAssignment. + */ +public interface BillingRoleAssignment extends HasInner, 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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleAssignmentListResult.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleAssignmentListResult.java new file mode 100644 index 0000000000000..e729de1bbfd5f --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingRoleAssignmentListResultInner; +import com.microsoft.azure.management.billing.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleAssignmentPayload.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleAssignmentPayload.java new file mode 100644 index 0000000000000..7d5f5524e5caf --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleAssignments.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleAssignments.java new file mode 100644 index 0000000000000..427173903e807 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleAssignments.java @@ -0,0 +1,143 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Completable; +import rx.Observable; + +/** + * Type representing BillingRoleAssignments. + */ +public interface BillingRoleAssignments { + /** + * Get the role assignment for the caller. + * + * @param billingAccountName Billing Account Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName); + + /** + * Delete the role assignment on this billing account. + * + * @param billingAccountName Billing Account Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteByBillingAccountNameAsync(String billingAccountName, String billingRoleAssignmentName); + + /** + * Get the role assignment for the caller on the invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName); + + /** + * Delete the role assignment on the invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName); + + /** + * Get the role assignment for the caller on the Billing Profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName); + + /** + * Delete the role assignment on this Billing Profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName); + + /** + * Get the role assignments on the Billing Account. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountNameAsync(String billingAccountName); + + /** + * Get the role assignments on the invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName); + + /** + * Get the role assignments on the Billing Profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName); + + /** + * The operation to add a role assignment to a billing account. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to add a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable addByBillingAccountNameAsync(String billingAccountName, BillingRoleAssignmentPayload parameters); + + /** + * The operation to add a role assignment to a invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param parameters Parameters supplied to add a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable addByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, BillingRoleAssignmentPayload parameters); + + /** + * The operation to add a role assignment to a billing profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param parameters Parameters supplied to add a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable addByBillingProfileNameAsync(String billingAccountName, String billingProfileName, BillingRoleAssignmentPayload parameters); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleDefinition.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleDefinition.java new file mode 100644 index 0000000000000..5d387216e8937 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleDefinition.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.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingRoleDefinitionInner; +import java.util.List; + +/** + * Type representing BillingRoleDefinition. + */ +public interface BillingRoleDefinition extends HasInner, HasManager { + /** + * @return the description value. + */ + String description(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the roleName value. + */ + String roleName(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the value value. + */ + List value(); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleDefinitionListResult.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleDefinitionListResult.java new file mode 100644 index 0000000000000..3f4a20ebf94b3 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingRoleDefinitionListResultInner; +import com.microsoft.azure.management.billing.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleDefinitions.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleDefinitions.java new file mode 100644 index 0000000000000..39e7c6207cd37 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingRoleDefinitions.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingRoleDefinitionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BillingRoleDefinitions. + */ +public interface BillingRoleDefinitions extends HasInner { + /** + * Gets the role definition for a role. + * + * @param billingAccountName Billing Account Id. + * @param billingRoleDefinitionName role definition id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByBillingAccountNameAsync(String billingAccountName, String billingRoleDefinitionName); + + /** + * Gets the role definition for a role. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleDefinitionName role definition id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleDefinitionName); + + /** + * Gets the role definition for a role. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleDefinitionName role definition id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleDefinitionName); + + /** + * Lists the role definition for a billing account. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountNameAsync(String billingAccountName); + + /** + * Lists the role definition for an invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName); + + /** + * Lists the role definition for a Billing Profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingSubscriptionStatusType.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingSubscriptionStatusType.java new file mode 100644 index 0000000000000..96bcd69ad98d5 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingSubscriptionSummary.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingSubscriptionSummary.java new file mode 100644 index 0000000000000..7c5962672f0e2 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingSubscriptionSummary.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.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingSubscriptionSummaryInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import java.util.UUID; + +/** + * Type representing BillingSubscriptionSummary. + */ +public interface BillingSubscriptionSummary extends HasInner, HasManager { + /** + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * @return the billingProfileName value. + */ + String billingProfileName(); + + /** + * @return the customerDisplayName value. + */ + String customerDisplayName(); + + /** + * @return the customerId value. + */ + String customerId(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * @return the invoiceSectionName value. + */ + String invoiceSectionName(); + + /** + * @return the lastMonthCharges value. + */ + Amount lastMonthCharges(); + + /** + * @return the monthToDateCharges value. + */ + Amount monthToDateCharges(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the 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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingSubscriptions.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingSubscriptions.java new file mode 100644 index 0000000000000..3e9199e04279d --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingSubscriptions.java @@ -0,0 +1,104 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingSubscriptionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing BillingSubscriptions. + */ +public interface BillingSubscriptions extends HasInner { + /** + * Lists billing subscriptions by billing profile name. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName); + + /** + * Lists billing subscription by customer name. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByCustomerNameAsync(final String billingAccountName, final String customerName); + + /** + * Get a single billing subscription by name. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param billingSubscriptionName Billing Subscription Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByCustomerNameAsync(String billingAccountName, String customerName, String billingSubscriptionName); + + /** + * Lists billing subscription by invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName); + + /** + * Get a single billing subscription by name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName); + + /** + * Transfers the subscription from one invoice section to another within a billing account. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param parameters Parameters supplied to the Transfer Billing Subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable transferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters); + + /** + * Validates the transfer of billing subscriptions across invoice sections. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param parameters Parameters supplied to the Transfer Billing Subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable validateTransferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters); + + /** + * Lists billing subscriptions by billing account name. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountNameAsync(final String billingAccountName); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingSubscriptionsTransferHeaders.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingSubscriptionsTransferHeaders.java new file mode 100644 index 0000000000000..43a6f69033d2a --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/BillingSubscriptionsTransferHeaders.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Transfer operation. + */ +public class BillingSubscriptionsTransferHeaders { + /** + * Location URI to poll for result. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Recommends the retryable time after receiving this. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * URI to poll for the operation status. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Get location URI to poll for result. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set location URI to poll for result. + * + * @param location the location value to set + * @return the BillingSubscriptionsTransferHeaders object itself. + */ + public BillingSubscriptionsTransferHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get recommends the retryable time after receiving this. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set recommends the retryable time after receiving this. + * + * @param retryAfter the retryAfter value to set + * @return the BillingSubscriptionsTransferHeaders object itself. + */ + public BillingSubscriptionsTransferHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get uRI to poll for the operation status. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set uRI to poll for the operation status. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the BillingSubscriptionsTransferHeaders object itself. + */ + public BillingSubscriptionsTransferHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Customer.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Customer.java new file mode 100644 index 0000000000000..fdb4fbc0b16b5 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Customer.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.CustomerInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import java.util.List; + +/** + * Type representing Customer. + */ +public interface Customer extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the enabledAzureSKUs value. + */ + List enabledAzureSKUs(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resellers value. + */ + List resellers(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Customers.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Customers.java new file mode 100644 index 0000000000000..b098a5412c3c9 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Customers.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.CustomersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Customers. + */ +public interface Customers extends HasInner { + /** + * Get the customer by id. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String customerName); + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountNameAsync(final String billingAccountName); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Department.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Department.java new file mode 100644 index 0000000000000..af55ed7fc60a7 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Departments.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Departments.java new file mode 100644 index 0000000000000..35214e5bdfab6 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.DepartmentsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Departments. + */ +public interface Departments extends HasInner { + /** + * Get the department by id. + * + * @param billingAccountName Billing Account Id. + * @param departmentName Department Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String departmentName); + + /** + * Lists all departments for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountNameAsync(final String billingAccountName); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/DetailedTransferStatus.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/DetailedTransferStatus.java new file mode 100644 index 0000000000000..792e160555c3e --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Detailed transfer status. + */ +public class DetailedTransferStatus { + /** + * Type of product being transferred. Possible values include: + * 'AzureSubscription', 'AzureReservation'. + */ + @JsonProperty(value = "productType", access = JsonProperty.Access.WRITE_ONLY) + private ProductType productType; + + /** + * Id of product being 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 being transferred. Possible values include: 'AzureSubscription', 'AzureReservation'. + * + * @return the productType value + */ + public ProductType productType() { + return this.productType; + } + + /** + * Get id of product being 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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/DownloadProperties.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/DownloadProperties.java new file mode 100644 index 0000000000000..f2e31891f667c --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/DownloadProperties.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the invoice download. + */ +public class DownloadProperties { + /** + * Document type. Possible values include: 'Invoice', 'VoidNote', + * 'Receipt', 'CreditNote'. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /** + * Document URL. + */ + @JsonProperty(value = "url", access = JsonProperty.Access.WRITE_ONLY) + private String url; + + /** + * Get document type. Possible values include: 'Invoice', 'VoidNote', 'Receipt', 'CreditNote'. + * + * @return the kind value + */ + public String kind() { + return this.kind; + } + + /** + * Get document URL. + * + * @return the url value + */ + public String url() { + return this.url; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/DownloadUrl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/DownloadUrl.java new file mode 100644 index 0000000000000..ea387940aa7b3 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EligibleProductType.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EligibleProductType.java new file mode 100644 index 0000000000000..b17284a49c7a7 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EnabledAzureSKUs.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EnabledAzureSKUs.java new file mode 100644 index 0000000000000..1ebfdd117ed03 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EnabledAzureSKUs.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.v2018_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details about the enabled azure sku. + */ +public class EnabledAzureSKUs { + /** + * 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 EnabledAzureSKUs object itself. + */ + public EnabledAzureSKUs 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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Enrollment.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Enrollment.java new file mode 100644 index 0000000000000..0e003b8aa2c0d --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Current entity level details. + */ +public class Enrollment { + /** + * Enrollment Start Date. + */ + @JsonProperty(value = "startDate") + private DateTime startDate; + + /** + * Enrollment End Date. + */ + @JsonProperty(value = "endDate") + private DateTime endDate; + + /** + * The currency associated with enrollment. + */ + @JsonProperty(value = "currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * The channel for Enrollment. + */ + @JsonProperty(value = "channel", access = JsonProperty.Access.WRITE_ONLY) + private String channel; + + /** + * The attributes associated with legacy enrollment. + */ + @JsonProperty(value = "policies", access = JsonProperty.Access.WRITE_ONLY) + private EnrollmentPolicies policies; + + /** + * The language for Enrollment. + */ + @JsonProperty(value = "language", access = JsonProperty.Access.WRITE_ONLY) + private String language; + + /** + * The countryCode for Enrollment. + */ + @JsonProperty(value = "countryCode", access = JsonProperty.Access.WRITE_ONLY) + private String countryCode; + + /** + * Enrollment status. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * Enrollment billing cycle. + */ + @JsonProperty(value = "billingCycle", access = JsonProperty.Access.WRITE_ONLY) + private String billingCycle; + + /** + * Get enrollment Start Date. + * + * @return the startDate value + */ + public DateTime startDate() { + return this.startDate; + } + + /** + * Set enrollment Start Date. + * + * @param startDate the startDate value to set + * @return the Enrollment object itself. + */ + public Enrollment withStartDate(DateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get enrollment End Date. + * + * @return the endDate value + */ + public DateTime endDate() { + return this.endDate; + } + + /** + * Set enrollment End Date. + * + * @param endDate the endDate value to set + * @return the Enrollment object itself. + */ + public Enrollment withEndDate(DateTime endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get the currency associated with enrollment. + * + * @return the currency value + */ + public String currency() { + return this.currency; + } + + /** + * Get the channel for Enrollment. + * + * @return the channel value + */ + public String channel() { + return this.channel; + } + + /** + * Get the attributes associated with legacy enrollment. + * + * @return the policies value + */ + public EnrollmentPolicies policies() { + return this.policies; + } + + /** + * Get the language for Enrollment. + * + * @return the language value + */ + public String language() { + return this.language; + } + + /** + * Get the countryCode for Enrollment. + * + * @return the countryCode value + */ + public String countryCode() { + return this.countryCode; + } + + /** + * Get enrollment status. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Get enrollment billing cycle. + * + * @return the billingCycle value + */ + public String billingCycle() { + return this.billingCycle; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EnrollmentAccount.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EnrollmentAccount.java new file mode 100644 index 0000000000000..dce100a59c087 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EnrollmentAccountContext.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EnrollmentAccountContext.java new file mode 100644 index 0000000000000..fd8c21dd154b0 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The rating context. + */ +public class EnrollmentAccountContext { + /** + * The cost center name. + */ + @JsonProperty(value = "costCenter") + private String costCenter; + + /** + * Account Start Date. + */ + @JsonProperty(value = "startDate") + private DateTime startDate; + + /** + * Account End Date. + */ + @JsonProperty(value = "endDate") + private DateTime endDate; + + /** + * The enrollment account id. + */ + @JsonProperty(value = "enrollmentAccountName") + private String enrollmentAccountName; + + /** + * Get the cost center name. + * + * @return the costCenter value + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Set the cost center name. + * + * @param costCenter the costCenter value to set + * @return the EnrollmentAccountContext object itself. + */ + public EnrollmentAccountContext withCostCenter(String costCenter) { + this.costCenter = costCenter; + return this; + } + + /** + * Get account Start Date. + * + * @return the startDate value + */ + public DateTime startDate() { + return this.startDate; + } + + /** + * Set account Start Date. + * + * @param startDate the startDate value to set + * @return the EnrollmentAccountContext object itself. + */ + public EnrollmentAccountContext withStartDate(DateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get account End Date. + * + * @return the endDate value + */ + public DateTime endDate() { + return this.endDate; + } + + /** + * Set account End Date. + * + * @param endDate the endDate value to set + * @return the EnrollmentAccountContext object itself. + */ + public EnrollmentAccountContext withEndDate(DateTime endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get the enrollment account id. + * + * @return the enrollmentAccountName value + */ + public String enrollmentAccountName() { + return this.enrollmentAccountName; + } + + /** + * Set the enrollment account id. + * + * @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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EnrollmentAccounts.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EnrollmentAccounts.java new file mode 100644 index 0000000000000..a8a730512d385 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.EnrollmentAccountsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing EnrollmentAccounts. + */ +public interface EnrollmentAccounts extends HasInner { + /** + * Get the enrollment account by id. + * + * @param billingAccountName Billing Account Id. + * @param enrollmentAccountName Enrollment Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByEnrollmentAccountIdAsync(String billingAccountName, String enrollmentAccountName); + + /** + * Lists all Enrollment Accounts for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountNameAsync(final String billingAccountName); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EnrollmentPolicies.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EnrollmentPolicies.java new file mode 100644 index 0000000000000..f6b12ad5425d9 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/EnrollmentPolicies.java @@ -0,0 +1,77 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The attributes associated with legacy enrollment. + */ +public class EnrollmentPolicies { + /** + * The accountOwnerViewCharges flag for Enrollment. + */ + @JsonProperty(value = "accountOwnerViewCharges", access = JsonProperty.Access.WRITE_ONLY) + private Boolean accountOwnerViewCharges; + + /** + * The departmentAdminViewCharges flag for Enrollment. + */ + @JsonProperty(value = "departmentAdminViewCharges", access = JsonProperty.Access.WRITE_ONLY) + private Boolean departmentAdminViewCharges; + + /** + * The marketplaces flag for Enrollment. + */ + @JsonProperty(value = "marketplacesEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean marketplacesEnabled; + + /** + * The reserved instances flag for Enrollment. + */ + @JsonProperty(value = "reservedInstancesEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean reservedInstancesEnabled; + + /** + * Get the accountOwnerViewCharges flag for Enrollment. + * + * @return the accountOwnerViewCharges value + */ + public Boolean accountOwnerViewCharges() { + return this.accountOwnerViewCharges; + } + + /** + * Get the departmentAdminViewCharges flag for Enrollment. + * + * @return the departmentAdminViewCharges value + */ + public Boolean departmentAdminViewCharges() { + return this.departmentAdminViewCharges; + } + + /** + * Get the marketplaces flag for Enrollment. + * + * @return the marketplacesEnabled value + */ + public Boolean marketplacesEnabled() { + return this.marketplacesEnabled; + } + + /** + * Get the reserved instances flag for Enrollment. + * + * @return the reservedInstancesEnabled value + */ + public Boolean reservedInstancesEnabled() { + return this.reservedInstancesEnabled; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Error.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Error.java new file mode 100644 index 0000000000000..e3411f74080ff --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ErrorDetails.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ErrorDetails.java new file mode 100644 index 0000000000000..2cd27faa4e5d3 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ErrorDetails.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the error. + */ +public class ErrorDetails { + /** + * Error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * The target of the particular error. + */ + @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY) + private String target; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get the target of the particular error. + * + * @return the target value + */ + public String target() { + return this.target; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ErrorResponse.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ErrorResponse.java new file mode 100644 index 0000000000000..e2d0ca4bfd6b2 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ErrorResponse.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates that the service is not able to process the + * incoming request. The reason is provided in the error message. + */ +public class ErrorResponse { + /** + * The details of the error. + */ + @JsonProperty(value = "error") + private ErrorDetails error; + + /** + * Get the details of the error. + * + * @return the error value + */ + public ErrorDetails error() { + return this.error; + } + + /** + * Set the details of the error. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDetails error) { + this.error = error; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ErrorResponseException.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ErrorResponseException.java new file mode 100644 index 0000000000000..9b039e16b552d --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InitiateTransferRequest.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InitiateTransferRequest.java new file mode 100644 index 0000000000000..405be9b3ce7bd --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InitiateTransferRequest.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.v2018_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Request parameters to initiate transfer. + */ +@JsonFlatten +public class InitiateTransferRequest { + /** + * Target Usage context for devTest subscriptions. + */ + @JsonProperty(value = "properties.billingProfileId") + private String billingProfileId; + + /** + * Email Id of recipient for transfer. + */ + @JsonProperty(value = "properties.recipientEmailId") + private String recipientEmailId; + + /** + * Get target Usage context for devTest subscriptions. + * + * @return the billingProfileId value + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Set target Usage context for devTest subscriptions. + * + * @param billingProfileId the billingProfileId value to set + * @return the InitiateTransferRequest object itself. + */ + public InitiateTransferRequest withBillingProfileId(String billingProfileId) { + this.billingProfileId = billingProfileId; + return this; + } + + /** + * Get email Id of recipient for transfer. + * + * @return the recipientEmailId value + */ + public String recipientEmailId() { + return this.recipientEmailId; + } + + /** + * Set email Id of recipient for transfer. + * + * @param recipientEmailId the recipientEmailId value to set + * @return the InitiateTransferRequest object itself. + */ + public InitiateTransferRequest withRecipientEmailId(String recipientEmailId) { + this.recipientEmailId = recipientEmailId; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSection.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSection.java new file mode 100644 index 0000000000000..510b568f9592c --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSection.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.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.InvoiceSectionInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingProfileInner; + +/** + * Type representing InvoiceSection. + */ +public interface InvoiceSection extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the billingProfiles value. + */ + List billingProfiles(); + + /** + * @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 template for a InvoiceSection update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithBillingProfiles, UpdateStages.WithDisplayName { + } + + /** + * Grouping of InvoiceSection update stages. + */ + interface UpdateStages { + /** + * The stage of the invoicesection update allowing to specify BillingProfiles. + */ + interface WithBillingProfiles { + /** + * Specifies billingProfiles. + * @param billingProfiles The billing profiles associated to the billing account + * @return the next update stage + */ + Update withBillingProfiles(List billingProfiles); + } + + /** + * The stage of the invoicesection update allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName The name of the InvoiceSection + * @return the next update stage + */ + Update withDisplayName(String displayName); + } + + } +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSectionCreationRequest.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSectionCreationRequest.java new file mode 100644 index 0000000000000..7236efd01fab0 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSectionCreationRequest.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.v2018_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of an InvoiceSection. + */ +public class InvoiceSectionCreationRequest { + /** + * The name of the InvoiceSection. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The billing profile id. + */ + @JsonProperty(value = "billingProfileId") + private String billingProfileId; + + /** + * Get the name of the InvoiceSection. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the name of the InvoiceSection. + * + * @param displayName the displayName value to set + * @return the InvoiceSectionCreationRequest object itself. + */ + public InvoiceSectionCreationRequest withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the billing profile id. + * + * @return the billingProfileId value + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Set the billing profile id. + * + * @param billingProfileId the billingProfileId value to set + * @return the InvoiceSectionCreationRequest object itself. + */ + public InvoiceSectionCreationRequest withBillingProfileId(String billingProfileId) { + this.billingProfileId = billingProfileId; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSectionListResult.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSectionListResult.java new file mode 100644 index 0000000000000..f81d2598ba8ff --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.InvoiceSectionListResultInner; +import com.microsoft.azure.management.billing.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSections.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSections.java new file mode 100644 index 0000000000000..c04db388cd764 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSections.java @@ -0,0 +1,78 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Observable; +import rx.Completable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.InvoiceSectionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing InvoiceSections. + */ +public interface InvoiceSections extends HasInner { + /** + * Lists all invoice sections for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountNameAsync(String billingAccountName); + + /** + * Lists all invoice sections under a billing profile for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName); + + /** + * Elevates the caller's access to match their billing profile access. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable elevateToBillingProfileAsync(String billingAccountName, String invoiceSectionName); + + /** + * Get the InvoiceSection by id. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String invoiceSectionName); + + /** + * The operation to create a InvoiceSection. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the Create InvoiceSection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable createAsync(String billingAccountName, InvoiceSectionCreationRequest parameters); + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByCreateSubscriptionPermissionAsync(final String billingAccountName); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSectionsCreateHeaders.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSectionsCreateHeaders.java new file mode 100644 index 0000000000000..2f2a2c2d227d0 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSectionsCreateHeaders.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Create operation. + */ +public class InvoiceSectionsCreateHeaders { + /** + * Location URI to poll for result. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Recommends the retryable time after receiving this. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * URI to poll for the operation status. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Get location URI to poll for result. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set location URI to poll for result. + * + * @param location the location value to set + * @return the InvoiceSectionsCreateHeaders object itself. + */ + public InvoiceSectionsCreateHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get recommends the retryable time after receiving this. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set recommends the retryable time after receiving this. + * + * @param retryAfter the retryAfter value to set + * @return the InvoiceSectionsCreateHeaders object itself. + */ + public InvoiceSectionsCreateHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get uRI to poll for the operation status. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set uRI to poll for the operation status. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the InvoiceSectionsCreateHeaders object itself. + */ + public InvoiceSectionsCreateHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSectionsUpdateHeaders.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSectionsUpdateHeaders.java new file mode 100644 index 0000000000000..971c4d3dd5b0d --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSummary.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSummary.java new file mode 100644 index 0000000000000..22e815041d8d8 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/InvoiceSummary.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.InvoiceSummaryInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import java.util.List; +import org.joda.time.DateTime; + +/** + * Type representing InvoiceSummary. + */ +public interface InvoiceSummary extends HasInner, HasManager { + /** + * @return the amountDue value. + */ + Amount amountDue(); + + /** + * @return the billedAmount value. + */ + Amount billedAmount(); + + /** + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * @return the billingProfileName value. + */ + String billingProfileName(); + + /** + * @return the documentUrls value. + */ + List documentUrls(); + + /** + * @return the dueDate value. + */ + DateTime dueDate(); + + /** + * @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 name value. + */ + String name(); + + /** + * @return the payments value. + */ + List payments(); + + /** + * @return the purchaseOrderNumber value. + */ + String purchaseOrderNumber(); + + /** + * @return the status value. + */ + String status(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Invoices.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Invoices.java new file mode 100644 index 0000000000000..ba7797f174765 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Invoices.java @@ -0,0 +1,53 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.InvoicesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Invoices. + */ +public interface Invoices extends HasInner { + /** + * List of invoices for a billing profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final String periodStartDate, final String periodEndDate); + + /** + * Get the invoice by name. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param invoiceName Invoice Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String billingProfileName, String invoiceName); + + /** + * List of invoices for a billing account. + * + * @param billingAccountName Billing Account Id. + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountNameAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/LineOfCredit.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/LineOfCredit.java new file mode 100644 index 0000000000000..ec5936933a2e0 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/LineOfCredit.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.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.LineOfCreditInner; + +/** + * Type representing LineOfCredit. + */ +public interface LineOfCredit extends HasInner, HasManager { + /** + * @return the creditLimit value. + */ + Amount creditLimit(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reason value. + */ + String reason(); + + /** + * @return the remainingBalance value. + */ + Amount remainingBalance(); + + /** + * @return the status value. + */ + Status status(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/LineOfCredits.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/LineOfCredits.java new file mode 100644 index 0000000000000..895ab8a614ca8 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/LineOfCredits.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.LineOfCreditInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.LineOfCreditsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing LineOfCredits. + */ +public interface LineOfCredits extends HasInner { + /** + * Get the current line of credit. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(); + + /** + * Increase the current line of credit. + * + * @param parameters Parameters supplied to the increase line of credit operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateAsync(LineOfCreditInner parameters); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/LineOfCreditsUpdateHeaders.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/LineOfCreditsUpdateHeaders.java new file mode 100644 index 0000000000000..7fb9b24ee68ed --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/LineOfCreditsUpdateHeaders.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Update operation. + */ +public class LineOfCreditsUpdateHeaders { + /** + * Location URI to poll for result. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Recommends the retryable time after receiving this. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * URI to poll for the operation status. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Get location URI to poll for result. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set location URI to poll for result. + * + * @param location the location value to set + * @return the LineOfCreditsUpdateHeaders object itself. + */ + public LineOfCreditsUpdateHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get recommends the retryable time after receiving this. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set recommends the retryable time after receiving this. + * + * @param retryAfter the retryAfter value to set + * @return the LineOfCreditsUpdateHeaders object itself. + */ + public LineOfCreditsUpdateHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get uRI to poll for the operation status. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set uRI to poll for the operation status. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the LineOfCreditsUpdateHeaders object itself. + */ + public LineOfCreditsUpdateHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Operation.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Operation.java new file mode 100644 index 0000000000000..7baefe798d41b --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Operation.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/OperationDisplay.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/OperationDisplay.java new file mode 100644 index 0000000000000..3e33b794eacf1 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/OperationDisplay.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Billing. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Resource on which the operation is performed: Invoice, etc. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get service provider: Microsoft.Billing. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get resource on which the operation is performed: Invoice, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/OperationStatus.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/OperationStatus.java new file mode 100644 index 0000000000000..7fbca1cf3f66c --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/OperationStatus.java @@ -0,0 +1,84 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * status of the Billing POST/PUT operation. + */ +public class OperationStatus { + /** + * The operation Id. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Status of the pending operation. + */ + @JsonProperty(value = "status") + private String status; + + /** + * Status Detail of the pending operation. + */ + @JsonProperty(value = "statusDetail") + private String statusDetail; + + /** + * Get the operation Id. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get status of the pending operation. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set status of the pending operation. + * + * @param status the status value to set + * @return the OperationStatus object itself. + */ + public OperationStatus withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get status Detail of the pending operation. + * + * @return the statusDetail value + */ + public String statusDetail() { + return this.statusDetail; + } + + /** + * Set status Detail of the pending operation. + * + * @param statusDetail the statusDetail value to set + * @return the OperationStatus object itself. + */ + public OperationStatus withStatusDetail(String statusDetail) { + this.statusDetail = statusDetail; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Operations.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Operations.java new file mode 100644 index 0000000000000..679990d961379 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available billing REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Participants.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Participants.java new file mode 100644 index 0000000000000..091e2b073c621 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details about the participant or signer. + */ +public class Participants { + /** + * The signing status. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * The date when status got changed. + */ + @JsonProperty(value = "statusDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime statusDate; + + /** + * The email address of the participant or signer. + */ + @JsonProperty(value = "email", access = JsonProperty.Access.WRITE_ONLY) + private String email; + + /** + * Get the signing status. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Get the date when status got changed. + * + * @return the statusDate value + */ + public DateTime statusDate() { + return this.statusDate; + } + + /** + * Get the email address of the participant or signer. + * + * @return the email value + */ + public String email() { + return this.email; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PaymentMethod.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PaymentMethod.java new file mode 100644 index 0000000000000..9679287ad048a --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PaymentMethod.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.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.PaymentMethodInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import org.joda.time.DateTime; + +/** + * Type representing PaymentMethod. + */ +public interface PaymentMethod extends HasInner, HasManager { + /** + * @return the currency value. + */ + String currency(); + + /** + * @return the details value. + */ + String details(); + + /** + * @return the expiration value. + */ + DateTime 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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PaymentMethodType.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PaymentMethodType.java new file mode 100644 index 0000000000000..d2bc5119809f3 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PaymentMethods.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PaymentMethods.java new file mode 100644 index 0000000000000..07b3095604d0d --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.PaymentMethodsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PaymentMethods. + */ +public interface PaymentMethods extends HasInner { + /** + * Lists the Payment Methods by billing profile Id. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName); + + /** + * Lists the Payment Methods by billing account Id. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountNameAsync(final String billingAccountName); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PaymentProperties.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PaymentProperties.java new file mode 100644 index 0000000000000..b14d692efef25 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PaymentProperties.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.v2018_11_01_preview; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The properties of the 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 of the payment. + */ + @JsonProperty(value = "date", access = JsonProperty.Access.WRITE_ONLY) + private DateTime dateProperty; + + /** + * 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 of the payment. + * + * @return the dateProperty value + */ + public DateTime dateProperty() { + return this.dateProperty; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Policies.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Policies.java new file mode 100644 index 0000000000000..b5c50350cc80a --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Policies.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.PolicyInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.PoliciesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Policies. + */ +public interface Policies extends HasInner { + /** + * The policy for a given billing account name and billing profile name. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByBillingProfileNameAsync(String billingAccountName, String billingProfileName); + + /** + * The operation to update a policy. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param parameters Parameters supplied to the update policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateAsync(String billingAccountName, String billingProfileName, PolicyInner parameters); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Policy.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Policy.java new file mode 100644 index 0000000000000..176677496d00a --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.PolicyInner; + +/** + * Type representing Policy. + */ +public interface Policy extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the marketplacePurchasesAllowed value. + */ + Boolean marketplacePurchasesAllowed(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the reservationPurchasesAllowed value. + */ + Boolean reservationPurchasesAllowed(); + + /** + * @return the subscriptionOwnerCanViewCharges value. + */ + Boolean subscriptionOwnerCanViewCharges(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PriceSheetDownloadHeaders.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PriceSheetDownloadHeaders.java new file mode 100644 index 0000000000000..505c1929bb331 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PriceSheetDownloadHeaders.java @@ -0,0 +1,123 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Download operation. + */ +public class PriceSheetDownloadHeaders { + /** + * GET this URL to retrieve the status of the asynchronous operation. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * The amount of delay to use while the status of the operation is checked. + * The value is expressed in seconds. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /** + * To get the progress of the operation, call GET operation on the URL in + * Azure-AsyncOperation header field. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * The operation entity Id GUID. + */ + @JsonProperty(value = "OData-EntityId") + private String oDataEntityId; + + /** + * Get gET this URL to retrieve the status of the asynchronous operation. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set gET this URL to retrieve the status of the asynchronous operation. + * + * @param location the location value to set + * @return the PriceSheetDownloadHeaders object itself. + */ + public PriceSheetDownloadHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @return the retryAfter value + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set the amount of delay to use while the status of the operation is checked. The value is expressed in seconds. + * + * @param retryAfter the retryAfter value to set + * @return the PriceSheetDownloadHeaders object itself. + */ + public PriceSheetDownloadHeaders withRetryAfter(String retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get to get the progress of the operation, call GET operation on the URL in Azure-AsyncOperation header field. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set to get the progress of the operation, call GET operation on the URL in Azure-AsyncOperation header field. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the PriceSheetDownloadHeaders object itself. + */ + public PriceSheetDownloadHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the operation entity Id GUID. + * + * @return the oDataEntityId value + */ + public String oDataEntityId() { + return this.oDataEntityId; + } + + /** + * Set the operation entity Id GUID. + * + * @param oDataEntityId the oDataEntityId value to set + * @return the PriceSheetDownloadHeaders object itself. + */ + public PriceSheetDownloadHeaders withODataEntityId(String oDataEntityId) { + this.oDataEntityId = oDataEntityId; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PriceSheets.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PriceSheets.java new file mode 100644 index 0000000000000..20e75f835da65 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/PriceSheets.java @@ -0,0 +1,29 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.PriceSheetsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PriceSheets. + */ +public interface PriceSheets extends HasInner { + /** + * Download price sheet for an invoice. + * + * @param billingAccountName Azure Billing Account ID. + * @param invoiceName The name of an invoice resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable downloadAsync(String billingAccountName, String invoiceName); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductDetails.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductDetails.java new file mode 100644 index 0000000000000..f86ae901a848f --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details of the product to be transferred. + */ +public class ProductDetails { + /** + * Type of the product to be transferred. Possible values include: + * 'AzureSubscription', 'AzureReservation'. + */ + @JsonProperty(value = "productType") + private ProductType productType; + + /** + * Id of product to be transferred. + */ + @JsonProperty(value = "productId") + private String productId; + + /** + * Get type of the product to be transferred. Possible values include: 'AzureSubscription', 'AzureReservation'. + * + * @return the productType value + */ + public ProductType productType() { + return this.productType; + } + + /** + * Set type of the product to be 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 id of product to be transferred. + * + * @return the productId value + */ + public String productId() { + return this.productId; + } + + /** + * Set id of product to be 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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductStatusType.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductStatusType.java new file mode 100644 index 0000000000000..8672a4b1f026c --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductSummary.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductSummary.java new file mode 100644 index 0000000000000..bd5d1c4acbb50 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductSummary.java @@ -0,0 +1,126 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.ProductSummaryInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import org.joda.time.DateTime; + +/** + * Type representing ProductSummary. + */ +public interface ProductSummary extends HasInner, HasManager { + /** + * @return the availabilityId value. + */ + String availabilityId(); + + /** + * @return the billingFrequency value. + */ + BillingFrequency billingFrequency(); + + /** + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * @return the billingProfileName value. + */ + String billingProfileName(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the endDate value. + */ + DateTime endDate(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * @return the invoiceSectionName value. + */ + String invoiceSectionName(); + + /** + * @return the lastCharge value. + */ + Amount lastCharge(); + + /** + * @return the lastChargeDate value. + */ + DateTime lastChargeDate(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the parentProductId value. + */ + String parentProductId(); + + /** + * @return the productType value. + */ + String productType(); + + /** + * @return the productTypeId value. + */ + String productTypeId(); + + /** + * @return the purchaseDate value. + */ + DateTime purchaseDate(); + + /** + * @return the quantity value. + */ + Double quantity(); + + /** + * @return the skuDescription value. + */ + String skuDescription(); + + /** + * @return the skuId value. + */ + String skuId(); + + /** + * @return the status value. + */ + ProductStatusType status(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductTransferStatus.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductTransferStatus.java new file mode 100644 index 0000000000000..1db948b85ef53 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductTransferValidationErrorCode.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductTransferValidationErrorCode.java new file mode 100644 index 0000000000000..59e668b328192 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductType.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductType.java new file mode 100644 index 0000000000000..e8919564bebd2 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Products.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Products.java new file mode 100644 index 0000000000000..31fc99434da6a --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Products.java @@ -0,0 +1,94 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.ProductsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Products. + */ +public interface Products extends HasInner { + /** + * Lists products by invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName); + + /** + * Get a single product by name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String invoiceSectionName, String productName); + + /** + * The operation to transfer a Product to another invoice section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @param parameters Parameters supplied to the Transfer Product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable transferAsync(String billingAccountName, String invoiceSectionName, String productName, TransferProductRequestProperties parameters); + + /** + * Validates the transfer of products across invoice sections. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @param parameters Parameters supplied to the Transfer Products operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable validateTransferAsync(String billingAccountName, String invoiceSectionName, String productName, TransferProductRequestProperties parameters); + + /** + * Cancel auto renew for product by product id and billing account name. + * + * @param billingAccountName Billing Account Id. + * @param productName Invoice Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateAutoRenewByBillingAccountNameAsync(String billingAccountName, String productName); + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateAutoRenewByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String productName); + + /** + * Lists products by billing account name. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountNameAsync(final String billingAccountName); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductsTransferHeaders.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductsTransferHeaders.java new file mode 100644 index 0000000000000..e917cb29b53c6 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ProductsTransferHeaders.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Transfer operation. + */ +public class ProductsTransferHeaders { + /** + * Location URI to poll for result. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Recommends the retryable time after receiving this. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /** + * URI to poll for the operation status. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Get location URI to poll for result. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set location URI to poll for result. + * + * @param location the location value to set + * @return the ProductsTransferHeaders object itself. + */ + public ProductsTransferHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get recommends the retryable time after receiving this. + * + * @return the retryAfter value + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set recommends the retryable time after receiving this. + * + * @param retryAfter the retryAfter value to set + * @return the ProductsTransferHeaders object itself. + */ + public ProductsTransferHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get uRI to poll for the operation status. + * + * @return the azureAsyncOperation value + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set uRI to poll for the operation status. + * + * @param azureAsyncOperation the azureAsyncOperation value to set + * @return the ProductsTransferHeaders object itself. + */ + public ProductsTransferHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/RecipientTransferDetails.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/RecipientTransferDetails.java new file mode 100644 index 0000000000000..473ada1df1c6a --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/RecipientTransferDetails.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.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 initiatorEmailId value. + */ + String initiatorEmailId(); + + /** + * @return the lastModifiedTime value. + */ + DateTime lastModifiedTime(); + + /** + * @return the recipientEmailId value. + */ + String recipientEmailId(); + + /** + * @return the transferStatus value. + */ + TransferStatus transferStatus(); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/RecipientTransfers.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/RecipientTransfers.java new file mode 100644 index 0000000000000..894ff83500ecc --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/RecipientTransfers.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.RecipientTransfersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing RecipientTransfers. + */ +public interface RecipientTransfers extends HasInner { + /** + * Accepts the transfer with given transfer Id. + * + * @param transferName Transfer Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable acceptAsync(String transferName); + + /** + * Declines the transfer with given transfer Id. + * + * @param transferName Transfer Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable declineAsync(String transferName); + + /** + * Gets the transfer with given transfer Id. + * + * @param transferName Transfer Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String transferName); + + /** + * Lists the transfers received by caller. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Reseller.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Reseller.java new file mode 100644 index 0000000000000..73a36d5a74784 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Reseller.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Details about a reseller. + */ +public class Reseller { + /** + * The reseller id. + */ + @JsonProperty(value = "resellerId", access = JsonProperty.Access.WRITE_ONLY) + private String resellerId; + + /** + * A description of the reseller. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the reseller id. + * + * @return the resellerId value + */ + public String resellerId() { + return this.resellerId; + } + + /** + * Get a description of the reseller. + * + * @return the description value + */ + public String description() { + return this.description; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ReservationType.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ReservationType.java new file mode 100644 index 0000000000000..bb80c5c3b4122 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Status.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Status.java new file mode 100644 index 0000000000000..b57fca5bc0d90 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Status.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Status. + */ +public final class Status extends ExpandableStringEnum { + /** Static value Approved for Status. */ + public static final Status APPROVED = fromString("Approved"); + + /** Static value Rejected for Status. */ + public static final Status REJECTED = fromString("Rejected"); + + /** + * Creates or finds a Status from its string representation. + * @param name a name to look for + * @return the corresponding Status + */ + @JsonCreator + public static Status fromString(String name) { + return fromString(name, Status.class); + } + + /** + * @return known Status values + */ + public static Collection values() { + return values(Status.class); + } +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/SubscriptionTransferValidationErrorCode.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/SubscriptionTransferValidationErrorCode.java new file mode 100644 index 0000000000000..fa8cc03485812 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransactionTypeKind.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransactionTypeKind.java new file mode 100644 index 0000000000000..bd12f3a32a6c5 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Transactions.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Transactions.java new file mode 100644 index 0000000000000..a87aa50d2c11c --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Transactions.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.v2018_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.TransactionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Transactions. + */ +public interface Transactions extends HasInner { + /** + * Lists the transactions by billing profile name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate); + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByCustomerNameAsync(final String billingAccountName, final String customerName, final String startDate, final String endDate); + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate); + + /** + * Lists the transactions by billing account name for given start and end date. + * + * @param billingAccountName Billing Account Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByBillingAccountNameAsync(final String billingAccountName, final String startDate, final String endDate); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransactionsSummary.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransactionsSummary.java new file mode 100644 index 0000000000000..16f111258117c --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransactionsSummary.java @@ -0,0 +1,136 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.TransactionsSummaryInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import org.joda.time.DateTime; + +/** + * Type representing TransactionsSummary. + */ +public interface TransactionsSummary extends HasInner, HasManager { + /** + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * @return the billingProfileName value. + */ + String billingProfileName(); + + /** + * @return the customerDisplayName value. + */ + String customerDisplayName(); + + /** + * @return the customerId value. + */ + String customerId(); + + /** + * @return the dateProperty value. + */ + DateTime dateProperty(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the invoice value. + */ + String invoice(); + + /** + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * @return the invoiceSectionName value. + */ + String invoiceSectionName(); + + /** + * @return the kind value. + */ + TransactionTypeKind kind(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the orderId value. + */ + String orderId(); + + /** + * @return the orderName value. + */ + String orderName(); + + /** + * @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 subscriptionId value. + */ + String subscriptionId(); + + /** + * @return the subscriptionName value. + */ + String subscriptionName(); + + /** + * @return the transactionAmount value. + */ + Amount transactionAmount(); + + /** + * @return the transactionType value. + */ + ReservationType transactionType(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransferBillingSubscriptionRequest.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransferBillingSubscriptionRequest.java new file mode 100644 index 0000000000000..ecc25fa034168 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransferBillingSubscriptionRequestProperties.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransferBillingSubscriptionRequestProperties.java new file mode 100644 index 0000000000000..a7301cedc39b3 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransferBillingSubscriptionResult.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransferBillingSubscriptionResult.java new file mode 100644 index 0000000000000..4766557cd9918 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.TransferBillingSubscriptionResultInner; + +/** + * Type representing TransferBillingSubscriptionResult. + */ +public interface TransferBillingSubscriptionResult extends HasInner, HasManager { + /** + * @return the billingSubscriptionName value. + */ + String billingSubscriptionName(); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransferDetails.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransferDetails.java new file mode 100644 index 0000000000000..95fd5eb82922a --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransferDetails.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.TransferDetailsInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing TransferDetails. + */ +public interface TransferDetails extends HasInner, HasManager { + /** + * @return the billingAccountId value. + */ + String billingAccountId(); + + /** + * @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 initiatorEmailId value. + */ + String initiatorEmailId(); + + /** + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * @return the lastModifiedTime value. + */ + DateTime lastModifiedTime(); + + /** + * @return the recipientEmailId value. + */ + String recipientEmailId(); + + /** + * @return the transferStatus value. + */ + TransferStatus transferStatus(); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransferProductRequestProperties.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransferProductRequestProperties.java new file mode 100644 index 0000000000000..a55653126b83c --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransferStatus.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/TransferStatus.java new file mode 100644 index 0000000000000..ef2ee818b9caa --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Transfers.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Transfers.java new file mode 100644 index 0000000000000..4be4a0d04bc5f --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/Transfers.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.v2018_11_01_preview; + +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.TransfersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Transfers. + */ +public interface Transfers extends HasInner { + /** + * Gets the transfer details for given transfer Id. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param transferName Transfer Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String billingAccountName, String invoiceSectionName, String transferName); + + /** + * Lists all transfer's details initiated from given invoice section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String billingAccountName, final String invoiceSectionName); + + /** + * Cancels the transfer for given transfer Id. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param transferName Transfer Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable cancelAsync(String billingAccountName, String invoiceSectionName, String transferName); + + /** + * Initiates the request to transfer the legacy subscriptions or RIs. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param body Initiate transfer parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable initiateAsync(String billingAccountName, String invoiceSectionName, InitiateTransferRequest body); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/UpdateAutoRenew.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/UpdateAutoRenew.java new file mode 100644 index 0000000000000..47686cd24e0ad --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/UpdateAutoRenewOperationSummary.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/UpdateAutoRenewOperationSummary.java new file mode 100644 index 0000000000000..462c826401e2b --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/UpdateAutoRenewOperationSummary.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.UpdateAutoRenewOperationSummaryInner; +import org.joda.time.DateTime; + +/** + * Type representing UpdateAutoRenewOperationSummary. + */ +public interface UpdateAutoRenewOperationSummary extends HasInner, HasManager { + /** + * @return the endDate value. + */ + DateTime endDate(); + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/UpdateAutoRenewRequest.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/UpdateAutoRenewRequest.java new file mode 100644 index 0000000000000..df4f3f7298637 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Request parameters to update auto renew for support product. + */ +public class UpdateAutoRenewRequest { + /** + * Request parameters to update auto renew policy a product. Possible + * values include: 'true', 'false'. + */ + @JsonProperty(value = "autoRenew") + private UpdateAutoRenew autoRenew; + + /** + * Get request parameters to update auto renew policy a product. Possible values include: 'true', 'false'. + * + * @return the autoRenew value + */ + public UpdateAutoRenew autoRenew() { + return this.autoRenew; + } + + /** + * Set request parameters to update auto renew policy 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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ValidateAddressResponse.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ValidateAddressResponse.java new file mode 100644 index 0000000000000..44ad6cfb6a33f --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ValidateAddressResponse.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.ValidateAddressResponseInner; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.AddressInner; +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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ValidateProductTransferEligibilityError.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ValidateProductTransferEligibilityError.java new file mode 100644 index 0000000000000..414b41b1ea1f7 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ValidateProductTransferEligibilityResult.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ValidateProductTransferEligibilityResult.java new file mode 100644 index 0000000000000..62edf208c42f0 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ValidateSubscriptionTransferEligibilityError.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ValidateSubscriptionTransferEligibilityError.java new file mode 100644 index 0000000000000..1f3bfe7df55f9 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ValidateSubscriptionTransferEligibilityResult.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/ValidateSubscriptionTransferEligibilityResult.java new file mode 100644 index 0000000000000..9ee34cbe46b7d --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2018_11_01_preview.implementation.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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AddressInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AddressInner.java new file mode 100644 index 0000000000000..56fee112bfb25 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AddressInner.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.v2018_11_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Address details. + */ +public class AddressInner { + /** + * 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 Line1. + */ + @JsonProperty(value = "addressLine1") + private String addressLine1; + + /** + * Address Line2. + */ + @JsonProperty(value = "addressLine2") + private String addressLine2; + + /** + * Address Line3. + */ + @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; + + /** + * Address 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 AddressInner object itself. + */ + public AddressInner 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 AddressInner object itself. + */ + public AddressInner 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 AddressInner object itself. + */ + public AddressInner withCompanyName(String companyName) { + this.companyName = companyName; + return this; + } + + /** + * Get address Line1. + * + * @return the addressLine1 value + */ + public String addressLine1() { + return this.addressLine1; + } + + /** + * Set address Line1. + * + * @param addressLine1 the addressLine1 value to set + * @return the AddressInner object itself. + */ + public AddressInner withAddressLine1(String addressLine1) { + this.addressLine1 = addressLine1; + return this; + } + + /** + * Get address Line2. + * + * @return the addressLine2 value + */ + public String addressLine2() { + return this.addressLine2; + } + + /** + * Set address Line2. + * + * @param addressLine2 the addressLine2 value to set + * @return the AddressInner object itself. + */ + public AddressInner withAddressLine2(String addressLine2) { + this.addressLine2 = addressLine2; + return this; + } + + /** + * Get address Line3. + * + * @return the addressLine3 value + */ + public String addressLine3() { + return this.addressLine3; + } + + /** + * Set address Line3. + * + * @param addressLine3 the addressLine3 value to set + * @return the AddressInner object itself. + */ + public AddressInner 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 AddressInner object itself. + */ + public AddressInner 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 AddressInner object itself. + */ + public AddressInner 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 AddressInner object itself. + */ + public AddressInner withCountry(String country) { + this.country = country; + return this; + } + + /** + * Get address Postal Code. + * + * @return the postalCode value + */ + public String postalCode() { + return this.postalCode; + } + + /** + * Set address Postal Code. + * + * @param postalCode the postalCode value to set + * @return the AddressInner object itself. + */ + public AddressInner withPostalCode(String postalCode) { + this.postalCode = postalCode; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AddressesImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AddressesImpl.java new file mode 100644 index 0000000000000..98e9fdc08d157 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AddressesImpl.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Addresses; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ValidateAddressResponse; + +class AddressesImpl extends WrapperImpl implements Addresses { + private final BillingManager manager; + + AddressesImpl(BillingManager manager) { + super(manager.inner().addresses()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable validateAsync(AddressInner address) { + AddressesInner 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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AddressesInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AddressesInner.java new file mode 100644 index 0000000000000..c8f491e040482 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AddressesInner.java @@ -0,0 +1,138 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.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 Addresses. + */ +public class AddressesInner { + /** The Retrofit service to perform REST calls. */ + private AddressesService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of AddressesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AddressesInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(AddressesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Addresses to be + * used by Retrofit to perform actually REST calls. + */ + interface AddressesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Addresses validate" }) + @POST("providers/Microsoft.Billing/validateAddress") + Observable> validate(@Query("api-version") String apiVersion, @Body AddressInner address, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Validates the address. + * + * @param address the AddressInner 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(AddressInner address) { + return validateWithServiceResponseAsync(address).toBlocking().single().body(); + } + + /** + * Validates the address. + * + * @param address the AddressInner 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(AddressInner address, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateWithServiceResponseAsync(address), serviceCallback); + } + + /** + * Validates the address. + * + * @param address the AddressInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateAddressResponseInner object + */ + public Observable validateAsync(AddressInner address) { + return validateWithServiceResponseAsync(address).map(new Func1, ValidateAddressResponseInner>() { + @Override + public ValidateAddressResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Validates the address. + * + * @param address the AddressInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateAddressResponseInner object + */ + public Observable> validateWithServiceResponseAsync(AddressInner 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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementImpl.java new file mode 100644 index 0000000000000..63d9ad0a3f6fb --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementImpl.java @@ -0,0 +1,84 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.Agreement; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_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 String agreementLink() { + return this.inner().agreementLink(); + } + + @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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementInner.java new file mode 100644 index 0000000000000..68c01ae1bf2c4 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementInner.java @@ -0,0 +1,109 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Participants; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An agreement resource. + */ +@JsonFlatten +public class AgreementInner extends ProxyResource { + /** + * The link to the agreement. + */ + @JsonProperty(value = "properties.agreementLink", access = JsonProperty.Access.WRITE_ONLY) + private String agreementLink; + + /** + * Effective date. + */ + @JsonProperty(value = "properties.effectiveDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime effectiveDate; + + /** + * Expiration date. + */ + @JsonProperty(value = "properties.expirationDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime expirationDate; + + /** + * Participants or signer of the agreement. + */ + @JsonProperty(value = "properties.participants") + private List participants; + + /** + * The agreement status. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * Get the link to the agreement. + * + * @return the agreementLink value + */ + public String agreementLink() { + return this.agreementLink; + } + + /** + * Get effective date. + * + * @return the effectiveDate value + */ + public DateTime effectiveDate() { + return this.effectiveDate; + } + + /** + * Get expiration date. + * + * @return the expirationDate value + */ + public DateTime expirationDate() { + return this.expirationDate; + } + + /** + * Get participants or signer of the agreement. + * + * @return the participants value + */ + public List participants() { + return this.participants; + } + + /** + * Set participants or signer of the 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 agreement status. + * + * @return the status value + */ + public String status() { + return this.status; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementsImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementsImpl.java new file mode 100644 index 0000000000000..ff8a668922ca8 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementsImpl.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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Agreements; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2018_11_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 listByBillingAccountNameAsync(final String billingAccountName) { + AgreementsInner client = this.inner(); + return client.listByBillingAccountNameAsync(billingAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Agreement call(AgreementInner inner) { + return wrapModel(inner); + } + }); + } + + @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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementsInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementsInner.java new file mode 100644 index 0000000000000..fa6773d38512c --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AgreementsInner.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.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in 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.v2018_11_01_preview.Agreements listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Agreements listByBillingAccountNameNext" }) + @GET + Observable> listByBillingAccountNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all agreements for a billing account. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<AgreementInner> object if successful. + */ + public PagedList listByBillingAccountName(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all agreements for a billing account. + * + * @param billingAccountName Billing Account Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all agreements for a billing account. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AgreementInner> object + */ + public Observable> listByBillingAccountNameAsync(final String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all agreements for a billing account. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AgreementInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountNameSinglePageAsync(billingAccountName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all agreements for a billing account. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AgreementInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all agreements for a billing account. + * + * @param billingAccountName Billing Account Id. + * @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 PagedList<AgreementInner> object if successful. + */ + public PagedList listByBillingAccountName(final String billingAccountName, final String expand) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName, expand).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all agreements for a billing account. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the participants. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final String expand, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName, expand), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all agreements for a billing account. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the participants. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AgreementInner> object + */ + public Observable> listByBillingAccountNameAsync(final String billingAccountName, final String expand) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all agreements for a billing account. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the participants. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AgreementInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName, final String expand) { + return listByBillingAccountNameSinglePageAsync(billingAccountName, expand) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all agreements for a billing account. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param expand May be used to expand the participants. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AgreementInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName, final String expand) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the agreement by name. + * + * @param billingAccountName Billing Account Id. + * @param agreementName Agreement Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @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(); + } + + /** + * Get the agreement by name. + * + * @param billingAccountName Billing Account Id. + * @param agreementName Agreement Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String agreementName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, agreementName), serviceCallback); + } + + /** + * Get the agreement by name. + * + * @param billingAccountName Billing Account Id. + * @param agreementName Agreement Id. + * @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(); + } + }); + } + + /** + * Get the agreement by name. + * + * @param billingAccountName Billing Account Id. + * @param agreementName Agreement Id. + * @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); + } + } + }); + } + + /** + * Get the agreement by name. + * + * @param billingAccountName Billing Account Id. + * @param agreementName Agreement Id. + * @param expand May be used to expand the participants. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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(); + } + + /** + * Get the agreement by name. + * + * @param billingAccountName Billing Account Id. + * @param agreementName Agreement Id. + * @param expand May be used to expand the participants. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @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); + } + + /** + * Get the agreement by name. + * + * @param billingAccountName Billing Account Id. + * @param agreementName Agreement Id. + * @param expand May be used to expand the participants. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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(); + } + }); + } + + /** + * Get the agreement by name. + * + * @param billingAccountName Billing Account Id. + * @param agreementName Agreement Id. + * @param expand May be used to expand the participants. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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); + } + + /** + * Lists all agreements for a billing account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<AgreementInner> object if successful. + */ + public PagedList listByBillingAccountNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all agreements for a billing account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all agreements for a billing account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AgreementInner> object + */ + public Observable> listByBillingAccountNameNextAsync(final String nextPageLink) { + return listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all agreements for a billing account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<AgreementInner> object + */ + public Observable>> listByBillingAccountNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all agreements for a billing account. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<AgreementInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingAccountNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AvailableBalanceImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AvailableBalanceImpl.java new file mode 100644 index 0000000000000..240924d7de0d7 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.AvailableBalance; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AvailableBalanceInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AvailableBalanceInner.java new file mode 100644 index 0000000000000..d98c0918ab98f --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.Amount; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Latest available balance on Monetary Credit PI. + */ +@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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AvailableBalancesImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AvailableBalancesImpl.java new file mode 100644 index 0000000000000..4838b058cfd1f --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AvailableBalancesImpl.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.AvailableBalances; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.AvailableBalance; + +class AvailableBalancesImpl extends WrapperImpl implements AvailableBalances { + private final BillingManager manager; + + AvailableBalancesImpl(BillingManager manager) { + super(manager.inner().availableBalances()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName) { + AvailableBalancesInner client = this.inner(); + return client.getByBillingProfileAsync(billingAccountName, billingProfileName) + .map(new Func1() { + @Override + public AvailableBalance call(AvailableBalanceInner inner) { + return new AvailableBalanceImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AvailableBalancesInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AvailableBalancesInner.java new file mode 100644 index 0000000000000..e4814f08da07e --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/AvailableBalancesInner.java @@ -0,0 +1,143 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in AvailableBalances. + */ +public class AvailableBalancesInner { + /** The Retrofit service to perform REST calls. */ + private AvailableBalancesService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of AvailableBalancesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AvailableBalancesInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(AvailableBalancesService.class); + this.client = client; + } + + /** + * The interface defining all the services for AvailableBalances to be + * used by Retrofit to perform actually REST calls. + */ + interface AvailableBalancesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.AvailableBalances getByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/availableBalance/default") + Observable> getByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * The latest available credit balance for a given billingAccountName and billingProfileName. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the AvailableBalanceInner object if successful. + */ + public AvailableBalanceInner getByBillingProfile(String billingAccountName, String billingProfileName) { + return getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * The latest available credit balance for a given billingAccountName and billingProfileName. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByBillingProfileAsync(String billingAccountName, String billingProfileName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName), serviceCallback); + } + + /** + * The latest available credit balance for a given billingAccountName and billingProfileName. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AvailableBalanceInner object + */ + public Observable getByBillingProfileAsync(String billingAccountName, String billingProfileName) { + return getByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, AvailableBalanceInner>() { + @Override + public AvailableBalanceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The latest available credit balance for a given billingAccountName and billingProfileName. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AvailableBalanceInner object + */ + public Observable> getByBillingProfileWithServiceResponseAsync(String billingAccountName, String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByBillingProfile(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountImpl.java new file mode 100644 index 0000000000000..06beac49784d0 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountImpl.java @@ -0,0 +1,214 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingAccount; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingAccountUpdateProperties; +import java.util.List; +import java.util.ArrayList; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfile; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Department; +import com.microsoft.azure.management.billing.v2018_11_01_preview.EnrollmentAccount; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Enrollment; +import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSection; +import rx.functions.Func1; + +class BillingAccountImpl extends CreatableUpdatableImpl implements BillingAccount, BillingAccount.Update { + private String billingAccountName; + private BillingAccountUpdateProperties 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 BillingAccountUpdateProperties(); + } + + 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 BillingAccountUpdateProperties(); + } + + @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 BillingAccountUpdateProperties(); + } + + @Override + public String accountType() { + return this.inner().accountType(); + } + + @Override + public AddressInner address() { + return this.inner().address(); + } + + @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 String company() { + return this.inner().company(); + } + + @Override + public String country() { + return this.inner().country(); + } + + @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 Boolean hasReadAccess() { + return this.inner().hasReadAccess(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @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 type() { + return this.inner().type(); + } + + @Override + public BillingAccountImpl withAddress(AddressInner 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; + } + + @Override + public BillingAccountImpl withInvoiceSections(List invoiceSections) { + this.updateParameter.withInvoiceSections(invoiceSections); + return this; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountInner.java new file mode 100644 index 0000000000000..a7d21aa69c72b --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountInner.java @@ -0,0 +1,246 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Enrollment; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A billing account resource. + */ +@JsonFlatten +public class BillingAccountInner extends ProxyResource { + /** + * The billing account name. + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * The billing account Type. Possible values include: 'Organization', + * 'Enrollment'. + */ + @JsonProperty(value = "properties.accountType", access = JsonProperty.Access.WRITE_ONLY) + private String accountType; + + /** + * The address associated with billing account. + */ + @JsonProperty(value = "properties.address") + private AddressInner address; + + /** + * Company Name. + */ + @JsonProperty(value = "properties.company", access = JsonProperty.Access.WRITE_ONLY) + private String company; + + /** + * Country Name. + */ + @JsonProperty(value = "properties.country", access = JsonProperty.Access.WRITE_ONLY) + private String country; + + /** + * The invoice sections associated to the billing account. By default this + * is not populated, unless it's specified in $expand. + */ + @JsonProperty(value = "properties.invoiceSections") + private List invoiceSections; + + /** + * The billing profiles associated to 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; + + /** + * Specifies whether the user has read access on billing account. + */ + @JsonProperty(value = "properties.hasReadAccess", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasReadAccess; + + /** + * Get the billing account name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the billing account Type. Possible values include: 'Organization', 'Enrollment'. + * + * @return the accountType value + */ + public String accountType() { + return this.accountType; + } + + /** + * Get the address associated with billing account. + * + * @return the address value + */ + public AddressInner address() { + return this.address; + } + + /** + * Set the address associated with billing account. + * + * @param address the address value to set + * @return the BillingAccountInner object itself. + */ + public BillingAccountInner withAddress(AddressInner address) { + this.address = address; + return this; + } + + /** + * Get company Name. + * + * @return the company value + */ + public String company() { + return this.company; + } + + /** + * Get country Name. + * + * @return the country value + */ + public String country() { + return this.country; + } + + /** + * Get the invoice sections associated to the billing account. By default this is not populated, unless it's specified in $expand. + * + * @return the invoiceSections value + */ + public List invoiceSections() { + return this.invoiceSections; + } + + /** + * Set the invoice sections associated to the billing account. By default this is not populated, unless it's specified in $expand. + * + * @param invoiceSections the invoiceSections value to set + * @return the BillingAccountInner object itself. + */ + public BillingAccountInner withInvoiceSections(List invoiceSections) { + this.invoiceSections = invoiceSections; + return this; + } + + /** + * Get the billing profiles associated to 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 to 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 specifies whether the user has read access on billing account. + * + * @return the hasReadAccess value + */ + public Boolean hasReadAccess() { + return this.hasReadAccess; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountsImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountsImpl.java new file mode 100644 index 0000000000000..223f569189cd8 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountsImpl.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * jkl + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingAccounts; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingAccount; + +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 listAsync() { + BillingAccountsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingAccount call(BillingAccountInner inner) { + return new BillingAccountImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountsInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountsInner.java new file mode 100644 index 0000000000000..7a74b36bbe21b --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingAccountsInner.java @@ -0,0 +1,706 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingAccountUpdateProperties; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * 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.v2018_11_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.v2018_11_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.v2018_11_01_preview.BillingAccounts update" }) + @PATCH("providers/Microsoft.Billing/billingAccounts/{billingAccountName}") + Observable> update(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Body BillingAccountUpdateProperties parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingAccounts beginUpdate" }) + @PATCH("providers/Microsoft.Billing/billingAccounts/{billingAccountName}") + Observable> beginUpdate(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Body BillingAccountUpdateProperties parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingAccounts listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all billing accounts for which a user has access. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<BillingAccountInner> 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 all billing accounts for which a user has access. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all billing accounts for which a user has access. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingAccountInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all billing accounts for which a user has access. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingAccountInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all billing accounts for which a user has access. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingAccountInner> 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."); + } + 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> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all billing accounts for which a user has access. + * + * @param expand May be used to expand the invoiceSections and billingProfiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<BillingAccountInner> object if successful. + */ + public PagedList list(final String expand) { + ServiceResponse> response = listSinglePageAsync(expand).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all billing accounts for which a user has access. + * + * @param expand May be used to expand the invoiceSections and billingProfiles. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String expand, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(expand), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all billing accounts for which a user has access. + * + * @param expand May be used to expand the invoiceSections and billingProfiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingAccountInner> object + */ + public Observable> listAsync(final String expand) { + return listWithServiceResponseAsync(expand) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all billing accounts for which a user has access. + * + * @param expand May be used to expand the invoiceSections and billingProfiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingAccountInner> object + */ + public Observable>> listWithServiceResponseAsync(final String expand) { + return listSinglePageAsync(expand) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all billing accounts for which a user has access. + * + ServiceResponse> * @param expand May be used to expand the invoiceSections and billingProfiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingAccountInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String expand) { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @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); + } + + /** + * Get the billing account by id. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingAccountInner object if successful. + */ + public BillingAccountInner get(String billingAccountName) { + return getWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + } + + /** + * Get the billing account by id. + * + * @param billingAccountName Billing Account Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName), serviceCallback); + } + + /** + * Get the billing account by id. + * + * @param billingAccountName Billing Account Id. + * @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(); + } + }); + } + + /** + * Get the billing account by id. + * + * @param billingAccountName Billing Account Id. + * @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); + } + } + }); + } + + /** + * Get the billing account by id. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the invoiceSections and billingProfiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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(); + } + + /** + * Get the billing account by id. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the invoiceSections and billingProfiles. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, expand), serviceCallback); + } + + /** + * Get the billing account by id. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the invoiceSections and billingProfiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingAccountInner object + */ + public Observable getAsync(String billingAccountName, String expand) { + return getWithServiceResponseAsync(billingAccountName, expand).map(new Func1, BillingAccountInner>() { + @Override + public BillingAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the billing account by id. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the invoiceSections and billingProfiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingAccountInner object + */ + 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); + } + + /** + * The operation to update a billing account. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the update billing account operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @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, BillingAccountUpdateProperties parameters) { + return updateWithServiceResponseAsync(billingAccountName, parameters).toBlocking().last().body(); + } + + /** + * The operation to update a billing account. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the update billing account operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String billingAccountName, BillingAccountUpdateProperties parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(billingAccountName, parameters), serviceCallback); + } + + /** + * The operation to update a billing account. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the update billing account operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String billingAccountName, BillingAccountUpdateProperties parameters) { + return updateWithServiceResponseAsync(billingAccountName, parameters).map(new Func1, BillingAccountInner>() { + @Override + public BillingAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to update a billing account. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the update billing account operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String billingAccountName, BillingAccountUpdateProperties 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()); + } + + /** + * The operation to update a billing account. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the update billing account operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @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, BillingAccountUpdateProperties parameters) { + return beginUpdateWithServiceResponseAsync(billingAccountName, parameters).toBlocking().single().body(); + } + + /** + * The operation to update a billing account. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the update billing account operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateAsync(String billingAccountName, BillingAccountUpdateProperties parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(billingAccountName, parameters), serviceCallback); + } + + /** + * The operation to update a billing account. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the update billing account operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingAccountInner object + */ + public Observable beginUpdateAsync(String billingAccountName, BillingAccountUpdateProperties parameters) { + return beginUpdateWithServiceResponseAsync(billingAccountName, parameters).map(new Func1, BillingAccountInner>() { + @Override + public BillingAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to update a billing account. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the update billing account operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingAccountInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String billingAccountName, BillingAccountUpdateProperties 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 all billing accounts for which a user has access. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<BillingAccountInner> 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 all billing accounts for which a user has access. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all billing accounts for which a user has access. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingAccountInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all billing accounts for which a user has access. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingAccountInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all billing accounts for which a user has access. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingAccountInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManagementClientImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManagementClientImpl.java new file mode 100644 index 0000000000000..d029ba55ff85a --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManagementClientImpl.java @@ -0,0 +1,520 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.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; + } + + /** Version of the API to be used with the client request. The current version is 2018-11-01-preview. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. The current version is 2018-11-01-preview. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Azure Subscription Id. */ + private String subscriptionId; + + /** + * Gets Azure Subscription Id. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Azure Subscription Id. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public BillingManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public BillingManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public BillingManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public BillingManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The 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 AddressesInner object to access its operations. + */ + private AddressesInner addresses; + + /** + * Gets the AddressesInner object to access its operations. + * @return the AddressesInner object. + */ + public AddressesInner addresses() { + return this.addresses; + } + + /** + * 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 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 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 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 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 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 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 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; + } + + /** + * The LineOfCreditsInner object to access its operations. + */ + private LineOfCreditsInner lineOfCredits; + + /** + * Gets the LineOfCreditsInner object to access its operations. + * @return the LineOfCreditsInner object. + */ + public LineOfCreditsInner lineOfCredits() { + return this.lineOfCredits; + } + + /** + * Initializes an instance of BillingManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public BillingManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of BillingManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public BillingManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of BillingManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public BillingManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2018-11-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.addresses = new AddressesInner(restClient().retrofit(), this); + this.availableBalances = new AvailableBalancesInner(restClient().retrofit(), this); + this.billingProfiles = new BillingProfilesInner(restClient().retrofit(), this); + this.customers = new CustomersInner(restClient().retrofit(), this); + this.invoiceSections = new InvoiceSectionsInner(restClient().retrofit(), this); + this.departments = new DepartmentsInner(restClient().retrofit(), this); + this.enrollmentAccounts = new EnrollmentAccountsInner(restClient().retrofit(), this); + this.invoices = new InvoicesInner(restClient().retrofit(), this); + this.priceSheets = new PriceSheetsInner(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.policies = new PoliciesInner(restClient().retrofit(), this); + this.billingPropertys = new BillingPropertysInner(restClient().retrofit(), this); + this.transfers = new TransfersInner(restClient().retrofit(), this); + this.recipientTransfers = new RecipientTransfersInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.billingPermissions = new BillingPermissionsInner(restClient().retrofit(), this); + this.billingRoleDefinitions = new BillingRoleDefinitionsInner(restClient().retrofit(), this); + this.billingRoleAssignments = new BillingRoleAssignmentsInner(restClient().retrofit(), this); + this.agreements = new AgreementsInner(restClient().retrofit(), this); + this.lineOfCredits = new LineOfCreditsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "BillingManagementClient", "2018-11-01-preview"); + } +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManager.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManager.java new file mode 100644 index 0000000000000..8040b1c8ede7c --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingManager.java @@ -0,0 +1,375 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingAccounts; +import com.microsoft.azure.management.billing.v2018_11_01_preview.PaymentMethods; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Addresses; +import com.microsoft.azure.management.billing.v2018_11_01_preview.AvailableBalances; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfiles; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Customers; +import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSections; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Departments; +import com.microsoft.azure.management.billing.v2018_11_01_preview.EnrollmentAccounts; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Invoices; +import com.microsoft.azure.management.billing.v2018_11_01_preview.PriceSheets; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptions; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Products; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Transactions; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Policies; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPropertys; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Transfers; +import com.microsoft.azure.management.billing.v2018_11_01_preview.RecipientTransfers; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Operations; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPermissions; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleDefinitions; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleAssignments; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Agreements; +import com.microsoft.azure.management.billing.v2018_11_01_preview.LineOfCredits; +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 Addresses addresses; + private AvailableBalances availableBalances; + private BillingProfiles billingProfiles; + private Customers customers; + private InvoiceSections invoiceSections; + private Departments departments; + private EnrollmentAccounts enrollmentAccounts; + private Invoices invoices; + private PriceSheets priceSheets; + private BillingSubscriptions billingSubscriptions; + private Products products; + private Transactions transactions; + private Policies policies; + private BillingPropertys billingPropertys; + private Transfers transfers; + private RecipientTransfers recipientTransfers; + private Operations operations; + private BillingPermissions billingPermissions; + private BillingRoleDefinitions billingRoleDefinitions; + private BillingRoleAssignments billingRoleAssignments; + private Agreements agreements; + private LineOfCredits lineOfCredits; + /** + * 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 Addresses. + */ + public Addresses addresses() { + if (this.addresses == null) { + this.addresses = new AddressesImpl(this); + } + return this.addresses; + } + + /** + * @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 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 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 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 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 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 BillingPermissions. + */ + public BillingPermissions billingPermissions() { + if (this.billingPermissions == null) { + this.billingPermissions = new BillingPermissionsImpl(this); + } + return this.billingPermissions; + } + + /** + * @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; + } + + /** + * @return Entry point to manage LineOfCredits. + */ + public LineOfCredits lineOfCredits() { + if (this.lineOfCredits == null) { + this.lineOfCredits = new LineOfCreditsImpl(this); + } + return this.lineOfCredits; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public BillingManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return BillingManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private BillingManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new BillingManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsImpl.java new file mode 100644 index 0000000000000..aa21b0a81205e --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPermissions; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPermissionsListResult; + +class BillingPermissionsImpl extends WrapperImpl implements BillingPermissions { + private final BillingManager manager; + + BillingPermissionsImpl(BillingManager manager) { + super(manager.inner().billingPermissions()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable listByBillingAccountAsync(String billingAccountName) { + BillingPermissionsInner client = this.inner(); + return client.listByBillingAccountAsync(billingAccountName) + .map(new Func1() { + @Override + public BillingPermissionsListResult call(BillingPermissionsListResultInner inner) { + return new BillingPermissionsListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByCustomersAsync(String billingAccountName, String customerName) { + BillingPermissionsInner client = this.inner(); + return client.listByCustomersAsync(billingAccountName, customerName) + .map(new Func1() { + @Override + public BillingPermissionsListResult call(BillingPermissionsListResultInner inner) { + return new BillingPermissionsListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByInvoiceSectionsAsync(String billingAccountName, String invoiceSectionName) { + BillingPermissionsInner client = this.inner(); + return client.listByInvoiceSectionsAsync(billingAccountName, invoiceSectionName) + .map(new Func1() { + @Override + public BillingPermissionsListResult call(BillingPermissionsListResultInner inner) { + return new BillingPermissionsListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName) { + BillingPermissionsInner client = this.inner(); + return client.listByBillingProfileAsync(billingAccountName, billingProfileName) + .map(new Func1() { + @Override + public BillingPermissionsListResult call(BillingPermissionsListResultInner inner) { + return new BillingPermissionsListResultImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsInner.java new file mode 100644 index 0000000000000..d18f92a3639a8 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsInner.java @@ -0,0 +1,397 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BillingPermissions. + */ +public class BillingPermissionsInner { + /** The Retrofit service to perform REST calls. */ + private BillingPermissionsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingPermissionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BillingPermissionsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(BillingPermissionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for BillingPermissions to be + * used by Retrofit to perform actually REST calls. + */ + interface BillingPermissionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPermissions listByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingPermissions") + Observable> listByBillingAccount(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPermissions listByCustomers" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/providers/Microsoft.Billing/billingPermissions") + Observable> listByCustomers(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPermissions listByInvoiceSections" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingPermissions") + Observable> listByInvoiceSections(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPermissions listByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingPermissions") + Observable> listByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all billing permissions for the caller under a billing account. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingPermissionsListResultInner object if successful. + */ + public BillingPermissionsListResultInner listByBillingAccount(String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + } + + /** + * Lists all billing permissions for the caller under a billing account. + * + * @param billingAccountName Billing Account Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByBillingAccountAsync(String billingAccountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountWithServiceResponseAsync(billingAccountName), serviceCallback); + } + + /** + * Lists all billing permissions for the caller under a billing account. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPermissionsListResultInner object + */ + public Observable listByBillingAccountAsync(String billingAccountName) { + return listByBillingAccountWithServiceResponseAsync(billingAccountName).map(new Func1, BillingPermissionsListResultInner>() { + @Override + public BillingPermissionsListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all billing permissions for the caller under a billing account. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPermissionsListResultInner object + */ + public Observable> listByBillingAccountWithServiceResponseAsync(String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingAccount(billingAccountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all billing permissions for the caller under customer. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingPermissionsListResultInner object if successful. + */ + public BillingPermissionsListResultInner listByCustomers(String billingAccountName, String customerName) { + return listByCustomersWithServiceResponseAsync(billingAccountName, customerName).toBlocking().single().body(); + } + + /** + * Lists all billing permissions for the caller under customer. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByCustomersAsync(String billingAccountName, String customerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByCustomersWithServiceResponseAsync(billingAccountName, customerName), serviceCallback); + } + + /** + * Lists all billing permissions for the caller under customer. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPermissionsListResultInner object + */ + public Observable listByCustomersAsync(String billingAccountName, String customerName) { + return listByCustomersWithServiceResponseAsync(billingAccountName, customerName).map(new Func1, BillingPermissionsListResultInner>() { + @Override + public BillingPermissionsListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all billing permissions for the caller under customer. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPermissionsListResultInner object + */ + public Observable> listByCustomersWithServiceResponseAsync(String billingAccountName, String customerName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByCustomers(billingAccountName, customerName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByCustomersDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByCustomersDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all billing permissions for the caller under invoice section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingPermissionsListResultInner object if successful. + */ + public BillingPermissionsListResultInner listByInvoiceSections(String billingAccountName, String invoiceSectionName) { + return listByInvoiceSectionsWithServiceResponseAsync(billingAccountName, invoiceSectionName).toBlocking().single().body(); + } + + /** + * Lists all billing permissions for the caller under invoice section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByInvoiceSectionsAsync(String billingAccountName, String invoiceSectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByInvoiceSectionsWithServiceResponseAsync(billingAccountName, invoiceSectionName), serviceCallback); + } + + /** + * Lists all billing permissions for the caller under invoice section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPermissionsListResultInner object + */ + public Observable listByInvoiceSectionsAsync(String billingAccountName, String invoiceSectionName) { + return listByInvoiceSectionsWithServiceResponseAsync(billingAccountName, invoiceSectionName).map(new Func1, BillingPermissionsListResultInner>() { + @Override + public BillingPermissionsListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all billing permissions for the caller under invoice section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPermissionsListResultInner object + */ + public Observable> listByInvoiceSectionsWithServiceResponseAsync(String billingAccountName, String invoiceSectionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByInvoiceSections(billingAccountName, invoiceSectionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByInvoiceSectionsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByInvoiceSectionsDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all billingPermissions for the caller has for a billing account. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingPermissionsListResultInner object if successful. + */ + public BillingPermissionsListResultInner listByBillingProfile(String billingAccountName, String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * Lists all billingPermissions for the caller has for a billing account. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByBillingProfileAsync(String billingAccountName, String billingProfileName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName), serviceCallback); + } + + /** + * Lists all billingPermissions for the caller has for a billing account. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPermissionsListResultInner object + */ + public Observable listByBillingProfileAsync(String billingAccountName, String billingProfileName) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, BillingPermissionsListResultInner>() { + @Override + public BillingPermissionsListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all billingPermissions for the caller has for a billing account. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingPermissionsListResultInner object + */ + public Observable> listByBillingProfileWithServiceResponseAsync(String billingAccountName, String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingProfile(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingProfileDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingProfileDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsListResultImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsListResultImpl.java new file mode 100644 index 0000000000000..89047f4753f7a --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPermissionsListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_01_preview.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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsListResultInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPermissionsListResultInner.java new file mode 100644 index 0000000000000..48a64cbdf9d6b --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfileImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfileImpl.java new file mode 100644 index 0000000000000..4f23efbcfb5fd --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfileImpl.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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfile; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_01_preview.EnabledAzureSKUs; +import java.util.ArrayList; +import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSection; + +class BillingProfileImpl extends CreatableUpdatableImpl implements BillingProfile, BillingProfile.Update { + private final BillingManager manager; + private String billingAccountName; + private String billingProfileName; + + BillingProfileImpl(String name, BillingManager manager) { + super(name, new BillingProfileInner()); + this.manager = manager; + // Set resource name + this.billingProfileName = name; + // + } + + 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"); + // + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + BillingProfilesInner client = this.manager().inner().billingProfiles(); + return null; // NOP createResourceAsync implementation as create is not supported + } + + @Override + public Observable updateResourceAsync() { + BillingProfilesInner client = this.manager().inner().billingProfiles(); + return client.updateAsync(this.billingAccountName, this.billingProfileName, this.inner()) + .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; + } + + + @Override + public AddressInner address() { + return this.inner().address(); + } + + @Override + public String currency() { + return this.inner().currency(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public List enabledAzureSKUs() { + return this.inner().enabledAzureSKUs(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public 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 Boolean isClassic() { + return this.inner().isClassic(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String poNumber() { + return this.inner().poNumber(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public BillingProfileImpl withAddress(AddressInner address) { + this.inner().withAddress(address); + return this; + } + + @Override + public BillingProfileImpl withDisplayName(String displayName) { + this.inner().withDisplayName(displayName); + return this; + } + + @Override + public BillingProfileImpl withEnabledAzureSKUs(List enabledAzureSKUs) { + this.inner().withEnabledAzureSKUs(enabledAzureSKUs); + return this; + } + + @Override + public BillingProfileImpl withInvoiceSections(List invoiceSections) { + this.inner().withInvoiceSections(invoiceSections); + return this; + } + + @Override + public BillingProfileImpl withPoNumber(String poNumber) { + this.inner().withPoNumber(poNumber); + return this; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfileInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfileInner.java new file mode 100644 index 0000000000000..11a32cd7821f7 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfileInner.java @@ -0,0 +1,212 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_01_preview.EnabledAzureSKUs; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A billing profile resource. + */ +@JsonFlatten +public class BillingProfileInner extends ProxyResource { + /** + * The billing profile name. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * Purchase order number. + */ + @JsonProperty(value = "properties.poNumber") + private String poNumber; + + /** + * Billing address. + */ + @JsonProperty(value = "properties.address") + private AddressInner address; + + /** + * If the billing profile is opted in to receive invoices via email. + */ + @JsonProperty(value = "properties.invoiceEmailOptIn", access = JsonProperty.Access.WRITE_ONLY) + private Boolean invoiceEmailOptIn; + + /** + * Is OMS bootstrapped billing profile. + */ + @JsonProperty(value = "properties.isClassic", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isClassic; + + /** + * Invoice day. + */ + @JsonProperty(value = "properties.invoiceDay", access = JsonProperty.Access.WRITE_ONLY) + private Integer invoiceDay; + + /** + * The currency associated with the billing profile. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * Information about the product. + */ + @JsonProperty(value = "properties.enabledAzureSKUs") + private List enabledAzureSKUs; + + /** + * The invoice sections associated to the billing profile. + */ + @JsonProperty(value = "properties.invoiceSections") + private List invoiceSections; + + /** + * Get the billing profile name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the billing profile name. + * + * @param displayName the displayName value to set + * @return the BillingProfileInner object itself. + */ + public BillingProfileInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get purchase order number. + * + * @return the poNumber value + */ + public String poNumber() { + return this.poNumber; + } + + /** + * Set purchase order number. + * + * @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 AddressInner address() { + return this.address; + } + + /** + * Set billing address. + * + * @param address the address value to set + * @return the BillingProfileInner object itself. + */ + public BillingProfileInner withAddress(AddressInner address) { + this.address = address; + return this; + } + + /** + * Get if the billing profile is opted in to receive invoices via email. + * + * @return the invoiceEmailOptIn value + */ + public Boolean invoiceEmailOptIn() { + return this.invoiceEmailOptIn; + } + + /** + * Get is OMS bootstrapped billing profile. + * + * @return the isClassic value + */ + public Boolean isClassic() { + return this.isClassic; + } + + /** + * Get invoice day. + * + * @return the invoiceDay value + */ + public Integer invoiceDay() { + return this.invoiceDay; + } + + /** + * Get the currency associated with the billing profile. + * + * @return the currency value + */ + public String currency() { + return this.currency; + } + + /** + * Get information about the product. + * + * @return the enabledAzureSKUs value + */ + public List enabledAzureSKUs() { + return this.enabledAzureSKUs; + } + + /** + * Set information about the product. + * + * @param enabledAzureSKUs the enabledAzureSKUs value to set + * @return the BillingProfileInner object itself. + */ + public BillingProfileInner withEnabledAzureSKUs(List enabledAzureSKUs) { + this.enabledAzureSKUs = enabledAzureSKUs; + 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; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfilesImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfilesImpl.java new file mode 100644 index 0000000000000..0a03123e0f37c --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfilesImpl.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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfiles; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfile; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfileCreationParameters; + +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; + } + + private BillingProfileImpl wrapModel(BillingProfileInner inner) { + return new BillingProfileImpl(inner, manager()); + } + + @Override + public Observable listByBillingAccountNameAsync(final String billingAccountName) { + BillingProfilesInner client = this.inner(); + return client.listByBillingAccountNameAsync(billingAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingProfile call(BillingProfileInner inner) { + return wrapModel(inner); + } + }); + } + + @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)); + } + } + }); + } + + @Override + public Observable createAsync(String billingAccountName, BillingProfileCreationParameters parameters) { + BillingProfilesInner client = this.inner(); + return client.createAsync(billingAccountName, parameters) + .map(new Func1() { + @Override + public BillingProfile call(BillingProfileInner inner) { + return new BillingProfileImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfilesInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfilesInner.java new file mode 100644 index 0000000000000..6ba69b3a0118e --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingProfilesInner.java @@ -0,0 +1,914 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfileCreationParameters; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfilesCreateHeaders; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfilesUpdateHeaders; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * 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.v2018_11_01_preview.BillingProfiles listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfiles create" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles") + Observable> create(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Body BillingProfileCreationParameters parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfiles beginCreate" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles") + Observable> beginCreate(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Body BillingProfileCreationParameters parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfiles 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.v2018_11_01_preview.BillingProfiles update" }) + @PUT("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.v2018_11_01_preview.BillingProfiles beginUpdate" }) + @PUT("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}") + Observable> beginUpdate(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Body BillingProfileInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfiles listByBillingAccountNameNext" }) + @GET + Observable> listByBillingAccountNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all billing profiles for a user which that user has access to. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<BillingProfileInner> object if successful. + */ + public PagedList listByBillingAccountName(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all billing profiles for a user which that user has access to. + * + * @param billingAccountName Billing Account Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all billing profiles for a user which that user has access to. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingProfileInner> object + */ + public Observable> listByBillingAccountNameAsync(final String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all billing profiles for a user which that user has access to. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingProfileInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountNameSinglePageAsync(billingAccountName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all billing profiles for a user which that user has access to. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingProfileInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all billing profiles for a user which that user has access to. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the invoiceSections. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<BillingProfileInner> object if successful. + */ + public PagedList listByBillingAccountName(final String billingAccountName, final String expand) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName, expand).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all billing profiles for a user which that user has access to. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the invoiceSections. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final String expand, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName, expand), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all billing profiles for a user which that user has access to. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the invoiceSections. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingProfileInner> object + */ + public Observable> listByBillingAccountNameAsync(final String billingAccountName, final String expand) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all billing profiles for a user which that user has access to. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the invoiceSections. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingProfileInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName, final String expand) { + return listByBillingAccountNameSinglePageAsync(billingAccountName, expand) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all billing profiles for a user which that user has access to. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param expand May be used to expand the invoiceSections. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingProfileInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName, final String expand) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The operation to create a BillingProfile. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the Create BillingProfile operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @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, BillingProfileCreationParameters parameters) { + return createWithServiceResponseAsync(billingAccountName, parameters).toBlocking().last().body(); + } + + /** + * The operation to create a BillingProfile. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the Create BillingProfile operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String billingAccountName, BillingProfileCreationParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createWithServiceResponseAsync(billingAccountName, parameters), serviceCallback); + } + + /** + * The operation to create a BillingProfile. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the Create BillingProfile operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String billingAccountName, BillingProfileCreationParameters parameters) { + return createWithServiceResponseAsync(billingAccountName, parameters).map(new Func1, BillingProfileInner>() { + @Override + public BillingProfileInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * The operation to create a BillingProfile. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the Create BillingProfile operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String billingAccountName, BillingProfileCreationParameters 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.create(billingAccountName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new TypeToken() { }.getType(), BillingProfilesCreateHeaders.class); + } + + /** + * The operation to create a BillingProfile. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the Create BillingProfile operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @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, BillingProfileCreationParameters parameters) { + return beginCreateWithServiceResponseAsync(billingAccountName, parameters).toBlocking().single().body(); + } + + /** + * The operation to create a BillingProfile. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the Create BillingProfile operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateAsync(String billingAccountName, BillingProfileCreationParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginCreateWithServiceResponseAsync(billingAccountName, parameters), serviceCallback); + } + + /** + * The operation to create a BillingProfile. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the Create BillingProfile operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingProfileInner object + */ + public Observable beginCreateAsync(String billingAccountName, BillingProfileCreationParameters parameters) { + return beginCreateWithServiceResponseAsync(billingAccountName, parameters).map(new Func1, BillingProfileInner>() { + @Override + public BillingProfileInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * The operation to create a BillingProfile. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the Create BillingProfile operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingProfileInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String billingAccountName, BillingProfileCreationParameters 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.beginCreate(billingAccountName, 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); + } + + /** + * Get the billing profile by id. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingProfileInner object if successful. + */ + public BillingProfileInner get(String billingAccountName, String billingProfileName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * Get the billing profile by id. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String billingProfileName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, billingProfileName), serviceCallback); + } + + /** + * Get the billing profile by id. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingProfileInner object + */ + public Observable getAsync(String billingAccountName, String billingProfileName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, BillingProfileInner>() { + @Override + public BillingProfileInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the billing profile by id. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingProfileInner object + */ + 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); + } + } + }); + } + + /** + * Get the billing profile by id. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param expand May be used to expand the invoiceSections. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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(); + } + + /** + * Get the billing profile by id. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param expand May be used to expand the invoiceSections. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String billingProfileName, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, billingProfileName, expand), serviceCallback); + } + + /** + * Get the billing profile by id. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param expand May be used to expand the invoiceSections. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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(); + } + }); + } + + /** + * Get the billing profile by id. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param expand May be used to expand the invoiceSections. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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); + } + + /** + * The operation to update a billing profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param parameters Parameters supplied to the update billing profile operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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(); + } + + /** + * The operation to update a billing profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param parameters Parameters supplied to the update billing profile operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @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); + } + + /** + * The operation to update a billing profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param parameters Parameters supplied to the update billing profile operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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(); + } + }); + } + + /** + * The operation to update a billing profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param parameters Parameters supplied to the update billing profile operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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); + } + + /** + * The operation to update a billing profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param parameters Parameters supplied to the update billing profile operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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(); + } + + /** + * The operation to update a billing profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param parameters Parameters supplied to the update billing profile operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @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); + } + + /** + * The operation to update a billing profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param parameters Parameters supplied to the update billing profile operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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(); + } + }); + } + + /** + * The operation to update a billing profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param parameters Parameters supplied to the update billing profile operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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); + } + + /** + * Lists all billing profiles for a user which that user has access to. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<BillingProfileInner> object if successful. + */ + public PagedList listByBillingAccountNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all billing profiles for a user which that user has access to. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all billing profiles for a user which that user has access to. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingProfileInner> object + */ + public Observable> listByBillingAccountNameNextAsync(final String nextPageLink) { + return listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all billing profiles for a user which that user has access to. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingProfileInner> object + */ + public Observable>> listByBillingAccountNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all billing profiles for a user which that user has access to. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingProfileInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingAccountNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPropertyImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPropertyImpl.java new file mode 100644 index 0000000000000..e87fda6fcb518 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPropertyImpl.java @@ -0,0 +1,101 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProperty; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +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 billingAccountId() { + return this.inner().billingAccountId(); + } + + @Override + public String billingAccountName() { + return this.inner().billingAccountName(); + } + + @Override + public String billingProfileId() { + return this.inner().billingProfileId(); + } + + @Override + public String billingProfileName() { + return this.inner().billingProfileName(); + } + + @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 invoiceSectionId() { + return this.inner().invoiceSectionId(); + } + + @Override + public String invoiceSectionName() { + return this.inner().invoiceSectionName(); + } + + @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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPropertyInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPropertyInner.java new file mode 100644 index 0000000000000..8da748d274c88 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPropertyInner.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.v2018_11_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A billing property resource. + */ +@JsonFlatten +public class BillingPropertyInner extends ProxyResource { + /** + * Billing tenant Id. + */ + @JsonProperty(value = "properties.billingTenantId", access = JsonProperty.Access.WRITE_ONLY) + private String billingTenantId; + + /** + * Billing account Id. + */ + @JsonProperty(value = "properties.billingAccountId", access = JsonProperty.Access.WRITE_ONLY) + private String billingAccountId; + + /** + * Billing account name. + */ + @JsonProperty(value = "properties.billingAccountName", access = JsonProperty.Access.WRITE_ONLY) + private String billingAccountName; + + /** + * Billing profile Id. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /** + * Billing profile name. + */ + @JsonProperty(value = "properties.billingProfileName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileName; + + /** + * Cost center name. + */ + @JsonProperty(value = "properties.costCenter", access = JsonProperty.Access.WRITE_ONLY) + private String costCenter; + + /** + * Invoice Section Id. + */ + @JsonProperty(value = "properties.invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /** + * Invoice Section name. + */ + @JsonProperty(value = "properties.invoiceSectionName", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionName; + + /** + * Product Id. + */ + @JsonProperty(value = "properties.productId", access = JsonProperty.Access.WRITE_ONLY) + private String productId; + + /** + * Product name. + */ + @JsonProperty(value = "properties.productName", access = JsonProperty.Access.WRITE_ONLY) + private String productName; + + /** + * SKU Id. + */ + @JsonProperty(value = "properties.skuId", access = JsonProperty.Access.WRITE_ONLY) + private String skuId; + + /** + * SKU description. + */ + @JsonProperty(value = "properties.skuDescription", access = JsonProperty.Access.WRITE_ONLY) + private String skuDescription; + + /** + * Get billing tenant Id. + * + * @return the billingTenantId value + */ + public String billingTenantId() { + return this.billingTenantId; + } + + /** + * Get billing account Id. + * + * @return the billingAccountId value + */ + public String billingAccountId() { + return this.billingAccountId; + } + + /** + * Get billing account name. + * + * @return the billingAccountName value + */ + public String billingAccountName() { + return this.billingAccountName; + } + + /** + * Get billing profile Id. + * + * @return the billingProfileId value + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get billing profile name. + * + * @return the billingProfileName value + */ + public String billingProfileName() { + return this.billingProfileName; + } + + /** + * Get cost center name. + * + * @return the costCenter value + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Get invoice Section Id. + * + * @return the invoiceSectionId value + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get invoice Section name. + * + * @return the invoiceSectionName value + */ + public String invoiceSectionName() { + return this.invoiceSectionName; + } + + /** + * Get product Id. + * + * @return the productId value + */ + public String productId() { + return this.productId; + } + + /** + * Get product name. + * + * @return the productName value + */ + public String productName() { + return this.productName; + } + + /** + * Get sKU Id. + * + * @return the skuId value + */ + public String skuId() { + return this.skuId; + } + + /** + * Get sKU description. + * + * @return the skuDescription value + */ + public String skuDescription() { + return this.skuDescription; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPropertysImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPropertysImpl.java new file mode 100644 index 0000000000000..526b00a7d394e --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPropertys; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPropertysInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingPropertysInner.java new file mode 100644 index 0000000000000..dabac312cd4ff --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in 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.v2018_11_01_preview.BillingPropertys get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty") + Observable> get(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get billing property by subscription Id. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingPropertyInner object if successful. + */ + public BillingPropertyInner get() { + return getWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Get billing property by subscription Id. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(), serviceCallback); + } + + /** + * Get billing property by subscription Id. + * + * @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 billing property by subscription Id. + * + * @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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentImpl.java new file mode 100644 index 0000000000000..fc24daa43bdac --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentImpl.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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleAssignment; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class BillingRoleAssignmentImpl extends WrapperImpl implements BillingRoleAssignment { + private final BillingManager manager; + BillingRoleAssignmentImpl(BillingRoleAssignmentInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentInner.java new file mode 100644 index 0000000000000..85ed33b9c197b --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * a role assignment. + */ +@JsonFlatten +public class BillingRoleAssignmentInner extends ProxyResource { + /** + * the date the role assignment is created. + */ + @JsonProperty(value = "properties.createdOn", access = JsonProperty.Access.WRITE_ONLY) + private String createdOn; + + /** + * the creator's tenant Id. + */ + @JsonProperty(value = "properties.createdByPrincipalTenantId", access = JsonProperty.Access.WRITE_ONLY) + private String createdByPrincipalTenantId; + + /** + * the creator's principal Id. + */ + @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 user's principal id that the role gets assigned to. + */ + @JsonProperty(value = "properties.principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /** + * The role definition id. + */ + @JsonProperty(value = "properties.roleDefinitionName", access = JsonProperty.Access.WRITE_ONLY) + private String roleDefinitionName; + + /** + * The scope the role get assigned to. + */ + @JsonProperty(value = "properties.scope", access = JsonProperty.Access.WRITE_ONLY) + private String scope; + + /** + * Get the date the role assignment is created. + * + * @return the createdOn value + */ + public String createdOn() { + return this.createdOn; + } + + /** + * Get the creator's tenant Id. + * + * @return the createdByPrincipalTenantId value + */ + public String createdByPrincipalTenantId() { + return this.createdByPrincipalTenantId; + } + + /** + * Get the creator's principal Id. + * + * @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 user's principal id that the role gets assigned to. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the role definition id. + * + * @return the roleDefinitionName value + */ + public String roleDefinitionName() { + return this.roleDefinitionName; + } + + /** + * Get the scope the role get assigned to. + * + * @return the scope value + */ + public String scope() { + return this.scope; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentListResultImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentListResultImpl.java new file mode 100644 index 0000000000000..0d0094a8b29a3 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentListResultInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentListResultInner.java new file mode 100644 index 0000000000000..f927d56f19717 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of get list of role assignments. + */ +public class BillingRoleAssignmentListResultInner { + /** + * The list role assignments. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the list role assignments. + * + * @return the value value + */ + public List value() { + return this.value; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentsImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentsImpl.java new file mode 100644 index 0000000000000..b16190bd7c46d --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentsImpl.java @@ -0,0 +1,176 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleAssignments; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleAssignment; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleAssignmentListResult; +import com.microsoft.azure.management.billing.v2018_11_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; + } + + @Override + public Observable getByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.getByBillingAccountAsync(billingAccountName, billingRoleAssignmentName) + .map(new Func1() { + @Override + public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable deleteByBillingAccountNameAsync(String billingAccountName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.deleteByBillingAccountNameAsync(billingAccountName, billingRoleAssignmentName) + .map(new Func1() { + @Override + public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.getByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName) + .map(new Func1() { + @Override + public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable deleteByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.deleteByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName) + .map(new Func1() { + @Override + public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.getByBillingProfileNameAsync(billingAccountName, billingProfileName, billingRoleAssignmentName) + .map(new Func1() { + @Override + public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable deleteByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.deleteByBillingProfileNameAsync(billingAccountName, billingProfileName, billingRoleAssignmentName) + .map(new Func1() { + @Override + public BillingRoleAssignment call(BillingRoleAssignmentInner inner) { + return new BillingRoleAssignmentImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingAccountNameAsync(String billingAccountName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.listByBillingAccountNameAsync(billingAccountName) + .map(new Func1() { + @Override + public BillingRoleAssignmentListResult call(BillingRoleAssignmentListResultInner inner) { + return new BillingRoleAssignmentListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.listByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName) + .map(new Func1() { + @Override + public BillingRoleAssignmentListResult call(BillingRoleAssignmentListResultInner inner) { + return new BillingRoleAssignmentListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName) { + BillingRoleAssignmentsInner client = this.inner(); + return client.listByBillingProfileNameAsync(billingAccountName, billingProfileName) + .map(new Func1() { + @Override + public BillingRoleAssignmentListResult call(BillingRoleAssignmentListResultInner inner) { + return new BillingRoleAssignmentListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable addByBillingAccountNameAsync(String billingAccountName, BillingRoleAssignmentPayload parameters) { + BillingRoleAssignmentsInner client = this.inner(); + return client.addByBillingAccountNameAsync(billingAccountName, parameters) + .map(new Func1() { + @Override + public BillingRoleAssignmentListResult call(BillingRoleAssignmentListResultInner inner) { + return new BillingRoleAssignmentListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable addByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, BillingRoleAssignmentPayload parameters) { + BillingRoleAssignmentsInner client = this.inner(); + return client.addByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, parameters) + .map(new Func1() { + @Override + public BillingRoleAssignmentListResult call(BillingRoleAssignmentListResultInner inner) { + return new BillingRoleAssignmentListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable addByBillingProfileNameAsync(String billingAccountName, String billingProfileName, BillingRoleAssignmentPayload parameters) { + BillingRoleAssignmentsInner client = this.inner(); + return client.addByBillingProfileNameAsync(billingAccountName, billingProfileName, parameters) + .map(new Func1() { + @Override + public BillingRoleAssignmentListResult call(BillingRoleAssignmentListResultInner inner) { + return new BillingRoleAssignmentListResultImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentsInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentsInner.java new file mode 100644 index 0000000000000..315c194528345 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleAssignmentsInner.java @@ -0,0 +1,1143 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleAssignmentPayload; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import 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.v2018_11_01_preview.BillingRoleAssignments getByBillingAccount" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}") + Observable> getByBillingAccount(@Path("billingAccountName") String billingAccountName, @Path("billingRoleAssignmentName") String billingRoleAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleAssignments deleteByBillingAccountName" }) + @HTTP(path = "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}", method = "DELETE", hasBody = true) + Observable> deleteByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Path("billingRoleAssignmentName") String billingRoleAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleAssignments getByInvoiceSectionName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}") + Observable> getByInvoiceSectionName(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Path("billingRoleAssignmentName") String billingRoleAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleAssignments deleteByInvoiceSectionName" }) + @HTTP(path = "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}", method = "DELETE", hasBody = true) + Observable> deleteByInvoiceSectionName(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Path("billingRoleAssignmentName") String billingRoleAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleAssignments getByBillingProfileName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}") + Observable> getByBillingProfileName(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("billingRoleAssignmentName") String billingRoleAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleAssignments deleteByBillingProfileName" }) + @HTTP(path = "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}", method = "DELETE", hasBody = true) + Observable> deleteByBillingProfileName(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("billingRoleAssignmentName") String billingRoleAssignmentName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleAssignments listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleAssignments") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleAssignments addByBillingAccountName" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/createBillingRoleAssignment") + Observable> addByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @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.v2018_11_01_preview.BillingRoleAssignments listByInvoiceSectionName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleAssignments") + Observable> listByInvoiceSectionName(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleAssignments addByInvoiceSectionName" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/createBillingRoleAssignment") + Observable> addByInvoiceSectionName(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @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.v2018_11_01_preview.BillingRoleAssignments listByBillingProfileName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleAssignments") + Observable> listByBillingProfileName(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleAssignments addByBillingProfileName" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/createBillingRoleAssignment") + Observable> addByBillingProfileName(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Body BillingRoleAssignmentPayload parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get the role assignment for the caller. + * + * @param billingAccountName Billing Account Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingRoleAssignmentInner object if successful. + */ + public BillingRoleAssignmentInner getByBillingAccount(String billingAccountName, String billingRoleAssignmentName) { + return getByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * Get the role assignment for the caller. + * + * @param billingAccountName Billing Account Id. + * @param billingRoleAssignmentName role assignment id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName), serviceCallback); + } + + /** + * Get the role assignment for the caller. + * + * @param billingAccountName Billing Account Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable getByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName) { + return getByBillingAccountWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the role assignment for the caller. + * + * @param billingAccountName Billing Account Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable> getByBillingAccountWithServiceResponseAsync(String billingAccountName, String billingRoleAssignmentName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingRoleAssignmentName == null) { + throw new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByBillingAccount(billingAccountName, billingRoleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingAccountDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingAccountDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Delete the role assignment on this billing account. + * + * @param billingAccountName Billing Account Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingRoleAssignmentInner object if successful. + */ + public BillingRoleAssignmentInner deleteByBillingAccountName(String billingAccountName, String billingRoleAssignmentName) { + return deleteByBillingAccountNameWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * Delete the role assignment on this billing account. + * + * @param billingAccountName Billing Account Id. + * @param billingRoleAssignmentName role assignment id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteByBillingAccountNameAsync(String billingAccountName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteByBillingAccountNameWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName), serviceCallback); + } + + /** + * Delete the role assignment on this billing account. + * + * @param billingAccountName Billing Account Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable deleteByBillingAccountNameAsync(String billingAccountName, String billingRoleAssignmentName) { + return deleteByBillingAccountNameWithServiceResponseAsync(billingAccountName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete the role assignment on this billing account. + * + * @param billingAccountName Billing Account Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable> deleteByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String billingRoleAssignmentName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingRoleAssignmentName == null) { + throw new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteByBillingAccountName(billingAccountName, billingRoleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the role assignment for the caller on the invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingRoleAssignmentInner object if successful. + */ + public BillingRoleAssignmentInner getByInvoiceSectionName(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName) { + return getByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * Get the role assignment for the caller on the invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleAssignmentName role assignment id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName), serviceCallback); + } + + /** + * Get the role assignment for the caller on the invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable getByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName) { + return getByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the role assignment for the caller on the invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable> getByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (billingRoleAssignmentName == null) { + throw new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByInvoiceSectionName(billingAccountName, invoiceSectionName, billingRoleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByInvoiceSectionNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByInvoiceSectionNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Delete the role assignment on the invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingRoleAssignmentInner object if successful. + */ + public BillingRoleAssignmentInner deleteByInvoiceSectionName(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName) { + return deleteByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * Delete the role assignment on the invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleAssignmentName role assignment id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName), serviceCallback); + } + + /** + * Delete the role assignment on the invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable deleteByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName) { + return deleteByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete the role assignment on the invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable> deleteByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String billingRoleAssignmentName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (billingRoleAssignmentName == null) { + throw new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteByInvoiceSectionName(billingAccountName, invoiceSectionName, billingRoleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteByInvoiceSectionNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteByInvoiceSectionNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the role assignment for the caller on the Billing Profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingRoleAssignmentInner object if successful. + */ + public BillingRoleAssignmentInner getByBillingProfileName(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + return getByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * Get the role assignment for the caller on the Billing Profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleAssignmentName role assignment id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName), serviceCallback); + } + + /** + * Get the role assignment for the caller on the Billing Profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable getByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + return getByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the role assignment for the caller on the Billing Profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable> getByBillingProfileNameWithServiceResponseAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (billingRoleAssignmentName == null) { + throw new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByBillingProfileName(billingAccountName, billingProfileName, billingRoleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingProfileNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingProfileNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Delete the role assignment on this Billing Profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingRoleAssignmentInner object if successful. + */ + public BillingRoleAssignmentInner deleteByBillingProfileName(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + return deleteByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).toBlocking().single().body(); + } + + /** + * Delete the role assignment on this Billing Profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleAssignmentName role assignment id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName), serviceCallback); + } + + /** + * Delete the role assignment on this Billing Profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable deleteByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + return deleteByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).map(new Func1, BillingRoleAssignmentInner>() { + @Override + public BillingRoleAssignmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete the role assignment on this Billing Profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleAssignmentName role assignment id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentInner object + */ + public Observable> deleteByBillingProfileNameWithServiceResponseAsync(String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (billingRoleAssignmentName == null) { + throw new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.deleteByBillingProfileName(billingAccountName, billingProfileName, billingRoleAssignmentName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteByBillingProfileNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteByBillingProfileNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the role assignments on the Billing Account. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingRoleAssignmentListResultInner object if successful. + */ + public BillingRoleAssignmentListResultInner listByBillingAccountName(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + } + + /** + * Get the role assignments on the Billing Account. + * + * @param billingAccountName Billing Account Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByBillingAccountNameAsync(String billingAccountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName), serviceCallback); + } + + /** + * Get the role assignments on the Billing Account. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable listByBillingAccountNameAsync(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).map(new Func1, BillingRoleAssignmentListResultInner>() { + @Override + public BillingRoleAssignmentListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the role assignments on the Billing Account. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The operation to add a role assignment to a billing account. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to add a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingRoleAssignmentListResultInner object if successful. + */ + public BillingRoleAssignmentListResultInner addByBillingAccountName(String billingAccountName, BillingRoleAssignmentPayload parameters) { + return addByBillingAccountNameWithServiceResponseAsync(billingAccountName, parameters).toBlocking().single().body(); + } + + /** + * The operation to add a role assignment to a billing account. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to add a role assignment. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture addByBillingAccountNameAsync(String billingAccountName, BillingRoleAssignmentPayload parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addByBillingAccountNameWithServiceResponseAsync(billingAccountName, parameters), serviceCallback); + } + + /** + * The operation to add a role assignment to a billing account. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to add a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable addByBillingAccountNameAsync(String billingAccountName, BillingRoleAssignmentPayload parameters) { + return addByBillingAccountNameWithServiceResponseAsync(billingAccountName, parameters).map(new Func1, BillingRoleAssignmentListResultInner>() { + @Override + public BillingRoleAssignmentListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to add a role assignment to a billing account. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to add a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable> addByBillingAccountNameWithServiceResponseAsync(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.addByBillingAccountName(billingAccountName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = addByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse addByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the role assignments on the invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingRoleAssignmentListResultInner object if successful. + */ + public BillingRoleAssignmentListResultInner listByInvoiceSectionName(String billingAccountName, String invoiceSectionName) { + return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName).toBlocking().single().body(); + } + + /** + * Get the role assignments on the invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName), serviceCallback); + } + + /** + * Get the role assignments on the invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName) { + return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName).map(new Func1, BillingRoleAssignmentListResultInner>() { + @Override + public BillingRoleAssignmentListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the role assignments on the invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable> listByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, String invoiceSectionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByInvoiceSectionName(billingAccountName, invoiceSectionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByInvoiceSectionNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByInvoiceSectionNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The operation to add a role assignment to a invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param parameters Parameters supplied to add a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingRoleAssignmentListResultInner object if successful. + */ + public BillingRoleAssignmentListResultInner addByInvoiceSectionName(String billingAccountName, String invoiceSectionName, BillingRoleAssignmentPayload parameters) { + return addByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, parameters).toBlocking().single().body(); + } + + /** + * The operation to add a role assignment to a invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param parameters Parameters supplied to add a role assignment. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture addByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, BillingRoleAssignmentPayload parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, parameters), serviceCallback); + } + + /** + * The operation to add a role assignment to a invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param parameters Parameters supplied to add a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable addByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, BillingRoleAssignmentPayload parameters) { + return addByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, parameters).map(new Func1, BillingRoleAssignmentListResultInner>() { + @Override + public BillingRoleAssignmentListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to add a role assignment to a invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param parameters Parameters supplied to add a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable> addByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, BillingRoleAssignmentPayload parameters) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (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.addByInvoiceSectionName(billingAccountName, invoiceSectionName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = addByInvoiceSectionNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse addByInvoiceSectionNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the role assignments on the Billing Profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingRoleAssignmentListResultInner object if successful. + */ + public BillingRoleAssignmentListResultInner listByBillingProfileName(String billingAccountName, String billingProfileName) { + return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * Get the role assignments on the Billing Profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByBillingProfileNameAsync(String billingAccountName, String billingProfileName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName), serviceCallback); + } + + /** + * Get the role assignments on the Billing Profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName) { + return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, BillingRoleAssignmentListResultInner>() { + @Override + public BillingRoleAssignmentListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the role assignments on the Billing Profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable> listByBillingProfileNameWithServiceResponseAsync(String billingAccountName, String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingProfileName(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingProfileNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingProfileNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The operation to add a role assignment to a billing profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param parameters Parameters supplied to add a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingRoleAssignmentListResultInner object if successful. + */ + public BillingRoleAssignmentListResultInner addByBillingProfileName(String billingAccountName, String billingProfileName, BillingRoleAssignmentPayload parameters) { + return addByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).toBlocking().single().body(); + } + + /** + * The operation to add a role assignment to a billing profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param parameters Parameters supplied to add a role assignment. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture addByBillingProfileNameAsync(String billingAccountName, String billingProfileName, BillingRoleAssignmentPayload parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(addByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, parameters), serviceCallback); + } + + /** + * The operation to add a role assignment to a billing profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param parameters Parameters supplied to add a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable addByBillingProfileNameAsync(String billingAccountName, String billingProfileName, BillingRoleAssignmentPayload parameters) { + return addByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).map(new Func1, BillingRoleAssignmentListResultInner>() { + @Override + public BillingRoleAssignmentListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to add a role assignment to a billing profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param parameters Parameters supplied to add a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleAssignmentListResultInner object + */ + public Observable> addByBillingProfileNameWithServiceResponseAsync(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.addByBillingProfileName(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 = addByBillingProfileNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse addByBillingProfileNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionImpl.java new file mode 100644 index 0000000000000..a2d1316b07bb8 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionImpl.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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleDefinition; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPermissionsProperties; + +class BillingRoleDefinitionImpl extends WrapperImpl implements BillingRoleDefinition { + private final BillingManager manager; + BillingRoleDefinitionImpl(BillingRoleDefinitionInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @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 String roleName() { + return this.inner().roleName(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionInner.java new file mode 100644 index 0000000000000..12e6f5917d9a7 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionInner.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingPermissionsProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Result of get role definition for a role. + */ +@JsonFlatten +public class BillingRoleDefinitionInner extends ProxyResource { + /** + * The role description. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * The list OF billingPermissions a caller has on a billing account. + */ + @JsonProperty(value = "properties.permissions.value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * 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 list OF billingPermissions a caller has on a billing account. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Get the name of the role. + * + * @return the roleName value + */ + public String roleName() { + return this.roleName; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionListResultImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionListResultImpl.java new file mode 100644 index 0000000000000..905549b7521ad --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionListResultInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionListResultInner.java new file mode 100644 index 0000000000000..2b740dffd99ba --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * list the role definitions. + */ +public class BillingRoleDefinitionListResultInner { + /** + * The list of role definitions. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the list of role definitions. + * + * @return the value value + */ + public List value() { + return this.value; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionsImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionsImpl.java new file mode 100644 index 0000000000000..741e82582a45c --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionsImpl.java @@ -0,0 +1,103 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleDefinitions; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleDefinition; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleDefinitionListResult; + +class BillingRoleDefinitionsImpl extends WrapperImpl implements BillingRoleDefinitions { + private final BillingManager manager; + + BillingRoleDefinitionsImpl(BillingManager manager) { + super(manager.inner().billingRoleDefinitions()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable getByBillingAccountNameAsync(String billingAccountName, String billingRoleDefinitionName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.getByBillingAccountNameAsync(billingAccountName, billingRoleDefinitionName) + .map(new Func1() { + @Override + public BillingRoleDefinition call(BillingRoleDefinitionInner inner) { + return new BillingRoleDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleDefinitionName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.getByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, billingRoleDefinitionName) + .map(new Func1() { + @Override + public BillingRoleDefinition call(BillingRoleDefinitionInner inner) { + return new BillingRoleDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleDefinitionName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.getByBillingProfileNameAsync(billingAccountName, billingProfileName, billingRoleDefinitionName) + .map(new Func1() { + @Override + public BillingRoleDefinition call(BillingRoleDefinitionInner inner) { + return new BillingRoleDefinitionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingAccountNameAsync(String billingAccountName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.listByBillingAccountNameAsync(billingAccountName) + .map(new Func1() { + @Override + public BillingRoleDefinitionListResult call(BillingRoleDefinitionListResultInner inner) { + return new BillingRoleDefinitionListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.listByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName) + .map(new Func1() { + @Override + public BillingRoleDefinitionListResult call(BillingRoleDefinitionListResultInner inner) { + return new BillingRoleDefinitionListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName) { + BillingRoleDefinitionsInner client = this.inner(); + return client.listByBillingProfileNameAsync(billingAccountName, billingProfileName) + .map(new Func1() { + @Override + public BillingRoleDefinitionListResult call(BillingRoleDefinitionListResultInner inner) { + return new BillingRoleDefinitionListResultImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionsInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionsInner.java new file mode 100644 index 0000000000000..02cbb02fc8425 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingRoleDefinitionsInner.java @@ -0,0 +1,585 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BillingRoleDefinitions. + */ +public class BillingRoleDefinitionsInner { + /** The Retrofit service to perform REST calls. */ + private BillingRoleDefinitionsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingRoleDefinitionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BillingRoleDefinitionsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(BillingRoleDefinitionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for BillingRoleDefinitions to be + * used by Retrofit to perform actually REST calls. + */ + interface BillingRoleDefinitionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleDefinitions getByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}") + Observable> getByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Path("billingRoleDefinitionName") String billingRoleDefinitionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleDefinitions getByInvoiceSectionName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}") + Observable> getByInvoiceSectionName(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Path("billingRoleDefinitionName") String billingRoleDefinitionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleDefinitions getByBillingProfileName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}") + Observable> getByBillingProfileName(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("billingRoleDefinitionName") String billingRoleDefinitionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleDefinitions listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleDefinitions") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleDefinitions listByInvoiceSectionName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleDefinitions") + Observable> listByInvoiceSectionName(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingRoleDefinitions listByBillingProfileName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleDefinitions") + Observable> listByBillingProfileName(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the role definition for a role. + * + * @param billingAccountName Billing Account Id. + * @param billingRoleDefinitionName role definition id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingRoleDefinitionInner object if successful. + */ + public BillingRoleDefinitionInner getByBillingAccountName(String billingAccountName, String billingRoleDefinitionName) { + return getByBillingAccountNameWithServiceResponseAsync(billingAccountName, billingRoleDefinitionName).toBlocking().single().body(); + } + + /** + * Gets the role definition for a role. + * + * @param billingAccountName Billing Account Id. + * @param billingRoleDefinitionName role definition id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByBillingAccountNameAsync(String billingAccountName, String billingRoleDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingAccountNameWithServiceResponseAsync(billingAccountName, billingRoleDefinitionName), serviceCallback); + } + + /** + * Gets the role definition for a role. + * + * @param billingAccountName Billing Account Id. + * @param billingRoleDefinitionName role definition id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionInner object + */ + public Observable getByBillingAccountNameAsync(String billingAccountName, String billingRoleDefinitionName) { + return getByBillingAccountNameWithServiceResponseAsync(billingAccountName, billingRoleDefinitionName).map(new Func1, BillingRoleDefinitionInner>() { + @Override + public BillingRoleDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the role definition for a role. + * + * @param billingAccountName Billing Account Id. + * @param billingRoleDefinitionName role definition id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionInner object + */ + public Observable> getByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String billingRoleDefinitionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingRoleDefinitionName == null) { + throw new IllegalArgumentException("Parameter billingRoleDefinitionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByBillingAccountName(billingAccountName, billingRoleDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the role definition for a role. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleDefinitionName role definition id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingRoleDefinitionInner object if successful. + */ + public BillingRoleDefinitionInner getByInvoiceSectionName(String billingAccountName, String invoiceSectionName, String billingRoleDefinitionName) { + return getByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingRoleDefinitionName).toBlocking().single().body(); + } + + /** + * Gets the role definition for a role. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleDefinitionName role definition id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingRoleDefinitionName), serviceCallback); + } + + /** + * Gets the role definition for a role. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleDefinitionName role definition id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionInner object + */ + public Observable getByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String billingRoleDefinitionName) { + return getByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingRoleDefinitionName).map(new Func1, BillingRoleDefinitionInner>() { + @Override + public BillingRoleDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the role definition for a role. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingRoleDefinitionName role definition id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionInner object + */ + public Observable> getByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String billingRoleDefinitionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (billingRoleDefinitionName == null) { + throw new IllegalArgumentException("Parameter billingRoleDefinitionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByInvoiceSectionName(billingAccountName, invoiceSectionName, billingRoleDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByInvoiceSectionNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByInvoiceSectionNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the role definition for a role. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleDefinitionName role definition id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingRoleDefinitionInner object if successful. + */ + public BillingRoleDefinitionInner getByBillingProfileName(String billingAccountName, String billingProfileName, String billingRoleDefinitionName) { + return getByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleDefinitionName).toBlocking().single().body(); + } + + /** + * Gets the role definition for a role. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleDefinitionName role definition id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleDefinitionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleDefinitionName), serviceCallback); + } + + /** + * Gets the role definition for a role. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleDefinitionName role definition id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionInner object + */ + public Observable getByBillingProfileNameAsync(String billingAccountName, String billingProfileName, String billingRoleDefinitionName) { + return getByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, billingRoleDefinitionName).map(new Func1, BillingRoleDefinitionInner>() { + @Override + public BillingRoleDefinitionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the role definition for a role. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param billingRoleDefinitionName role definition id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionInner object + */ + public Observable> getByBillingProfileNameWithServiceResponseAsync(String billingAccountName, String billingProfileName, String billingRoleDefinitionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (billingRoleDefinitionName == null) { + throw new IllegalArgumentException("Parameter billingRoleDefinitionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByBillingProfileName(billingAccountName, billingProfileName, billingRoleDefinitionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingProfileNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingProfileNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role definition for a billing account. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingRoleDefinitionListResultInner object if successful. + */ + public BillingRoleDefinitionListResultInner listByBillingAccountName(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + } + + /** + * Lists the role definition for a billing account. + * + * @param billingAccountName Billing Account Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByBillingAccountNameAsync(String billingAccountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName), serviceCallback); + } + + /** + * Lists the role definition for a billing account. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionListResultInner object + */ + public Observable listByBillingAccountNameAsync(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).map(new Func1, BillingRoleDefinitionListResultInner>() { + @Override + public BillingRoleDefinitionListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the role definition for a billing account. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionListResultInner object + */ + public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role definition for an invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingRoleDefinitionListResultInner object if successful. + */ + public BillingRoleDefinitionListResultInner listByInvoiceSectionName(String billingAccountName, String invoiceSectionName) { + return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName).toBlocking().single().body(); + } + + /** + * Lists the role definition for an invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName), serviceCallback); + } + + /** + * Lists the role definition for an invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionListResultInner object + */ + public Observable listByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName) { + return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName).map(new Func1, BillingRoleDefinitionListResultInner>() { + @Override + public BillingRoleDefinitionListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the role definition for an invoice Section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionListResultInner object + */ + public Observable> listByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, String invoiceSectionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByInvoiceSectionName(billingAccountName, invoiceSectionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByInvoiceSectionNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByInvoiceSectionNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the role definition for a Billing Profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingRoleDefinitionListResultInner object if successful. + */ + public BillingRoleDefinitionListResultInner listByBillingProfileName(String billingAccountName, String billingProfileName) { + return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * Lists the role definition for a Billing Profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByBillingProfileNameAsync(String billingAccountName, String billingProfileName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName), serviceCallback); + } + + /** + * Lists the role definition for a Billing Profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionListResultInner object + */ + public Observable listByBillingProfileNameAsync(String billingAccountName, String billingProfileName) { + return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, BillingRoleDefinitionListResultInner>() { + @Override + public BillingRoleDefinitionListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the role definition for a Billing Profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingRoleDefinitionListResultInner object + */ + public Observable> listByBillingProfileNameWithServiceResponseAsync(String billingAccountName, String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingProfileName(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingProfileNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingProfileNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionSummaryImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionSummaryImpl.java new file mode 100644 index 0000000000000..9bf09f1d48366 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionSummaryImpl.java @@ -0,0 +1,119 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptionSummary; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Amount; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Reseller; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptionStatusType; +import java.util.UUID; + +class BillingSubscriptionSummaryImpl extends WrapperImpl implements BillingSubscriptionSummary { + private final BillingManager manager; + + BillingSubscriptionSummaryImpl(BillingSubscriptionSummaryInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + + + @Override + public String billingProfileId() { + return this.inner().billingProfileId(); + } + + @Override + public String billingProfileName() { + return this.inner().billingProfileName(); + } + + @Override + public String 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 invoiceSectionId() { + return this.inner().invoiceSectionId(); + } + + @Override + public String invoiceSectionName() { + return this.inner().invoiceSectionName(); + } + + @Override + public Amount lastMonthCharges() { + return this.inner().lastMonthCharges(); + } + + @Override + public Amount monthToDateCharges() { + return this.inner().monthToDateCharges(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public 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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionSummaryInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionSummaryInner.java new file mode 100644 index 0000000000000..b7322fb9b2cc3 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionSummaryInner.java @@ -0,0 +1,257 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import java.util.UUID; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptionStatusType; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Amount; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Reseller; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A billing Subscription summary resource. + */ +@JsonFlatten +public class BillingSubscriptionSummaryInner extends ProxyResource { + /** + * display name. + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * Subscription Id. + */ + @JsonProperty(value = "properties.subscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private UUID subscriptionId; + + /** + * Subscription billing status. Possible values include: 'Active', + * 'Inactive', 'Abandoned', 'Deleted', 'Warning'. + */ + @JsonProperty(value = "properties.subscriptionBillingStatus") + private BillingSubscriptionStatusType subscriptionBillingStatus; + + /** + * Last month charges. + */ + @JsonProperty(value = "properties.lastMonthCharges", access = JsonProperty.Access.WRITE_ONLY) + private Amount lastMonthCharges; + + /** + * Month to date charges. + */ + @JsonProperty(value = "properties.monthToDateCharges", access = JsonProperty.Access.WRITE_ONLY) + private Amount monthToDateCharges; + + /** + * Billing Profile id to which this product belongs. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /** + * Billing Profile name to which this product belongs. + */ + @JsonProperty(value = "properties.billingProfileName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileName; + + /** + * Customer id to which this product belongs. + */ + @JsonProperty(value = "properties.customerId", access = JsonProperty.Access.WRITE_ONLY) + private String customerId; + + /** + * Display name of customer to which this product belongs. + */ + @JsonProperty(value = "properties.customerDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String customerDisplayName; + + /** + * Invoice section id to which this product belongs. + */ + @JsonProperty(value = "properties.invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /** + * Invoice section name to which this product belongs. + */ + @JsonProperty(value = "properties.invoiceSectionName", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionName; + + /** + * The sku id. + */ + @JsonProperty(value = "properties.skuId") + private String skuId; + + /** + * The sku description. + */ + @JsonProperty(value = "properties.skuDescription", access = JsonProperty.Access.WRITE_ONLY) + private String skuDescription; + + /** + * Reseller for this subscription. + */ + @JsonProperty(value = "properties.reseller", access = JsonProperty.Access.WRITE_ONLY) + private Reseller reseller; + + /** + * Get display name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get subscription Id. + * + * @return the subscriptionId value + */ + public UUID subscriptionId() { + return this.subscriptionId; + } + + /** + * Get subscription billing status. Possible values include: 'Active', 'Inactive', 'Abandoned', 'Deleted', 'Warning'. + * + * @return the subscriptionBillingStatus value + */ + public BillingSubscriptionStatusType subscriptionBillingStatus() { + return this.subscriptionBillingStatus; + } + + /** + * Set subscription billing status. Possible values include: 'Active', 'Inactive', 'Abandoned', 'Deleted', 'Warning'. + * + * @param subscriptionBillingStatus the subscriptionBillingStatus value to set + * @return the BillingSubscriptionSummaryInner object itself. + */ + public BillingSubscriptionSummaryInner withSubscriptionBillingStatus(BillingSubscriptionStatusType subscriptionBillingStatus) { + this.subscriptionBillingStatus = subscriptionBillingStatus; + return this; + } + + /** + * Get last month charges. + * + * @return the lastMonthCharges value + */ + public Amount lastMonthCharges() { + return this.lastMonthCharges; + } + + /** + * Get month to date charges. + * + * @return the monthToDateCharges value + */ + public Amount monthToDateCharges() { + return this.monthToDateCharges; + } + + /** + * Get billing Profile id to which this product belongs. + * + * @return the billingProfileId value + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get billing Profile name to which this product belongs. + * + * @return the billingProfileName value + */ + public String billingProfileName() { + return this.billingProfileName; + } + + /** + * Get customer id to which this product belongs. + * + * @return the customerId value + */ + public String customerId() { + return this.customerId; + } + + /** + * Get display name of customer to which this product belongs. + * + * @return the customerDisplayName value + */ + public String customerDisplayName() { + return this.customerDisplayName; + } + + /** + * Get invoice section id to which this product belongs. + * + * @return the invoiceSectionId value + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get invoice section name to which this product belongs. + * + * @return the invoiceSectionName value + */ + public String invoiceSectionName() { + return this.invoiceSectionName; + } + + /** + * 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 BillingSubscriptionSummaryInner object itself. + */ + public BillingSubscriptionSummaryInner withSkuId(String skuId) { + this.skuId = skuId; + return this; + } + + /** + * Get the sku description. + * + * @return the skuDescription value + */ + public String skuDescription() { + return this.skuDescription; + } + + /** + * Get reseller for this subscription. + * + * @return the reseller value + */ + public Reseller reseller() { + return this.reseller; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionsImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionsImpl.java new file mode 100644 index 0000000000000..a3996be186f15 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionsImpl.java @@ -0,0 +1,158 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptionSummary; +import com.microsoft.azure.management.billing.v2018_11_01_preview.TransferBillingSubscriptionResult; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ValidateSubscriptionTransferEligibilityResult; +import com.microsoft.azure.management.billing.v2018_11_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 BillingSubscriptionSummaryImpl wrapModel(BillingSubscriptionSummaryInner inner) { + return new BillingSubscriptionSummaryImpl(inner, manager()); + } + + @Override + public Observable listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName) { + BillingSubscriptionsInner client = this.inner(); + return client.listByBillingProfileNameAsync(billingAccountName, billingProfileName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingSubscriptionSummary call(BillingSubscriptionSummaryInner inner) { + return new BillingSubscriptionSummaryImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByCustomerNameAsync(final String billingAccountName, final String customerName) { + BillingSubscriptionsInner client = this.inner(); + return client.listByCustomerNameAsync(billingAccountName, customerName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingSubscriptionSummary call(BillingSubscriptionSummaryInner inner) { + return new BillingSubscriptionSummaryImpl(inner, manager()); + } + }); + } + + @Override + public Observable getByCustomerNameAsync(String billingAccountName, String customerName, String billingSubscriptionName) { + BillingSubscriptionsInner client = this.inner(); + return client.getByCustomerNameAsync(billingAccountName, customerName, billingSubscriptionName) + .map(new Func1() { + @Override + public BillingSubscriptionSummary call(BillingSubscriptionSummaryInner inner) { + return new BillingSubscriptionSummaryImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName) { + BillingSubscriptionsInner client = this.inner(); + return client.listByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingSubscriptionSummary call(BillingSubscriptionSummaryInner inner) { + return new BillingSubscriptionSummaryImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName) { + BillingSubscriptionsInner client = this.inner(); + return client.getAsync(billingAccountName, invoiceSectionName, billingSubscriptionName) + .map(new Func1() { + @Override + public BillingSubscriptionSummary call(BillingSubscriptionSummaryInner inner) { + return new BillingSubscriptionSummaryImpl(inner, manager()); + } + }); + } + + @Override + public Observable transferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + BillingSubscriptionsInner client = this.inner(); + return client.transferAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters) + .map(new Func1() { + @Override + public TransferBillingSubscriptionResult call(TransferBillingSubscriptionResultInner inner) { + return new TransferBillingSubscriptionResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable validateTransferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + BillingSubscriptionsInner client = this.inner(); + return client.validateTransferAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters) + .map(new Func1() { + @Override + public ValidateSubscriptionTransferEligibilityResult call(ValidateSubscriptionTransferEligibilityResultInner inner) { + return new ValidateSubscriptionTransferEligibilityResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingAccountNameAsync(final String billingAccountName) { + BillingSubscriptionsInner client = this.inner(); + return client.listByBillingAccountNameAsync(billingAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public BillingSubscriptionSummary call(BillingSubscriptionSummaryInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionsInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionsInner.java new file mode 100644 index 0000000000000..c3751dd8abfc7 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/BillingSubscriptionsInner.java @@ -0,0 +1,1485 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptionsTransferHeaders; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.azure.management.billing.v2018_11_01_preview.TransferBillingSubscriptionRequestProperties; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import 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.v2018_11_01_preview.BillingSubscriptions listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptions listByBillingProfileName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingSubscriptions") + Observable> listByBillingProfileName(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptions listByCustomerName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingSubscriptions") + Observable> listByCustomerName(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptions getByCustomerName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingSubscriptions/{billingSubscriptionName}") + Observable> getByCustomerName(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Path("billingSubscriptionName") String billingSubscriptionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptions listByInvoiceSectionName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions") + Observable> listByInvoiceSectionName(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptions get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Path("billingSubscriptionName") String billingSubscriptionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptions transfer" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}/transfer") + Observable> transfer(@Path("billingAccountName") String billingAccountName, @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.v2018_11_01_preview.BillingSubscriptions beginTransfer" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}/transfer") + Observable> beginTransfer(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Path("billingSubscriptionName") String billingSubscriptionName, @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.v2018_11_01_preview.BillingSubscriptions validateTransfer" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}/validateTransferEligibility") + Observable> validateTransfer(@Path("billingAccountName") String billingAccountName, @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.v2018_11_01_preview.BillingSubscriptions listByBillingAccountNameNext" }) + @GET + Observable> listByBillingAccountNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptions listByBillingProfileNameNext" }) + @GET + Observable> listByBillingProfileNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptions listByCustomerNameNext" }) + @GET + Observable> listByCustomerNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.BillingSubscriptions listByInvoiceSectionNameNext" }) + @GET + Observable> listByInvoiceSectionNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists billing subscriptions by billing account name. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<BillingSubscriptionSummaryInner> object if successful. + */ + public PagedList listByBillingAccountName(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists billing subscriptions by billing account name. + * + * @param billingAccountName Billing Account Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists billing subscriptions by billing account name. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object + */ + public Observable> listByBillingAccountNameAsync(final String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists billing subscriptions by billing account name. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountNameSinglePageAsync(billingAccountName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists billing subscriptions by billing account name. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingSubscriptionSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists billing subscriptions by billing profile name. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<BillingSubscriptionSummaryInner> object if successful. + */ + public PagedList listByBillingProfileName(final String billingAccountName, final String billingProfileName) { + ServiceResponse> response = listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists billing subscriptions by billing profile name. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists billing subscriptions by billing profile name. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object + */ + public Observable> listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists billing subscriptions by billing profile name. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object + */ + public Observable>> listByBillingProfileNameWithServiceResponseAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists billing subscriptions by billing profile name. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingSubscriptionSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNameSinglePageAsync(final String billingAccountName, final String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingProfileName(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists billing subscription by customer name. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<BillingSubscriptionSummaryInner> object if successful. + */ + public PagedList listByCustomerName(final String billingAccountName, final String customerName) { + ServiceResponse> response = listByCustomerNameSinglePageAsync(billingAccountName, customerName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists billing subscription by customer name. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByCustomerNameAsync(final String billingAccountName, final String customerName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCustomerNameSinglePageAsync(billingAccountName, customerName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists billing subscription by customer name. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object + */ + public Observable> listByCustomerNameAsync(final String billingAccountName, final String customerName) { + return listByCustomerNameWithServiceResponseAsync(billingAccountName, customerName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists billing subscription by customer name. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object + */ + public Observable>> listByCustomerNameWithServiceResponseAsync(final String billingAccountName, final String customerName) { + return listByCustomerNameSinglePageAsync(billingAccountName, customerName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByCustomerNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists billing subscription by customer name. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param customerName Customer Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingSubscriptionSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCustomerNameSinglePageAsync(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.listByCustomerName(billingAccountName, customerName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCustomerNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByCustomerNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get a single billing subscription by name. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param billingSubscriptionName Billing Subscription Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingSubscriptionSummaryInner object if successful. + */ + public BillingSubscriptionSummaryInner getByCustomerName(String billingAccountName, String customerName, String billingSubscriptionName) { + return getByCustomerNameWithServiceResponseAsync(billingAccountName, customerName, billingSubscriptionName).toBlocking().single().body(); + } + + /** + * Get a single billing subscription by name. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByCustomerNameAsync(String billingAccountName, String customerName, String billingSubscriptionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByCustomerNameWithServiceResponseAsync(billingAccountName, customerName, billingSubscriptionName), serviceCallback); + } + + /** + * Get a single billing subscription by name. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param billingSubscriptionName Billing Subscription Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingSubscriptionSummaryInner object + */ + public Observable getByCustomerNameAsync(String billingAccountName, String customerName, String billingSubscriptionName) { + return getByCustomerNameWithServiceResponseAsync(billingAccountName, customerName, billingSubscriptionName).map(new Func1, BillingSubscriptionSummaryInner>() { + @Override + public BillingSubscriptionSummaryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get a single billing subscription by name. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param billingSubscriptionName Billing Subscription Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingSubscriptionSummaryInner object + */ + public Observable> getByCustomerNameWithServiceResponseAsync(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.getByCustomerName(billingAccountName, customerName, billingSubscriptionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByCustomerNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByCustomerNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists billing subscription by invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<BillingSubscriptionSummaryInner> object if successful. + */ + public PagedList listByInvoiceSectionName(final String billingAccountName, final String invoiceSectionName) { + ServiceResponse> response = listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists billing subscription by invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists billing subscription by invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object + */ + public Observable> listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName) { + return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists billing subscription by invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object + */ + public Observable>> listByInvoiceSectionNameWithServiceResponseAsync(final String billingAccountName, final String invoiceSectionName) { + return listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInvoiceSectionNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists billing subscription by invoice section name. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingSubscriptionSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionNameSinglePageAsync(final String billingAccountName, final String invoiceSectionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByInvoiceSectionName(billingAccountName, invoiceSectionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceSectionNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get a single billing subscription by name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the BillingSubscriptionSummaryInner object if successful. + */ + public BillingSubscriptionSummaryInner get(String billingAccountName, String invoiceSectionName, String billingSubscriptionName) { + return getWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName).toBlocking().single().body(); + } + + /** + * Get a single billing subscription by name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName), serviceCallback); + } + + /** + * Get a single billing subscription by name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingSubscriptionSummaryInner object + */ + public Observable getAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName) { + return getWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName).map(new Func1, BillingSubscriptionSummaryInner>() { + @Override + public BillingSubscriptionSummaryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get a single billing subscription by name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingSubscriptionSummaryInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (billingSubscriptionName == null) { + throw new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(billingAccountName, invoiceSectionName, billingSubscriptionName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Transfers the subscription from one invoice section to another within a billing account. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param parameters Parameters supplied to the Transfer Billing Subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TransferBillingSubscriptionResultInner object if successful. + */ + public TransferBillingSubscriptionResultInner transfer(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + return transferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters).toBlocking().last().body(); + } + + /** + * Transfers the subscription from one invoice section to another within a billing account. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param parameters Parameters supplied to the Transfer Billing Subscription operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture transferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(transferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters), serviceCallback); + } + + /** + * Transfers the subscription from one invoice section to another within a billing account. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param parameters Parameters supplied to the Transfer Billing Subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable transferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + return transferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters).map(new Func1, TransferBillingSubscriptionResultInner>() { + @Override + public TransferBillingSubscriptionResultInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Transfers the subscription from one invoice section to another within a billing account. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param parameters Parameters supplied to the Transfer Billing Subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> transferWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (billingSubscriptionName == null) { + throw new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.transfer(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new TypeToken() { }.getType(), BillingSubscriptionsTransferHeaders.class); + } + + /** + * Transfers the subscription from one invoice section to another within a billing account. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param parameters Parameters supplied to the Transfer Billing Subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TransferBillingSubscriptionResultInner object if successful. + */ + public TransferBillingSubscriptionResultInner beginTransfer(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + return beginTransferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters).toBlocking().single().body(); + } + + /** + * Transfers the subscription from one invoice section to another within a billing account. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param parameters Parameters supplied to the Transfer Billing Subscription operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginTransferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginTransferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters), serviceCallback); + } + + /** + * Transfers the subscription from one invoice section to another within a billing account. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param parameters Parameters supplied to the Transfer Billing Subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransferBillingSubscriptionResultInner object + */ + public Observable beginTransferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + return beginTransferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters).map(new Func1, TransferBillingSubscriptionResultInner>() { + @Override + public TransferBillingSubscriptionResultInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Transfers the subscription from one invoice section to another within a billing account. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param parameters Parameters supplied to the Transfer Billing Subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransferBillingSubscriptionResultInner object + */ + public Observable> beginTransferWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (billingSubscriptionName == null) { + throw new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginTransfer(billingAccountName, 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 the transfer of billing subscriptions across invoice sections. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param parameters Parameters supplied to the Transfer Billing Subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ValidateSubscriptionTransferEligibilityResultInner object if successful. + */ + public ValidateSubscriptionTransferEligibilityResultInner validateTransfer(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + return validateTransferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters).toBlocking().single().body(); + } + + /** + * Validates the transfer of billing subscriptions across invoice sections. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param parameters Parameters supplied to the Transfer Billing Subscription operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture validateTransferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateTransferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters), serviceCallback); + } + + /** + * Validates the transfer of billing subscriptions across invoice sections. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param parameters Parameters supplied to the Transfer Billing Subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateSubscriptionTransferEligibilityResultInner object + */ + public Observable validateTransferAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + return validateTransferWithServiceResponseAsync(billingAccountName, invoiceSectionName, billingSubscriptionName, parameters).map(new Func1, ValidateSubscriptionTransferEligibilityResultInner>() { + @Override + public ValidateSubscriptionTransferEligibilityResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Validates the transfer of billing subscriptions across invoice sections. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param billingSubscriptionName Billing Subscription Id. + * @param parameters Parameters supplied to the Transfer Billing Subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateSubscriptionTransferEligibilityResultInner object + */ + public Observable> validateTransferWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String billingSubscriptionName, TransferBillingSubscriptionRequestProperties parameters) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (billingSubscriptionName == null) { + throw new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.validateTransfer(billingAccountName, 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 billing subscriptions by billing account name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<BillingSubscriptionSummaryInner> object if successful. + */ + public PagedList listByBillingAccountNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists billing subscriptions by billing account name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists billing subscriptions by billing account name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object + */ + public Observable> listByBillingAccountNameNextAsync(final String nextPageLink) { + return listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists billing subscriptions by billing account name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object + */ + public Observable>> listByBillingAccountNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists billing subscriptions by billing account name. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingSubscriptionSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingAccountNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists billing subscriptions by billing profile name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<BillingSubscriptionSummaryInner> object if successful. + */ + public PagedList listByBillingProfileNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingProfileNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists billing subscriptions by billing profile name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingProfileNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists billing subscriptions by billing profile name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object + */ + public Observable> listByBillingProfileNameNextAsync(final String nextPageLink) { + return listByBillingProfileNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists billing subscriptions by billing profile name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object + */ + public Observable>> listByBillingProfileNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists billing subscriptions by billing profile name. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingSubscriptionSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNameNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingProfileNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists billing subscription by customer name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<BillingSubscriptionSummaryInner> object if successful. + */ + public PagedList listByCustomerNameNext(final String nextPageLink) { + ServiceResponse> response = listByCustomerNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists billing subscription by customer name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByCustomerNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCustomerNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists billing subscription by customer name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object + */ + public Observable> listByCustomerNameNextAsync(final String nextPageLink) { + return listByCustomerNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists billing subscription by customer name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object + */ + public Observable>> listByCustomerNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByCustomerNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists billing subscription by customer name. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingSubscriptionSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCustomerNameNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByCustomerNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCustomerNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByCustomerNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists billing subscription by invoice section name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<BillingSubscriptionSummaryInner> object if successful. + */ + public PagedList listByInvoiceSectionNameNext(final String nextPageLink) { + ServiceResponse> response = listByInvoiceSectionNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists billing subscription by invoice section name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByInvoiceSectionNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists billing subscription by invoice section name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object + */ + public Observable> listByInvoiceSectionNameNextAsync(final String nextPageLink) { + return listByInvoiceSectionNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists billing subscription by invoice section name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingSubscriptionSummaryInner> object + */ + public Observable>> listByInvoiceSectionNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInvoiceSectionNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists billing subscription by invoice section name. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingSubscriptionSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionNameNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByInvoiceSectionNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceSectionNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomerImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomerImpl.java new file mode 100644 index 0000000000000..b6a8373c0bfd8 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomerImpl.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.Customer; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_01_preview.EnabledAzureSKUs; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Reseller; + +class CustomerImpl extends IndexableRefreshableWrapperImpl implements Customer { + private final BillingManager manager; + private String billingAccountName; + private String customerName; + + CustomerImpl(CustomerInner inner, BillingManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.billingAccountName = IdParsingUtils.getValueFromIdByName(inner.id(), "billingAccounts"); + this.customerName = IdParsingUtils.getValueFromIdByName(inner.id(), "customers"); + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + CustomersInner client = this.manager().inner().customers(); + return client.getAsync(this.billingAccountName, this.customerName); + } + + + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public List enabledAzureSKUs() { + return this.inner().enabledAzureSKUs(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List resellers() { + return this.inner().resellers(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomerInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomerInner.java new file mode 100644 index 0000000000000..9491faab977f2 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomerInner.java @@ -0,0 +1,101 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_01_preview.EnabledAzureSKUs; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Reseller; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A partner's customer. + */ +@JsonFlatten +public class CustomerInner extends ProxyResource { + /** + * The name of the customer. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * Information about the product. + */ + @JsonProperty(value = "properties.enabledAzureSKUs") + private List enabledAzureSKUs; + + /** + * The resellers which are allowed to provide service to this customer. + */ + @JsonProperty(value = "properties.resellers") + private List resellers; + + /** + * Get the name of the customer. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the name of the customer. + * + * @param displayName the displayName value to set + * @return the CustomerInner object itself. + */ + public CustomerInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get information about the product. + * + * @return the enabledAzureSKUs value + */ + public List enabledAzureSKUs() { + return this.enabledAzureSKUs; + } + + /** + * Set information about the product. + * + * @param enabledAzureSKUs the enabledAzureSKUs value to set + * @return the CustomerInner object itself. + */ + public CustomerInner withEnabledAzureSKUs(List enabledAzureSKUs) { + this.enabledAzureSKUs = enabledAzureSKUs; + return this; + } + + /** + * Get the resellers which are allowed to provide service to this customer. + * + * @return the resellers value + */ + public List resellers() { + return this.resellers; + } + + /** + * Set the resellers which are allowed to provide service to this customer. + * + * @param resellers the resellers value to set + * @return the CustomerInner object itself. + */ + public CustomerInner withResellers(List resellers) { + this.resellers = resellers; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomersImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomersImpl.java new file mode 100644 index 0000000000000..b30eb2902adda --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomersImpl.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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Customers; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Customer; + +class CustomersImpl extends WrapperImpl implements Customers { + private final BillingManager manager; + + CustomersImpl(BillingManager manager) { + super(manager.inner().customers()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private CustomerImpl wrapModel(CustomerInner inner) { + return new CustomerImpl(inner, manager()); + } + + @Override + public Observable listByBillingAccountNameAsync(final String billingAccountName) { + CustomersInner client = this.inner(); + return client.listByBillingAccountNameAsync(billingAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Customer call(CustomerInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String customerName) { + CustomersInner client = this.inner(); + return client.getAsync(billingAccountName, customerName) + .flatMap(new Func1>() { + @Override + public Observable call(CustomerInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Customer)wrapModel(inner)); + } + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomersInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomersInner.java new file mode 100644 index 0000000000000..34837c6cce57a --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/CustomersInner.java @@ -0,0 +1,578 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Customers. + */ +public class CustomersInner { + /** The Retrofit service to perform REST calls. */ + private CustomersService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of CustomersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CustomersInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(CustomersService.class); + this.client = client; + } + + /** + * The interface defining all the services for Customers to be + * used by Retrofit to perform actually REST calls. + */ + interface CustomersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Customers listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Query("$skiptoken") String skiptoken, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Customers get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Customers listByBillingAccountNameNext" }) + @GET + Observable> listByBillingAccountNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<CustomerInner> object if successful. + */ + public PagedList listByBillingAccountName(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param billingAccountName Billing Account Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable> listByBillingAccountNameAsync(final String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountNameSinglePageAsync(billingAccountName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CustomerInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + final String skiptoken = null; + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), filter, skiptoken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param billingAccountName Billing Account Id. + * @param filter May be used to filter using hasPermission('{permissionId}') to only return customers for which the caller has the specified permission. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<CustomerInner> object if successful. + */ + public PagedList listByBillingAccountName(final String billingAccountName, final String filter, final String skiptoken) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName, filter, skiptoken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param billingAccountName Billing Account Id. + * @param filter May be used to filter using hasPermission('{permissionId}') to only return customers for which the caller has the specified permission. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final String filter, final String skiptoken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName, filter, skiptoken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param billingAccountName Billing Account Id. + * @param filter May be used to filter using hasPermission('{permissionId}') to only return customers for which the caller has the specified permission. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable> listByBillingAccountNameAsync(final String billingAccountName, final String filter, final String skiptoken) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, filter, skiptoken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param billingAccountName Billing Account Id. + * @param filter May be used to filter using hasPermission('{permissionId}') to only return customers for which the caller has the specified permission. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName, final String filter, final String skiptoken) { + return listByBillingAccountNameSinglePageAsync(billingAccountName, filter, skiptoken) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param filter May be used to filter using hasPermission('{permissionId}') to only return customers for which the caller has the specified permission. + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CustomerInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName, final String filter, final String skiptoken) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), filter, skiptoken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the customer by id. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CustomerInner object if successful. + */ + public CustomerInner get(String billingAccountName, String customerName) { + return getWithServiceResponseAsync(billingAccountName, customerName).toBlocking().single().body(); + } + + /** + * Get the customer by id. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String customerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, customerName), serviceCallback); + } + + /** + * Get the customer by id. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerInner object + */ + public Observable getAsync(String billingAccountName, String customerName) { + return getWithServiceResponseAsync(billingAccountName, customerName).map(new Func1, CustomerInner>() { + @Override + public CustomerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the customer by id. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String customerName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + return service.get(billingAccountName, customerName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get the customer by id. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param expand May be used to expand enabledAzureSkus, resellers. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the CustomerInner object if successful. + */ + public CustomerInner get(String billingAccountName, String customerName, String expand) { + return getWithServiceResponseAsync(billingAccountName, customerName, expand).toBlocking().single().body(); + } + + /** + * Get the customer by id. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param expand May be used to expand enabledAzureSkus, resellers. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String customerName, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, customerName, expand), serviceCallback); + } + + /** + * Get the customer by id. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param expand May be used to expand enabledAzureSkus, resellers. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerInner object + */ + public Observable getAsync(String billingAccountName, String customerName, String expand) { + return getWithServiceResponseAsync(billingAccountName, customerName, expand).map(new Func1, CustomerInner>() { + @Override + public CustomerInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the customer by id. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param expand May be used to expand enabledAzureSkus, resellers. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CustomerInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String customerName, String expand) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (customerName == null) { + throw new IllegalArgumentException("Parameter customerName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(billingAccountName, customerName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<CustomerInner> object if successful. + */ + public PagedList listByBillingAccountNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable> listByBillingAccountNameNextAsync(final String nextPageLink) { + return listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<CustomerInner> object + */ + public Observable>> listByBillingAccountNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all customers which the current user can work with on-behalf of a partner. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<CustomerInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingAccountNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DepartmentImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DepartmentImpl.java new file mode 100644 index 0000000000000..ade9fc36844ef --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.Department; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import java.util.ArrayList; +import com.microsoft.azure.management.billing.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DepartmentInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DepartmentInner.java new file mode 100644 index 0000000000000..aa1d69a99c5f5 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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 resource. + */ +@JsonFlatten +public class DepartmentInner extends ProxyResource { + /** + * The name for department. + */ + @JsonProperty(value = "properties.departmentName") + private String departmentName; + + /** + * The cost center name. + */ + @JsonProperty(value = "properties.costCenter") + private String costCenter; + + /** + * The status for 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 for department. + * + * @return the departmentName value + */ + public String departmentName() { + return this.departmentName; + } + + /** + * Set the name for 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 name. + * + * @return the costCenter value + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Set the cost center name. + * + * @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 for department. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set the status for 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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DepartmentsImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DepartmentsImpl.java new file mode 100644 index 0000000000000..c8682709b89ed --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DepartmentsImpl.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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Departments; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2018_11_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(final String billingAccountName) { + DepartmentsInner client = this.inner(); + return client.listByBillingAccountNameAsync(billingAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Department call(DepartmentInner inner) { + return wrapModel(inner); + } + }); + } + + @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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DepartmentsInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DepartmentsInner.java new file mode 100644 index 0000000000000..28d1c8ecd6012 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DepartmentsInner.java @@ -0,0 +1,583 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in 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.v2018_11_01_preview.Departments listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Departments get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("departmentName") String departmentName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Departments listByBillingAccountNameNext" }) + @GET + Observable> listByBillingAccountNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all departments for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DepartmentInner> object if successful. + */ + public PagedList listByBillingAccountName(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all departments for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all departments for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DepartmentInner> object + */ + public Observable> listByBillingAccountNameAsync(final String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all departments for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DepartmentInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountNameSinglePageAsync(billingAccountName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all departments for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DepartmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName) { + 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> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all departments for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the enrollmentAccounts. + * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DepartmentInner> object if successful. + */ + public PagedList listByBillingAccountName(final String billingAccountName, final String expand, final String filter) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName, expand, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all departments for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the enrollmentAccounts. + * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final String expand, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName, expand, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all departments for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the enrollmentAccounts. + * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DepartmentInner> object + */ + public Observable> listByBillingAccountNameAsync(final String billingAccountName, final String expand, final String filter) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all departments for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the enrollmentAccounts. + * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DepartmentInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName, final String expand, final String filter) { + return listByBillingAccountNameSinglePageAsync(billingAccountName, expand, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all departments for which a user has access. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param expand May be used to expand the enrollmentAccounts. + ServiceResponse> * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DepartmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName, final String expand, final String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + 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> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the department by id. + * + * @param billingAccountName Billing Account Id. + * @param departmentName Department Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @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(); + } + + /** + * Get the department by id. + * + * @param billingAccountName Billing Account Id. + * @param departmentName Department Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String departmentName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, departmentName), serviceCallback); + } + + /** + * Get the department by id. + * + * @param billingAccountName Billing Account Id. + * @param departmentName Department Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DepartmentInner object + */ + public Observable getAsync(String billingAccountName, String departmentName) { + return getWithServiceResponseAsync(billingAccountName, departmentName).map(new Func1, DepartmentInner>() { + @Override + public DepartmentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the department by id. + * + * @param billingAccountName Billing Account Id. + * @param departmentName Department Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DepartmentInner object + */ + 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); + } + } + }); + } + + /** + * Get the department by id. + * + * @param billingAccountName Billing Account Id. + * @param departmentName Department Id. + * @param expand May be used to expand the enrollmentAccounts. + * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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(); + } + + /** + * Get the department by id. + * + * @param billingAccountName Billing Account Id. + * @param departmentName Department Id. + * @param expand May be used to expand the enrollmentAccounts. + * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param serviceCallback 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); + } + + /** + * Get the department by id. + * + * @param billingAccountName Billing Account Id. + * @param departmentName Department Id. + * @param expand May be used to expand the enrollmentAccounts. + * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @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(); + } + }); + } + + /** + * Get the department by id. + * + * @param billingAccountName Billing Account Id. + * @param departmentName Department Id. + * @param expand May be used to expand the enrollmentAccounts. + * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @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); + } + + /** + * Lists all departments for which a user has access. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DepartmentInner> object if successful. + */ + public PagedList listByBillingAccountNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all departments for which a user has access. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all departments for which a user has access. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DepartmentInner> object + */ + public Observable> listByBillingAccountNameNextAsync(final String nextPageLink) { + return listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all departments for which a user has access. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DepartmentInner> object + */ + public Observable>> listByBillingAccountNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all departments for which a user has access. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DepartmentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingAccountNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DownloadUrlImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DownloadUrlImpl.java new file mode 100644 index 0000000000000..007c3ba57130f --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DownloadUrlInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/DownloadUrlInner.java new file mode 100644 index 0000000000000..c78db9eb17645 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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 at which this download URL will expire. + */ + @JsonProperty(value = "expiryTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime expiryTime; + + /** + * The URL to the PDF file. + */ + @JsonProperty(value = "url", access = JsonProperty.Access.WRITE_ONLY) + private String url; + + /** + * Get the time in UTC at which this download URL will expire. + * + * @return the expiryTime value + */ + public DateTime expiryTime() { + return this.expiryTime; + } + + /** + * Get the URL to the PDF file. + * + * @return the url value + */ + public String url() { + return this.url; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountImpl.java new file mode 100644 index 0000000000000..317801e85d8ea --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.EnrollmentAccount; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountInner.java new file mode 100644 index 0000000000000..8181721d56581 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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 account resource. + */ +@JsonFlatten +public class EnrollmentAccountInner extends ProxyResource { + /** + * The account name. + */ + @JsonProperty(value = "properties.accountName") + private String accountName; + + /** + * The cost center name. + */ + @JsonProperty(value = "properties.costCenter") + private String costCenter; + + /** + * The account owner. + */ + @JsonProperty(value = "properties.accountOwner") + private String accountOwner; + + /** + * The status for account. + */ + @JsonProperty(value = "properties.status") + private String status; + + /** + * Account Start Date. + */ + @JsonProperty(value = "properties.startDate") + private DateTime startDate; + + /** + * Account End Date. + */ + @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 account name. + * + * @return the accountName value + */ + public String accountName() { + return this.accountName; + } + + /** + * Set the account name. + * + * @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 name. + * + * @return the costCenter value + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Set the cost center name. + * + * @param costCenter the costCenter value to set + * @return the EnrollmentAccountInner object itself. + */ + public EnrollmentAccountInner withCostCenter(String costCenter) { + this.costCenter = costCenter; + return this; + } + + /** + * Get the account owner. + * + * @return the accountOwner value + */ + public String accountOwner() { + return this.accountOwner; + } + + /** + * Set the account owner. + * + * @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 for account. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set the status for account. + * + * @param status the status value to set + * @return the EnrollmentAccountInner object itself. + */ + public EnrollmentAccountInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get account Start Date. + * + * @return the startDate value + */ + public DateTime startDate() { + return this.startDate; + } + + /** + * Set account Start Date. + * + * @param startDate the startDate value to set + * @return the EnrollmentAccountInner object itself. + */ + public EnrollmentAccountInner withStartDate(DateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get account End Date. + * + * @return the endDate value + */ + public DateTime endDate() { + return this.endDate; + } + + /** + * Set account End Date. + * + * @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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountsImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountsImpl.java new file mode 100644 index 0000000000000..ed73fc68f1f3e --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountsImpl.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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.EnrollmentAccounts; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2018_11_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(final String billingAccountName) { + EnrollmentAccountsInner client = this.inner(); + return client.listByBillingAccountNameAsync(billingAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public EnrollmentAccount call(EnrollmentAccountInner inner) { + return wrapModel(inner); + } + }); + } + + @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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountsInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountsInner.java new file mode 100644 index 0000000000000..c230b01b5a694 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/EnrollmentAccountsInner.java @@ -0,0 +1,583 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in EnrollmentAccounts. + */ +public class EnrollmentAccountsInner { + /** The Retrofit service to perform REST calls. */ + private EnrollmentAccountsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of EnrollmentAccountsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public EnrollmentAccountsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(EnrollmentAccountsService.class); + this.client = client; + } + + /** + * The interface defining all the services for EnrollmentAccounts to be + * used by Retrofit to perform actually REST calls. + */ + interface EnrollmentAccountsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.EnrollmentAccounts listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.EnrollmentAccounts getByEnrollmentAccountId" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}") + Observable> getByEnrollmentAccountId(@Path("billingAccountName") String billingAccountName, @Path("enrollmentAccountName") String enrollmentAccountName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.EnrollmentAccounts listByBillingAccountNameNext" }) + @GET + Observable> listByBillingAccountNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all Enrollment Accounts for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<EnrollmentAccountInner> object if successful. + */ + public PagedList listByBillingAccountName(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all Enrollment Accounts for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all Enrollment Accounts for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EnrollmentAccountInner> object + */ + public Observable> listByBillingAccountNameAsync(final String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Enrollment Accounts for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EnrollmentAccountInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountNameSinglePageAsync(billingAccountName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Enrollment Accounts for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EnrollmentAccountInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName) { + 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> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all Enrollment Accounts for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the department. + * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<EnrollmentAccountInner> object if successful. + */ + public PagedList listByBillingAccountName(final String billingAccountName, final String expand, final String filter) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName, expand, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all Enrollment Accounts for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the department. + * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final String expand, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName, expand, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all Enrollment Accounts for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the department. + * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EnrollmentAccountInner> object + */ + public Observable> listByBillingAccountNameAsync(final String billingAccountName, final String expand, final String filter) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Enrollment Accounts for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the department. + * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EnrollmentAccountInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName, final String expand, final String filter) { + return listByBillingAccountNameSinglePageAsync(billingAccountName, expand, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Enrollment Accounts for which a user has access. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param expand May be used to expand the department. + ServiceResponse> * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EnrollmentAccountInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName, final String expand, final String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + 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> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the enrollment account by id. + * + * @param billingAccountName Billing Account Id. + * @param enrollmentAccountName Enrollment Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @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(); + } + + /** + * Get the enrollment account by id. + * + * @param billingAccountName Billing Account Id. + * @param enrollmentAccountName Enrollment Account Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByEnrollmentAccountIdAsync(String billingAccountName, String enrollmentAccountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByEnrollmentAccountIdWithServiceResponseAsync(billingAccountName, enrollmentAccountName), serviceCallback); + } + + /** + * Get the enrollment account by id. + * + * @param billingAccountName Billing Account Id. + * @param enrollmentAccountName Enrollment Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EnrollmentAccountInner object + */ + public Observable getByEnrollmentAccountIdAsync(String billingAccountName, String enrollmentAccountName) { + return getByEnrollmentAccountIdWithServiceResponseAsync(billingAccountName, enrollmentAccountName).map(new Func1, EnrollmentAccountInner>() { + @Override + public EnrollmentAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the enrollment account by id. + * + * @param billingAccountName Billing Account Id. + * @param enrollmentAccountName Enrollment Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the EnrollmentAccountInner object + */ + 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); + } + } + }); + } + + /** + * Get the enrollment account by id. + * + * @param billingAccountName Billing Account Id. + * @param enrollmentAccountName Enrollment Account Id. + * @param expand May be used to expand the Department. + * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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(); + } + + /** + * Get the enrollment account by id. + * + * @param billingAccountName Billing Account Id. + * @param enrollmentAccountName Enrollment Account Id. + * @param expand May be used to expand the Department. + * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param serviceCallback 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); + } + + /** + * Get the enrollment account by id. + * + * @param billingAccountName Billing Account Id. + * @param enrollmentAccountName Enrollment Account Id. + * @param expand May be used to expand the Department. + * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @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(); + } + }); + } + + /** + * Get the enrollment account by id. + * + * @param billingAccountName Billing Account Id. + * @param enrollmentAccountName Enrollment Account Id. + * @param expand May be used to expand the Department. + * @param filter The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @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); + } + + /** + * Lists all Enrollment Accounts for which a user has access. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<EnrollmentAccountInner> object if successful. + */ + public PagedList listByBillingAccountNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all Enrollment Accounts for which a user has access. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all Enrollment Accounts for which a user has access. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EnrollmentAccountInner> object + */ + public Observable> listByBillingAccountNameNextAsync(final String nextPageLink) { + return listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all Enrollment Accounts for which a user has access. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<EnrollmentAccountInner> object + */ + public Observable>> listByBillingAccountNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all Enrollment Accounts for which a user has access. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<EnrollmentAccountInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingAccountNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/IdParsingUtils.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..359a206ea3f29 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionImpl.java new file mode 100644 index 0000000000000..810439f62186f --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionImpl.java @@ -0,0 +1,115 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSection; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import java.util.ArrayList; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingProfile; + +class InvoiceSectionImpl extends CreatableUpdatableImpl implements InvoiceSection, InvoiceSection.Update { + private final BillingManager manager; + private String billingAccountName; + private String invoiceSectionName; + + 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.invoiceSectionName = IdParsingUtils.getValueFromIdByName(inner.id(), "invoiceSections"); + // + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + InvoiceSectionsInner client = this.manager().inner().invoiceSections(); + return null; // NOP createResourceAsync implementation as create is not supported + } + + @Override + public Observable updateResourceAsync() { + InvoiceSectionsInner client = this.manager().inner().invoiceSections(); + return client.updateAsync(this.billingAccountName, this.invoiceSectionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + InvoiceSectionsInner client = this.manager().inner().invoiceSections(); + return client.getAsync(this.billingAccountName, this.invoiceSectionName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @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 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 withBillingProfiles(List billingProfiles) { + this.inner().withBillingProfiles(billingProfiles); + return this; + } + + @Override + public InvoiceSectionImpl withDisplayName(String displayName) { + this.inner().withDisplayName(displayName); + return this; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionInner.java new file mode 100644 index 0000000000000..794627b3674fb --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionInner.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.v2018_11_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An InvoiceSection resource. + */ +@JsonFlatten +public class InvoiceSectionInner extends ProxyResource { + /** + * The name of the InvoiceSection. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * The billing profiles associated to the billing account. + */ + @JsonProperty(value = "properties.billingProfiles") + private List billingProfiles; + + /** + * Get the name of the InvoiceSection. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the name of the InvoiceSection. + * + * @param displayName the displayName value to set + * @return the InvoiceSectionInner object itself. + */ + public InvoiceSectionInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the billing profiles associated to the billing account. + * + * @return the billingProfiles value + */ + public List billingProfiles() { + return this.billingProfiles; + } + + /** + * Set the billing profiles associated to the billing account. + * + * @param billingProfiles the billingProfiles value to set + * @return the InvoiceSectionInner object itself. + */ + public InvoiceSectionInner withBillingProfiles(List billingProfiles) { + this.billingProfiles = billingProfiles; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionListResultImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionListResultImpl.java new file mode 100644 index 0000000000000..a5269a83d7bfa --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionListResultInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionListResultInner.java new file mode 100644 index 0000000000000..182a26dcd3cc3 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of listing 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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionsImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionsImpl.java new file mode 100644 index 0000000000000..09288bbeb8503 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionsImpl.java @@ -0,0 +1,120 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSections; +import rx.Observable; +import rx.functions.Func1; +import rx.Completable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSectionListResult; +import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSection; +import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSectionCreationRequest; + +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; + } + + private InvoiceSectionImpl wrapModel(InvoiceSectionInner inner) { + return new InvoiceSectionImpl(inner, manager()); + } + + @Override + public Observable listByBillingAccountNameAsync(String billingAccountName) { + InvoiceSectionsInner client = this.inner(); + return client.listByBillingAccountNameAsync(billingAccountName) + .map(new Func1() { + @Override + public InvoiceSectionListResult call(InvoiceSectionListResultInner inner) { + return new InvoiceSectionListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName) { + InvoiceSectionsInner client = this.inner(); + return client.listByBillingProfileNameAsync(billingAccountName, billingProfileName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public InvoiceSection call(InvoiceSectionInner inner) { + return new InvoiceSectionImpl(inner, manager()); + } + }); + } + + @Override + public Completable elevateToBillingProfileAsync(String billingAccountName, String invoiceSectionName) { + InvoiceSectionsInner client = this.inner(); + return client.elevateToBillingProfileAsync(billingAccountName, invoiceSectionName).toCompletable(); + } + + @Override + public Observable getAsync(String billingAccountName, String invoiceSectionName) { + InvoiceSectionsInner client = this.inner(); + return client.getAsync(billingAccountName, invoiceSectionName) + .flatMap(new Func1>() { + @Override + public Observable call(InvoiceSectionInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((InvoiceSection)wrapModel(inner)); + } + } + }); + } + + @Override + public Observable createAsync(String billingAccountName, InvoiceSectionCreationRequest parameters) { + InvoiceSectionsInner client = this.inner(); + return client.createAsync(billingAccountName, parameters) + .map(new Func1() { + @Override + public InvoiceSection call(InvoiceSectionInner inner) { + return new InvoiceSectionImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByCreateSubscriptionPermissionAsync(final String billingAccountName) { + InvoiceSectionsInner client = this.inner(); + return client.listByCreateSubscriptionPermissionAsync(billingAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public InvoiceSection call(InvoiceSectionInner inner) { + return new InvoiceSectionImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionsInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionsInner.java new file mode 100644 index 0000000000000..2f2981e251146 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSectionsInner.java @@ -0,0 +1,1390 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSectionCreationRequest; +import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSectionsCreateHeaders; +import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSectionsUpdateHeaders; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * 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.v2018_11_01_preview.InvoiceSections listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSections create" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections") + Observable> create(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Body InvoiceSectionCreationRequest parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSections beginCreate" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections") + Observable> beginCreate(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Body InvoiceSectionCreationRequest parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSections listByBillingProfileName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections") + Observable> listByBillingProfileName(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSections listByCreateSubscriptionPermission" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/listInvoiceSectionsWithCreateSubscriptionPermission") + Observable> listByCreateSubscriptionPermission(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSections get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSections update" }) + @PUT("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}") + Observable> update(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Body InvoiceSectionInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSections beginUpdate" }) + @PUT("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}") + Observable> beginUpdate(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Body InvoiceSectionInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSections elevateToBillingProfile" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/elevate") + Observable> elevateToBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSections listByBillingProfileNameNext" }) + @GET + Observable> listByBillingProfileNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSections listByCreateSubscriptionPermissionNext" }) + @GET + Observable> listByCreateSubscriptionPermissionNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all invoice sections for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InvoiceSectionListResultInner object if successful. + */ + public InvoiceSectionListResultInner listByBillingAccountName(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).toBlocking().single().body(); + } + + /** + * Lists all invoice sections for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByBillingAccountNameAsync(String billingAccountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName), serviceCallback); + } + + /** + * Lists all invoice sections for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSectionListResultInner object + */ + public Observable listByBillingAccountNameAsync(String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName).map(new Func1, InvoiceSectionListResultInner>() { + @Override + public InvoiceSectionListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all invoice sections for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSectionListResultInner object + */ + public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all invoice sections for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the billingProfiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InvoiceSectionListResultInner object if successful. + */ + public InvoiceSectionListResultInner listByBillingAccountName(String billingAccountName, String expand) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand).toBlocking().single().body(); + } + + /** + * Lists all invoice sections for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the billingProfiles. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listByBillingAccountNameAsync(String billingAccountName, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand), serviceCallback); + } + + /** + * Lists all invoice sections for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the billingProfiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSectionListResultInner object + */ + public Observable listByBillingAccountNameAsync(String billingAccountName, String expand) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, expand).map(new Func1, InvoiceSectionListResultInner>() { + @Override + public InvoiceSectionListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists all invoice sections for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the billingProfiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSectionListResultInner object + */ + public Observable> listByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String expand) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The operation to create a InvoiceSection. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the Create InvoiceSection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @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, InvoiceSectionCreationRequest parameters) { + return createWithServiceResponseAsync(billingAccountName, parameters).toBlocking().last().body(); + } + + /** + * The operation to create a InvoiceSection. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the Create InvoiceSection operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createAsync(String billingAccountName, InvoiceSectionCreationRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(createWithServiceResponseAsync(billingAccountName, parameters), serviceCallback); + } + + /** + * The operation to create a InvoiceSection. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the Create InvoiceSection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createAsync(String billingAccountName, InvoiceSectionCreationRequest parameters) { + return createWithServiceResponseAsync(billingAccountName, parameters).map(new Func1, InvoiceSectionInner>() { + @Override + public InvoiceSectionInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * The operation to create a InvoiceSection. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the Create InvoiceSection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createWithServiceResponseAsync(String billingAccountName, InvoiceSectionCreationRequest 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.create(billingAccountName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new TypeToken() { }.getType(), InvoiceSectionsCreateHeaders.class); + } + + /** + * The operation to create a InvoiceSection. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the Create InvoiceSection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @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, InvoiceSectionCreationRequest parameters) { + return beginCreateWithServiceResponseAsync(billingAccountName, parameters).toBlocking().single().body(); + } + + /** + * The operation to create a InvoiceSection. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the Create InvoiceSection operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateAsync(String billingAccountName, InvoiceSectionCreationRequest parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginCreateWithServiceResponseAsync(billingAccountName, parameters), serviceCallback); + } + + /** + * The operation to create a InvoiceSection. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the Create InvoiceSection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSectionInner object + */ + public Observable beginCreateAsync(String billingAccountName, InvoiceSectionCreationRequest parameters) { + return beginCreateWithServiceResponseAsync(billingAccountName, parameters).map(new Func1, InvoiceSectionInner>() { + @Override + public InvoiceSectionInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * The operation to create a InvoiceSection. + * + * @param billingAccountName Billing Account Id. + * @param parameters Parameters supplied to the Create InvoiceSection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSectionInner object + */ + public Observable> beginCreateWithServiceResponseAsync(String billingAccountName, InvoiceSectionCreationRequest 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.beginCreate(billingAccountName, 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, InvoiceSectionsCreateHeaders.class); + } + + /** + * Lists all invoice sections under a billing profile for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<InvoiceSectionInner> object if successful. + */ + public PagedList listByBillingProfileName(final String billingAccountName, final String billingProfileName) { + ServiceResponse> response = listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all invoice sections under a billing profile for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all invoice sections under a billing profile for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSectionInner> object + */ + public Observable> listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all invoice sections under a billing profile for which a user has access. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSectionInner> object + */ + public Observable>> listByBillingProfileNameWithServiceResponseAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all invoice sections under a billing profile for which a user has access. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceSectionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNameSinglePageAsync(final String billingAccountName, final String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingProfileName(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<InvoiceSectionInner> object if successful. + */ + public PagedList listByCreateSubscriptionPermission(final String billingAccountName) { + ServiceResponse> response = listByCreateSubscriptionPermissionSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @param billingAccountName Billing Account Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByCreateSubscriptionPermissionAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCreateSubscriptionPermissionSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSectionInner> object + */ + public Observable> listByCreateSubscriptionPermissionAsync(final String billingAccountName) { + return listByCreateSubscriptionPermissionWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSectionInner> object + */ + public Observable>> listByCreateSubscriptionPermissionWithServiceResponseAsync(final String billingAccountName) { + return listByCreateSubscriptionPermissionSinglePageAsync(billingAccountName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByCreateSubscriptionPermissionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceSectionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCreateSubscriptionPermissionSinglePageAsync(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 expand = null; + return service.listByCreateSubscriptionPermission(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCreateSubscriptionPermissionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the billingProfiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<InvoiceSectionInner> object if successful. + */ + public PagedList listByCreateSubscriptionPermission(final String billingAccountName, final String expand) { + ServiceResponse> response = listByCreateSubscriptionPermissionSinglePageAsync(billingAccountName, expand).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the billingProfiles. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByCreateSubscriptionPermissionAsync(final String billingAccountName, final String expand, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCreateSubscriptionPermissionSinglePageAsync(billingAccountName, expand), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the billingProfiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSectionInner> object + */ + public Observable> listByCreateSubscriptionPermissionAsync(final String billingAccountName, final String expand) { + return listByCreateSubscriptionPermissionWithServiceResponseAsync(billingAccountName, expand) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @param billingAccountName Billing Account Id. + * @param expand May be used to expand the billingProfiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSectionInner> object + */ + public Observable>> listByCreateSubscriptionPermissionWithServiceResponseAsync(final String billingAccountName, final String expand) { + return listByCreateSubscriptionPermissionSinglePageAsync(billingAccountName, expand) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByCreateSubscriptionPermissionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param expand May be used to expand the billingProfiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceSectionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCreateSubscriptionPermissionSinglePageAsync(final String billingAccountName, final String expand) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByCreateSubscriptionPermission(billingAccountName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCreateSubscriptionPermissionDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByCreateSubscriptionPermissionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get the InvoiceSection by id. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InvoiceSectionInner object if successful. + */ + public InvoiceSectionInner get(String billingAccountName, String invoiceSectionName) { + return getWithServiceResponseAsync(billingAccountName, invoiceSectionName).toBlocking().single().body(); + } + + /** + * Get the InvoiceSection by id. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String invoiceSectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, invoiceSectionName), serviceCallback); + } + + /** + * Get the InvoiceSection by id. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSectionInner object + */ + public Observable getAsync(String billingAccountName, String invoiceSectionName) { + return getWithServiceResponseAsync(billingAccountName, invoiceSectionName).map(new Func1, InvoiceSectionInner>() { + @Override + public InvoiceSectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the InvoiceSection by id. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSectionInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String invoiceSectionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + return service.get(billingAccountName, invoiceSectionName, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get the InvoiceSection by id. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param expand May be used to expand the billingProfiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 invoiceSectionName, String expand) { + return getWithServiceResponseAsync(billingAccountName, invoiceSectionName, expand).toBlocking().single().body(); + } + + /** + * Get the InvoiceSection by id. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param expand May be used to expand the billingProfiles. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String invoiceSectionName, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, invoiceSectionName, expand), serviceCallback); + } + + /** + * Get the InvoiceSection by id. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param expand May be used to expand the billingProfiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSectionInner object + */ + public Observable getAsync(String billingAccountName, String invoiceSectionName, String expand) { + return getWithServiceResponseAsync(billingAccountName, invoiceSectionName, expand).map(new Func1, InvoiceSectionInner>() { + @Override + public InvoiceSectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the InvoiceSection by id. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param expand May be used to expand the billingProfiles. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSectionInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String expand) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(billingAccountName, invoiceSectionName, 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); + } + + /** + * The operation to update a InvoiceSection. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param parameters Parameters supplied to the Create InvoiceSection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 invoiceSectionName, InvoiceSectionInner parameters) { + return updateWithServiceResponseAsync(billingAccountName, invoiceSectionName, parameters).toBlocking().last().body(); + } + + /** + * The operation to update a InvoiceSection. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param parameters Parameters supplied to the Create InvoiceSection operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String billingAccountName, String invoiceSectionName, InvoiceSectionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(updateWithServiceResponseAsync(billingAccountName, invoiceSectionName, parameters), serviceCallback); + } + + /** + * The operation to update a InvoiceSection. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param parameters Parameters supplied to the Create InvoiceSection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String billingAccountName, String invoiceSectionName, InvoiceSectionInner parameters) { + return updateWithServiceResponseAsync(billingAccountName, invoiceSectionName, parameters).map(new Func1, InvoiceSectionInner>() { + @Override + public InvoiceSectionInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * The operation to update a InvoiceSection. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param parameters Parameters supplied to the Create InvoiceSection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, InvoiceSectionInner parameters) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (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, invoiceSectionName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultWithHeadersAsync(observable, new TypeToken() { }.getType(), InvoiceSectionsUpdateHeaders.class); + } + + /** + * The operation to update a InvoiceSection. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param parameters Parameters supplied to the Create InvoiceSection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 invoiceSectionName, InvoiceSectionInner parameters) { + return beginUpdateWithServiceResponseAsync(billingAccountName, invoiceSectionName, parameters).toBlocking().single().body(); + } + + /** + * The operation to update a InvoiceSection. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param parameters Parameters supplied to the Create InvoiceSection operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateAsync(String billingAccountName, String invoiceSectionName, InvoiceSectionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginUpdateWithServiceResponseAsync(billingAccountName, invoiceSectionName, parameters), serviceCallback); + } + + /** + * The operation to update a InvoiceSection. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param parameters Parameters supplied to the Create InvoiceSection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSectionInner object + */ + public Observable beginUpdateAsync(String billingAccountName, String invoiceSectionName, InvoiceSectionInner parameters) { + return beginUpdateWithServiceResponseAsync(billingAccountName, invoiceSectionName, parameters).map(new Func1, InvoiceSectionInner>() { + @Override + public InvoiceSectionInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * The operation to update a InvoiceSection. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param parameters Parameters supplied to the Create InvoiceSection operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSectionInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, InvoiceSectionInner parameters) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (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, invoiceSectionName, 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, InvoiceSectionsUpdateHeaders.class); + } + + /** + * Elevates the caller's access to match their billing profile access. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 invoiceSectionName) { + elevateToBillingProfileWithServiceResponseAsync(billingAccountName, invoiceSectionName).toBlocking().single().body(); + } + + /** + * Elevates the caller's access to match their billing profile access. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture elevateToBillingProfileAsync(String billingAccountName, String invoiceSectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(elevateToBillingProfileWithServiceResponseAsync(billingAccountName, invoiceSectionName), serviceCallback); + } + + /** + * Elevates the caller's access to match their billing profile access. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable elevateToBillingProfileAsync(String billingAccountName, String invoiceSectionName) { + return elevateToBillingProfileWithServiceResponseAsync(billingAccountName, invoiceSectionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Elevates the caller's access to match their billing profile access. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> elevateToBillingProfileWithServiceResponseAsync(String billingAccountName, String invoiceSectionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + return service.elevateToBillingProfile(billingAccountName, 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); + } + + /** + * Lists all invoice sections under a billing profile for which a user has access. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<InvoiceSectionInner> object if successful. + */ + public PagedList listByBillingProfileNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingProfileNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all invoice sections under a billing profile for which a user has access. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingProfileNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all invoice sections under a billing profile for which a user has access. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSectionInner> object + */ + public Observable> listByBillingProfileNameNextAsync(final String nextPageLink) { + return listByBillingProfileNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all invoice sections under a billing profile for which a user has access. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSectionInner> object + */ + public Observable>> listByBillingProfileNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all invoice sections under a billing profile for which a user has access. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceSectionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNameNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingProfileNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<InvoiceSectionInner> object if successful. + */ + public PagedList listByCreateSubscriptionPermissionNext(final String nextPageLink) { + ServiceResponse> response = listByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByCreateSubscriptionPermissionNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSectionInner> object + */ + public Observable> listByCreateSubscriptionPermissionNextAsync(final String nextPageLink) { + return listByCreateSubscriptionPermissionNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSectionInner> object + */ + public Observable>> listByCreateSubscriptionPermissionNextWithServiceResponseAsync(final String nextPageLink) { + return listByCreateSubscriptionPermissionNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByCreateSubscriptionPermissionNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all invoiceSections with create subscription permission for a user. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceSectionInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCreateSubscriptionPermissionNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByCreateSubscriptionPermissionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCreateSubscriptionPermissionNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByCreateSubscriptionPermissionNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSummaryImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSummaryImpl.java new file mode 100644 index 0000000000000..267283ce7c856 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSummaryImpl.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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSummary; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Amount; +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_01_preview.DownloadProperties; +import org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2018_11_01_preview.PaymentProperties; + +class InvoiceSummaryImpl extends WrapperImpl implements InvoiceSummary { + private final BillingManager manager; + + InvoiceSummaryImpl(InvoiceSummaryInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + + + @Override + public Amount amountDue() { + return this.inner().amountDue(); + } + + @Override + public Amount billedAmount() { + return this.inner().billedAmount(); + } + + @Override + public String billingProfileId() { + return this.inner().billingProfileId(); + } + + @Override + public String billingProfileName() { + return this.inner().billingProfileName(); + } + + @Override + public List documentUrls() { + return this.inner().documentUrls(); + } + + @Override + public DateTime dueDate() { + return this.inner().dueDate(); + } + + @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 String name() { + return this.inner().name(); + } + + @Override + public List payments() { + return this.inner().payments(); + } + + @Override + public String purchaseOrderNumber() { + return this.inner().purchaseOrderNumber(); + } + + @Override + public String status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSummaryInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSummaryInner.java new file mode 100644 index 0000000000000..a8cf957b2c568 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoiceSummaryInner.java @@ -0,0 +1,207 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Amount; +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_01_preview.DownloadProperties; +import com.microsoft.azure.management.billing.v2018_11_01_preview.PaymentProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An invoice resource. + */ +@JsonFlatten +public class InvoiceSummaryInner extends ProxyResource { + /** + * The due date for invoice. + */ + @JsonProperty(value = "properties.dueDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime dueDate; + + /** + * The date when invoice was created. + */ + @JsonProperty(value = "properties.invoiceDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime invoiceDate; + + /** + * Invoice status. Possible values include: 'PastDue', 'Due', 'Paid', + * 'Void'. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * Amount due. + */ + @JsonProperty(value = "properties.amountDue", access = JsonProperty.Access.WRITE_ONLY) + private Amount amountDue; + + /** + * Amount billed. + */ + @JsonProperty(value = "properties.billedAmount", access = JsonProperty.Access.WRITE_ONLY) + private Amount billedAmount; + + /** + * The start date of the billing period. + */ + @JsonProperty(value = "properties.invoicePeriodStartDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime invoicePeriodStartDate; + + /** + * The end date of the billing period. + */ + @JsonProperty(value = "properties.invoicePeriodEndDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime invoicePeriodEndDate; + + /** + * The billing profile id this invoice belongs to. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /** + * The profile name this invoice belongs to. + */ + @JsonProperty(value = "properties.billingProfileName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileName; + + /** + * The purchase identifier for the invoice. + */ + @JsonProperty(value = "properties.purchaseOrderNumber", access = JsonProperty.Access.WRITE_ONLY) + private String purchaseOrderNumber; + + /** + * List of document urls available to download including invoice and tax + * documents. + */ + @JsonProperty(value = "properties.documentUrls", access = JsonProperty.Access.WRITE_ONLY) + private List documentUrls; + + /** + * List of payments. + */ + @JsonProperty(value = "properties.payments", access = JsonProperty.Access.WRITE_ONLY) + private List payments; + + /** + * Get the due date for invoice. + * + * @return the dueDate value + */ + public DateTime dueDate() { + return this.dueDate; + } + + /** + * Get the date when invoice was created. + * + * @return the invoiceDate value + */ + public DateTime invoiceDate() { + return this.invoiceDate; + } + + /** + * Get invoice status. Possible values include: 'PastDue', 'Due', 'Paid', 'Void'. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Get amount due. + * + * @return the amountDue value + */ + public Amount amountDue() { + return this.amountDue; + } + + /** + * Get amount billed. + * + * @return the billedAmount value + */ + public Amount billedAmount() { + return this.billedAmount; + } + + /** + * Get the start date of the billing period. + * + * @return the invoicePeriodStartDate value + */ + public DateTime invoicePeriodStartDate() { + return this.invoicePeriodStartDate; + } + + /** + * Get the end date of the billing period. + * + * @return the invoicePeriodEndDate value + */ + public DateTime invoicePeriodEndDate() { + return this.invoicePeriodEndDate; + } + + /** + * Get the billing profile id this invoice belongs to. + * + * @return the billingProfileId value + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the profile name this invoice belongs to. + * + * @return the billingProfileName value + */ + public String billingProfileName() { + return this.billingProfileName; + } + + /** + * Get the purchase identifier for the invoice. + * + * @return the purchaseOrderNumber value + */ + public String purchaseOrderNumber() { + return this.purchaseOrderNumber; + } + + /** + * Get list of document urls available to download including invoice and tax documents. + * + * @return the documentUrls value + */ + public List documentUrls() { + return this.documentUrls; + } + + /** + * Get list of payments. + * + * @return the payments value + */ + public List payments() { + return this.payments; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoicesImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoicesImpl.java new file mode 100644 index 0000000000000..f738d5482ad06 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoicesImpl.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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Invoices; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2018_11_01_preview.InvoiceSummary; + +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 InvoiceSummaryImpl wrapModel(InvoiceSummaryInner inner) { + return new InvoiceSummaryImpl(inner, manager()); + } + + @Override + public Observable listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final String periodStartDate, final String periodEndDate) { + InvoicesInner client = this.inner(); + return client.listByBillingProfileAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public InvoiceSummary call(InvoiceSummaryInner inner) { + return new InvoiceSummaryImpl(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 InvoiceSummary call(InvoiceSummaryInner inner) { + return new InvoiceSummaryImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingAccountNameAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate) { + InvoicesInner client = this.inner(); + return client.listByBillingAccountNameAsync(billingAccountName, periodStartDate, periodEndDate) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public InvoiceSummary call(InvoiceSummaryInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoicesInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoicesInner.java new file mode 100644 index 0000000000000..3496d50557cf2 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/InvoicesInner.java @@ -0,0 +1,658 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in 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.v2018_11_01_preview.Invoices listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("periodStartDate") String periodStartDate, @Query("periodEndDate") String periodEndDate, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Invoices listByBillingProfile" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices") + Observable> listByBillingProfile(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Query("periodStartDate") String periodStartDate, @Query("periodEndDate") String periodEndDate, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Invoices get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Path("invoiceName") String invoiceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Invoices listByBillingAccountNameNext" }) + @GET + Observable> listByBillingAccountNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Invoices listByBillingProfileNext" }) + @GET + Observable> listByBillingProfileNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List of invoices for a billing account. + * + * @param billingAccountName Billing Account Id. + * @param 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<InvoiceSummaryInner> object if successful. + */ + public PagedList listByBillingAccountName(final String billingAccountName, final String periodStartDate, final String periodEndDate) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName, periodStartDate, periodEndDate).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List of invoices for a billing account. + * + * @param billingAccountName Billing Account Id. + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName, periodStartDate, periodEndDate), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List of invoices for a billing account. + * + * @param billingAccountName Billing Account Id. + * @param 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<InvoiceSummaryInner> object + */ + public Observable> listByBillingAccountNameAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, periodStartDate, periodEndDate) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List of invoices for a billing account. + * + * @param billingAccountName Billing Account Id. + * @param 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<InvoiceSummaryInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate) { + return listByBillingAccountNameSinglePageAsync(billingAccountName, periodStartDate, periodEndDate) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List of invoices for a billing account. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param periodStartDate Invoice period start date. + ServiceResponse> * @param periodEndDate Invoice period end date. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName, final String periodStartDate, final String periodEndDate) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (periodStartDate == null) { + throw new IllegalArgumentException("Parameter periodStartDate is required and cannot be null."); + } + if (periodEndDate == null) { + throw new IllegalArgumentException("Parameter periodEndDate is required and cannot be null."); + } + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), periodStartDate, periodEndDate, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * List of invoices for a billing profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<InvoiceSummaryInner> object if successful. + */ + public PagedList listByBillingProfile(final String billingAccountName, final String billingProfileName, final String periodStartDate, final String periodEndDate) { + ServiceResponse> response = listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List of invoices for a billing profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final String periodStartDate, final String periodEndDate, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List of invoices for a billing profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSummaryInner> object + */ + public Observable> listByBillingProfileAsync(final String billingAccountName, final String billingProfileName, final String periodStartDate, final String periodEndDate) { + return listByBillingProfileWithServiceResponseAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List of invoices for a billing profile. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSummaryInner> object + */ + public Observable>> listByBillingProfileWithServiceResponseAsync(final String billingAccountName, final String billingProfileName, final String periodStartDate, final String periodEndDate) { + return listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List of invoices for a billing profile. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param billingProfileName Billing Profile Id. + ServiceResponse> * @param periodStartDate Invoice period start date. + ServiceResponse> * @param periodEndDate Invoice period end date. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileSinglePageAsync(final String billingAccountName, final String billingProfileName, final String periodStartDate, final String periodEndDate) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + 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> 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 invoice by name. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param invoiceName Invoice Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the InvoiceSummaryInner object if successful. + */ + public InvoiceSummaryInner get(String billingAccountName, String billingProfileName, String invoiceName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceName).toBlocking().single().body(); + } + + /** + * Get the invoice by name. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param invoiceName Invoice Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @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); + } + + /** + * Get the invoice by name. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param invoiceName Invoice Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSummaryInner object + */ + public Observable getAsync(String billingAccountName, String billingProfileName, String invoiceName) { + return getWithServiceResponseAsync(billingAccountName, billingProfileName, invoiceName).map(new Func1, InvoiceSummaryInner>() { + @Override + public InvoiceSummaryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the invoice by name. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param invoiceName Invoice Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceSummaryInner 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); + } + + /** + * List of invoices for a billing account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<InvoiceSummaryInner> object if successful. + */ + public PagedList listByBillingAccountNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List of invoices for a billing account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List of invoices for a billing account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSummaryInner> object + */ + public Observable> listByBillingAccountNameNextAsync(final String nextPageLink) { + return listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List of invoices for a billing account. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSummaryInner> object + */ + public Observable>> listByBillingAccountNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List of invoices for a billing account. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingAccountNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * List of invoices for a billing profile. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<InvoiceSummaryInner> object if successful. + */ + public PagedList listByBillingProfileNext(final String nextPageLink) { + ServiceResponse> response = listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List of invoices for a billing profile. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingProfileNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List of invoices for a billing profile. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSummaryInner> object + */ + public Observable> listByBillingProfileNextAsync(final String nextPageLink) { + return listByBillingProfileNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List of invoices for a billing profile. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceSummaryInner> object + */ + public Observable>> listByBillingProfileNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingProfileNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List of invoices for a billing profile. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingProfileNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/LineOfCreditImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/LineOfCreditImpl.java new file mode 100644 index 0000000000000..cc7a58f87a8de --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/LineOfCreditImpl.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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.LineOfCredit; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Amount; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Status; + +class LineOfCreditImpl extends WrapperImpl implements LineOfCredit { + private final BillingManager manager; + LineOfCreditImpl(LineOfCreditInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public Amount creditLimit() { + return this.inner().creditLimit(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String reason() { + return this.inner().reason(); + } + + @Override + public Amount remainingBalance() { + return this.inner().remainingBalance(); + } + + @Override + public Status status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/LineOfCreditInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/LineOfCreditInner.java new file mode 100644 index 0000000000000..7a4295d73dbe6 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/LineOfCreditInner.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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.Amount; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Status; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Line of credit resource. + */ +@JsonFlatten +public class LineOfCreditInner extends ProxyResource { + /** + * The current credit limit. + */ + @JsonProperty(value = "properties.creditLimit") + private Amount creditLimit; + + /** + * The reason for the line of credit status when not approved. + */ + @JsonProperty(value = "properties.reason", access = JsonProperty.Access.WRITE_ONLY) + private String reason; + + /** + * Remaining balance. + */ + @JsonProperty(value = "properties.remainingBalance", access = JsonProperty.Access.WRITE_ONLY) + private Amount remainingBalance; + + /** + * The line of credit status. Possible values include: 'Approved', + * 'Rejected'. + */ + @JsonProperty(value = "properties.status") + private Status status; + + /** + * Get the current credit limit. + * + * @return the creditLimit value + */ + public Amount creditLimit() { + return this.creditLimit; + } + + /** + * Set the current credit limit. + * + * @param creditLimit the creditLimit value to set + * @return the LineOfCreditInner object itself. + */ + public LineOfCreditInner withCreditLimit(Amount creditLimit) { + this.creditLimit = creditLimit; + return this; + } + + /** + * Get the reason for the line of credit status when not approved. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Get remaining balance. + * + * @return the remainingBalance value + */ + public Amount remainingBalance() { + return this.remainingBalance; + } + + /** + * Get the line of credit status. Possible values include: 'Approved', 'Rejected'. + * + * @return the status value + */ + public Status status() { + return this.status; + } + + /** + * Set the line of credit status. Possible values include: 'Approved', 'Rejected'. + * + * @param status the status value to set + * @return the LineOfCreditInner object itself. + */ + public LineOfCreditInner withStatus(Status status) { + this.status = status; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/LineOfCreditsImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/LineOfCreditsImpl.java new file mode 100644 index 0000000000000..759e8d0576db4 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/LineOfCreditsImpl.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.LineOfCredits; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.LineOfCredit; + +class LineOfCreditsImpl extends WrapperImpl implements LineOfCredits { + private final BillingManager manager; + + LineOfCreditsImpl(BillingManager manager) { + super(manager.inner().lineOfCredits()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable getAsync() { + LineOfCreditsInner client = this.inner(); + return client.getAsync() + .map(new Func1() { + @Override + public LineOfCredit call(LineOfCreditInner inner) { + return new LineOfCreditImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateAsync(LineOfCreditInner parameters) { + LineOfCreditsInner client = this.inner(); + return client.updateAsync(parameters) + .map(new Func1() { + @Override + public LineOfCredit call(LineOfCreditInner inner) { + return new LineOfCreditImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/LineOfCreditsInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/LineOfCreditsInner.java new file mode 100644 index 0000000000000..c37d47f82a40d --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/LineOfCreditsInner.java @@ -0,0 +1,289 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.azure.management.billing.v2018_11_01_preview.LineOfCreditsUpdateHeaders; +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.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 LineOfCredits. + */ +public class LineOfCreditsInner { + /** The Retrofit service to perform REST calls. */ + private LineOfCreditsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of LineOfCreditsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LineOfCreditsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(LineOfCreditsService.class); + this.client = client; + } + + /** + * The interface defining all the services for LineOfCredits to be + * used by Retrofit to perform actually REST calls. + */ + interface LineOfCreditsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.LineOfCredits get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingAccounts/default/lineOfCredit/default") + Observable> get(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.LineOfCredits update" }) + @PUT("subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingAccounts/default/lineOfCredit/default") + Observable> update(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body LineOfCreditInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.LineOfCredits beginUpdate" }) + @PUT("subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingAccounts/default/lineOfCredit/default") + Observable> beginUpdate(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body LineOfCreditInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get the current line of credit. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the LineOfCreditInner object if successful. + */ + public LineOfCreditInner get() { + return getWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Get the current line of credit. + * + * @param serviceCallback 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 current line of credit. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LineOfCreditInner object + */ + public Observable getAsync() { + return getWithServiceResponseAsync().map(new Func1, LineOfCreditInner>() { + @Override + public LineOfCreditInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the current line of credit. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LineOfCreditInner 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); + } + + /** + * Increase the current line of credit. + * + * @param parameters Parameters supplied to the increase line of credit 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 LineOfCreditInner object if successful. + */ + public LineOfCreditInner update(LineOfCreditInner parameters) { + return updateWithServiceResponseAsync(parameters).toBlocking().last().body(); + } + + /** + * Increase the current line of credit. + * + * @param parameters Parameters supplied to the increase line of credit 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(LineOfCreditInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(updateWithServiceResponseAsync(parameters), serviceCallback); + } + + /** + * Increase the current line of credit. + * + * @param parameters Parameters supplied to the increase line of credit operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(LineOfCreditInner parameters) { + return updateWithServiceResponseAsync(parameters).map(new Func1, LineOfCreditInner>() { + @Override + public LineOfCreditInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Increase the current line of credit. + * + * @param parameters Parameters supplied to the increase line of credit operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(LineOfCreditInner parameters) { + 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."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.update(this.client.subscriptionId(), this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultWithHeadersAsync(observable, new TypeToken() { }.getType(), LineOfCreditsUpdateHeaders.class); + } + + /** + * Increase the current line of credit. + * + * @param parameters Parameters supplied to the increase line of credit 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 LineOfCreditInner object if successful. + */ + public LineOfCreditInner beginUpdate(LineOfCreditInner parameters) { + return beginUpdateWithServiceResponseAsync(parameters).toBlocking().single().body(); + } + + /** + * Increase the current line of credit. + * + * @param parameters Parameters supplied to the increase line of credit 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(LineOfCreditInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginUpdateWithServiceResponseAsync(parameters), serviceCallback); + } + + /** + * Increase the current line of credit. + * + * @param parameters Parameters supplied to the increase line of credit operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LineOfCreditInner object + */ + public Observable beginUpdateAsync(LineOfCreditInner parameters) { + return beginUpdateWithServiceResponseAsync(parameters).map(new Func1, LineOfCreditInner>() { + @Override + public LineOfCreditInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Increase the current line of credit. + * + * @param parameters Parameters supplied to the increase line of credit operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LineOfCreditInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(LineOfCreditInner parameters) { + 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."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginUpdate(this.client.subscriptionId(), 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, LineOfCreditsUpdateHeaders.class); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/OperationImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/OperationImpl.java new file mode 100644 index 0000000000000..374480ada96e4 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/OperationInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/OperationInner.java new file mode 100644 index 0000000000000..dfbebd495d277 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/OperationsImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..7cce677d78bab --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/OperationsInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/OperationsInner.java new file mode 100644 index 0000000000000..4c1200d94c610 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.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.v2018_11_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.v2018_11_01_preview.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of 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 all of 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 all of 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 all of 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 all of 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 all of 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 all of 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 all of 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 all of 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 all of 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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PageImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PageImpl.java new file mode 100644 index 0000000000000..7d263eca9a4f4 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PaymentMethodImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PaymentMethodImpl.java new file mode 100644 index 0000000000000..99c4123c41466 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PaymentMethodImpl.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.PaymentMethod; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2018_11_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 DateTime 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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PaymentMethodInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PaymentMethodInner.java new file mode 100644 index 0000000000000..200c024978391 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.PaymentMethodType; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A payment method resource. + */ +@JsonFlatten +public class PaymentMethodInner extends ProxyResource { + /** + * Payment method type. 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 date. + */ + @JsonProperty(value = "properties.expiration", access = JsonProperty.Access.WRITE_ONLY) + private DateTime expiration; + + /** + * The currency associated with the payment method. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /** + * Get payment method type. Possible values include: 'Credits', 'ChequeWire'. + * + * @return the paymentMethodType value + */ + public PaymentMethodType paymentMethodType() { + return this.paymentMethodType; + } + + /** + * Set payment method type. 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 date. + * + * @return the expiration value + */ + public DateTime 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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PaymentMethodsImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PaymentMethodsImpl.java new file mode 100644 index 0000000000000..04f9dbf51564c --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.PaymentMethods; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2018_11_01_preview.PaymentMethod; + +class PaymentMethodsImpl extends WrapperImpl implements PaymentMethods { + private final BillingManager manager; + + PaymentMethodsImpl(BillingManager manager) { + super(manager.inner().paymentMethods()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private PaymentMethodImpl wrapModel(PaymentMethodInner inner) { + return new PaymentMethodImpl(inner, manager()); + } + + @Override + public Observable listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName) { + PaymentMethodsInner client = this.inner(); + return client.listByBillingProfileNameAsync(billingAccountName, billingProfileName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PaymentMethod call(PaymentMethodInner inner) { + return new PaymentMethodImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingAccountNameAsync(final String billingAccountName) { + PaymentMethodsInner client = this.inner(); + return client.listByBillingAccountNameAsync(billingAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public PaymentMethod call(PaymentMethodInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PaymentMethodsInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PaymentMethodsInner.java new file mode 100644 index 0000000000000..c46663809ee02 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PaymentMethods. + */ +public class PaymentMethodsInner { + /** The Retrofit service to perform REST calls. */ + private PaymentMethodsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of PaymentMethodsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PaymentMethodsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(PaymentMethodsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PaymentMethods to be + * used by Retrofit to perform actually REST calls. + */ + interface PaymentMethodsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.PaymentMethods listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/paymentMethods") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.PaymentMethods listByBillingProfileName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/paymentMethods") + Observable> listByBillingProfileName(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.PaymentMethods listByBillingAccountNameNext" }) + @GET + Observable> listByBillingAccountNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.PaymentMethods listByBillingProfileNameNext" }) + @GET + Observable> listByBillingProfileNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the Payment Methods by billing account Id. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PaymentMethodInner> object if successful. + */ + public PagedList listByBillingAccountName(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the Payment Methods by billing account Id. + * + * @param billingAccountName Billing Account Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the Payment Methods by billing account Id. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PaymentMethodInner> object + */ + public Observable> listByBillingAccountNameAsync(final String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the Payment Methods by billing account Id. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PaymentMethodInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountNameSinglePageAsync(billingAccountName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the Payment Methods by billing account Id. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PaymentMethodInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the Payment Methods by billing profile Id. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PaymentMethodInner> object if successful. + */ + public PagedList listByBillingProfileName(final String billingAccountName, final String billingProfileName) { + ServiceResponse> response = listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the Payment Methods by billing profile Id. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the Payment Methods by billing profile Id. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PaymentMethodInner> object + */ + public Observable> listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the Payment Methods by billing profile Id. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PaymentMethodInner> object + */ + public Observable>> listByBillingProfileNameWithServiceResponseAsync(final String billingAccountName, final String billingProfileName) { + return listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the Payment Methods by billing profile Id. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PaymentMethodInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNameSinglePageAsync(final String billingAccountName, final String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingProfileName(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the Payment Methods by billing account Id. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PaymentMethodInner> object if successful. + */ + public PagedList listByBillingAccountNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the Payment Methods by billing account 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> listByBillingAccountNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the Payment Methods by billing account Id. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PaymentMethodInner> object + */ + public Observable> listByBillingAccountNameNextAsync(final String nextPageLink) { + return listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the Payment Methods by billing account Id. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PaymentMethodInner> object + */ + public Observable>> listByBillingAccountNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the Payment Methods by billing account Id. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PaymentMethodInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingAccountNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the Payment Methods by billing profile Id. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<PaymentMethodInner> object if successful. + */ + public PagedList listByBillingProfileNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingProfileNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the Payment Methods by billing profile Id. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingProfileNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the Payment Methods by billing profile Id. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PaymentMethodInner> object + */ + public Observable> listByBillingProfileNameNextAsync(final String nextPageLink) { + return listByBillingProfileNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the Payment Methods by billing profile Id. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<PaymentMethodInner> object + */ + public Observable>> listByBillingProfileNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the Payment Methods by billing profile Id. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<PaymentMethodInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNameNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingProfileNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PoliciesImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PoliciesImpl.java new file mode 100644 index 0000000000000..097ff207a4369 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PoliciesImpl.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Policies; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Policy; + +class PoliciesImpl extends WrapperImpl implements Policies { + private final BillingManager manager; + + PoliciesImpl(BillingManager manager) { + super(manager.inner().policies()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable getByBillingProfileNameAsync(String billingAccountName, String billingProfileName) { + PoliciesInner client = this.inner(); + return client.getByBillingProfileNameAsync(billingAccountName, billingProfileName) + .map(new Func1() { + @Override + public Policy call(PolicyInner inner) { + return new PolicyImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateAsync(String billingAccountName, String billingProfileName, PolicyInner parameters) { + PoliciesInner client = this.inner(); + return client.updateAsync(billingAccountName, billingProfileName, parameters) + .map(new Func1() { + @Override + public Policy call(PolicyInner inner) { + return new PolicyImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PoliciesInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PoliciesInner.java new file mode 100644 index 0000000000000..4857dc1299e35 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PoliciesInner.java @@ -0,0 +1,241 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Policies. + */ +public class PoliciesInner { + /** The Retrofit service to perform REST calls. */ + private PoliciesService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of PoliciesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PoliciesInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(PoliciesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Policies to be + * used by Retrofit to perform actually REST calls. + */ + interface PoliciesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Policies getByBillingProfileName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default") + Observable> getByBillingProfileName(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Policies update" }) + @PUT("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default") + Observable> update(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Body PolicyInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * The policy for a given billing account name and billing profile name. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyInner object if successful. + */ + public PolicyInner getByBillingProfileName(String billingAccountName, String billingProfileName) { + return getByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName).toBlocking().single().body(); + } + + /** + * The policy for a given billing account name and billing profile name. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByBillingProfileNameAsync(String billingAccountName, String billingProfileName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName), serviceCallback); + } + + /** + * The policy for a given billing account name and billing profile name. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyInner object + */ + public Observable getByBillingProfileNameAsync(String billingAccountName, String billingProfileName) { + return getByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName).map(new Func1, PolicyInner>() { + @Override + public PolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The policy for a given billing account name and billing profile name. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyInner object + */ + public Observable> getByBillingProfileNameWithServiceResponseAsync(String billingAccountName, String billingProfileName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByBillingProfileName(billingAccountName, billingProfileName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByBillingProfileNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByBillingProfileNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * The operation to update a policy. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param parameters Parameters supplied to the update policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PolicyInner object if successful. + */ + public PolicyInner update(String billingAccountName, String billingProfileName, PolicyInner parameters) { + return updateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).toBlocking().single().body(); + } + + /** + * The operation to update a policy. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param parameters Parameters supplied to the update policy operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String billingAccountName, String billingProfileName, PolicyInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters), serviceCallback); + } + + /** + * The operation to update a policy. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param parameters Parameters supplied to the update policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyInner object + */ + public Observable updateAsync(String billingAccountName, String billingProfileName, PolicyInner parameters) { + return updateWithServiceResponseAsync(billingAccountName, billingProfileName, parameters).map(new Func1, PolicyInner>() { + @Override + public PolicyInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to update a policy. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param parameters Parameters supplied to the update policy operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PolicyInner object + */ + public Observable> updateWithServiceResponseAsync(String billingAccountName, String billingProfileName, PolicyInner parameters) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(billingAccountName, billingProfileName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PolicyImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PolicyImpl.java new file mode 100644 index 0000000000000..075926d7717aa --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PolicyImpl.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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.Policy; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +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 Boolean marketplacePurchasesAllowed() { + return this.inner().marketplacePurchasesAllowed(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Boolean reservationPurchasesAllowed() { + return this.inner().reservationPurchasesAllowed(); + } + + @Override + public Boolean subscriptionOwnerCanViewCharges() { + return this.inner().subscriptionOwnerCanViewCharges(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PolicyInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PolicyInner.java new file mode 100644 index 0000000000000..ba5be88507ad8 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PolicyInner.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.v2018_11_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The Policy. + */ +@JsonFlatten +public class PolicyInner extends ProxyResource { + /** + * The marketplacePurchasesAllowed flag. + */ + @JsonProperty(value = "properties.marketplacePurchasesAllowed") + private Boolean marketplacePurchasesAllowed; + + /** + * The reservationPurchasesAllowed flag. + */ + @JsonProperty(value = "properties.reservationPurchasesAllowed") + private Boolean reservationPurchasesAllowed; + + /** + * The subscriptionOwnerCanViewCharges flag. + */ + @JsonProperty(value = "properties.subscriptionOwnerCanViewCharges") + private Boolean subscriptionOwnerCanViewCharges; + + /** + * Get the marketplacePurchasesAllowed flag. + * + * @return the marketplacePurchasesAllowed value + */ + public Boolean marketplacePurchasesAllowed() { + return this.marketplacePurchasesAllowed; + } + + /** + * Set the marketplacePurchasesAllowed flag. + * + * @param marketplacePurchasesAllowed the marketplacePurchasesAllowed value to set + * @return the PolicyInner object itself. + */ + public PolicyInner withMarketplacePurchasesAllowed(Boolean marketplacePurchasesAllowed) { + this.marketplacePurchasesAllowed = marketplacePurchasesAllowed; + return this; + } + + /** + * Get the reservationPurchasesAllowed flag. + * + * @return the reservationPurchasesAllowed value + */ + public Boolean reservationPurchasesAllowed() { + return this.reservationPurchasesAllowed; + } + + /** + * Set the reservationPurchasesAllowed flag. + * + * @param reservationPurchasesAllowed the reservationPurchasesAllowed value to set + * @return the PolicyInner object itself. + */ + public PolicyInner withReservationPurchasesAllowed(Boolean reservationPurchasesAllowed) { + this.reservationPurchasesAllowed = reservationPurchasesAllowed; + return this; + } + + /** + * Get the subscriptionOwnerCanViewCharges flag. + * + * @return the subscriptionOwnerCanViewCharges value + */ + public Boolean subscriptionOwnerCanViewCharges() { + return this.subscriptionOwnerCanViewCharges; + } + + /** + * Set the subscriptionOwnerCanViewCharges flag. + * + * @param subscriptionOwnerCanViewCharges the subscriptionOwnerCanViewCharges value to set + * @return the PolicyInner object itself. + */ + public PolicyInner withSubscriptionOwnerCanViewCharges(Boolean subscriptionOwnerCanViewCharges) { + this.subscriptionOwnerCanViewCharges = subscriptionOwnerCanViewCharges; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PriceSheetsImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PriceSheetsImpl.java new file mode 100644 index 0000000000000..80050c23d22b5 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PriceSheetsImpl.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.PriceSheets; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.DownloadUrl; + +class PriceSheetsImpl extends WrapperImpl implements PriceSheets { + private final BillingManager manager; + + PriceSheetsImpl(BillingManager manager) { + super(manager.inner().priceSheets()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + @Override + public Observable downloadAsync(String billingAccountName, String invoiceName) { + PriceSheetsInner client = this.inner(); + return client.downloadAsync(billingAccountName, invoiceName) + .map(new Func1() { + @Override + public DownloadUrl call(DownloadUrlInner inner) { + return new DownloadUrlImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PriceSheetsInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PriceSheetsInner.java new file mode 100644 index 0000000000000..4ce6c6dd4bc0a --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/PriceSheetsInner.java @@ -0,0 +1,217 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.azure.management.billing.v2018_11_01_preview.PriceSheetDownloadHeaders; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponseWithHeaders; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.LongRunningFinalState; +import com.microsoft.azure.LongRunningOperationOptions; + +/** + * An instance of this class provides access to all the operations defined + * in PriceSheets. + */ +public class PriceSheetsInner { + /** The Retrofit service to perform REST calls. */ + private PriceSheetsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of PriceSheetsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PriceSheetsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(PriceSheetsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PriceSheets to be + * used by Retrofit to perform actually REST calls. + */ + interface PriceSheetsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.PriceSheets download" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/pricesheet/default/download") + Observable> download(@Path("billingAccountName") String billingAccountName, @Path("invoiceName") String invoiceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.PriceSheets beginDownload" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/pricesheet/default/download") + Observable> beginDownload(@Path("billingAccountName") String billingAccountName, @Path("invoiceName") String invoiceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Download price sheet for an invoice. + * + * @param billingAccountName Azure Billing Account ID. + * @param invoiceName The name of an invoice resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DownloadUrlInner object if successful. + */ + public DownloadUrlInner download(String billingAccountName, String invoiceName) { + return downloadWithServiceResponseAsync(billingAccountName, invoiceName).toBlocking().last().body(); + } + + /** + * Download price sheet for an invoice. + * + * @param billingAccountName Azure Billing Account ID. + * @param invoiceName The name of an invoice resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture downloadAsync(String billingAccountName, String invoiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(downloadWithServiceResponseAsync(billingAccountName, invoiceName), serviceCallback); + } + + /** + * Download price sheet for an invoice. + * + * @param billingAccountName Azure Billing Account ID. + * @param invoiceName The name of an invoice resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable downloadAsync(String billingAccountName, String invoiceName) { + return downloadWithServiceResponseAsync(billingAccountName, invoiceName).map(new Func1, DownloadUrlInner>() { + @Override + public DownloadUrlInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Download price sheet for an invoice. + * + * @param billingAccountName Azure Billing Account ID. + * @param invoiceName The name of an invoice resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> downloadWithServiceResponseAsync(String billingAccountName, String invoiceName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceName == null) { + throw new IllegalArgumentException("Parameter invoiceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.download(billingAccountName, invoiceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultWithHeadersAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken() { }.getType(), PriceSheetDownloadHeaders.class); + } + + /** + * Download price sheet for an invoice. + * + * @param billingAccountName Azure Billing Account ID. + * @param invoiceName The name of an invoice resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DownloadUrlInner object if successful. + */ + public DownloadUrlInner beginDownload(String billingAccountName, String invoiceName) { + return beginDownloadWithServiceResponseAsync(billingAccountName, invoiceName).toBlocking().single().body(); + } + + /** + * Download price sheet for an invoice. + * + * @param billingAccountName Azure Billing Account ID. + * @param invoiceName The name of an invoice resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDownloadAsync(String billingAccountName, String invoiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(beginDownloadWithServiceResponseAsync(billingAccountName, invoiceName), serviceCallback); + } + + /** + * Download price sheet for an invoice. + * + * @param billingAccountName Azure Billing Account ID. + * @param invoiceName The name of an invoice resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DownloadUrlInner object + */ + public Observable beginDownloadAsync(String billingAccountName, String invoiceName) { + return beginDownloadWithServiceResponseAsync(billingAccountName, invoiceName).map(new Func1, DownloadUrlInner>() { + @Override + public DownloadUrlInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Download price sheet for an invoice. + * + * @param billingAccountName Azure Billing Account ID. + * @param invoiceName The name of an invoice resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DownloadUrlInner object + */ + public Observable> beginDownloadWithServiceResponseAsync(String billingAccountName, String invoiceName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceName == null) { + throw new IllegalArgumentException("Parameter invoiceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDownload(billingAccountName, invoiceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = beginDownloadDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders beginDownloadDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .buildWithHeaders(response, PriceSheetDownloadHeaders.class); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductSummaryImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductSummaryImpl.java new file mode 100644 index 0000000000000..5760a724359cb --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductSummaryImpl.java @@ -0,0 +1,139 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.ProductSummary; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingFrequency; +import org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Amount; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ProductStatusType; + +class ProductSummaryImpl extends WrapperImpl implements ProductSummary { + private final BillingManager manager; + + ProductSummaryImpl(ProductSummaryInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + + + @Override + public String availabilityId() { + return this.inner().availabilityId(); + } + + @Override + public BillingFrequency billingFrequency() { + return this.inner().billingFrequency(); + } + + @Override + public String billingProfileId() { + return this.inner().billingProfileId(); + } + + @Override + public String billingProfileName() { + return this.inner().billingProfileName(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public DateTime endDate() { + return this.inner().endDate(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String invoiceSectionId() { + return this.inner().invoiceSectionId(); + } + + @Override + public String invoiceSectionName() { + return this.inner().invoiceSectionName(); + } + + @Override + public Amount lastCharge() { + return this.inner().lastCharge(); + } + + @Override + public DateTime lastChargeDate() { + return this.inner().lastChargeDate(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String parentProductId() { + return this.inner().parentProductId(); + } + + @Override + public String productType() { + return this.inner().productType(); + } + + @Override + public String productTypeId() { + return this.inner().productTypeId(); + } + + @Override + public DateTime purchaseDate() { + return this.inner().purchaseDate(); + } + + @Override + public Double quantity() { + return this.inner().quantity(); + } + + @Override + public String skuDescription() { + return this.inner().skuDescription(); + } + + @Override + public String skuId() { + return this.inner().skuId(); + } + + @Override + public ProductStatusType status() { + return this.inner().status(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductSummaryInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductSummaryInner.java new file mode 100644 index 0000000000000..16eaa6379befe --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductSummaryInner.java @@ -0,0 +1,318 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ProductStatusType; +import com.microsoft.azure.management.billing.v2018_11_01_preview.BillingFrequency; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Amount; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A product summary resource. + */ +@JsonFlatten +public class ProductSummaryInner extends ProxyResource { + /** + * The display name of the product. + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /** + * The date of purchase. + */ + @JsonProperty(value = "properties.purchaseDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime purchaseDate; + + /** + * The product type id. + */ + @JsonProperty(value = "properties.productTypeId", access = JsonProperty.Access.WRITE_ONLY) + private String productTypeId; + + /** + * The type of product. + */ + @JsonProperty(value = "properties.productType", access = JsonProperty.Access.WRITE_ONLY) + private String productType; + + /** + * Product status. Possible values include: 'Active', 'Inactive', + * 'PastDue', 'Expiring', 'Expired', 'Disabled', 'Cancelled', 'AutoRenew'. + */ + @JsonProperty(value = "properties.status") + private ProductStatusType status; + + /** + * end date. + */ + @JsonProperty(value = "properties.endDate", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endDate; + + /** + * Billing frequency. Possible values include: 'OneTime', 'Monthly', + * 'UsageBased'. + */ + @JsonProperty(value = "properties.billingFrequency") + private BillingFrequency billingFrequency; + + /** + * 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 purchased product quantity. + */ + @JsonProperty(value = "properties.quantity", access = JsonProperty.Access.WRITE_ONLY) + private Double quantity; + + /** + * Sku Id. + */ + @JsonProperty(value = "properties.skuId", access = JsonProperty.Access.WRITE_ONLY) + private String skuId; + + /** + * Sku description. + */ + @JsonProperty(value = "properties.skuDescription", access = JsonProperty.Access.WRITE_ONLY) + private String skuDescription; + + /** + * Availability Id. + */ + @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; + + /** + * Invoice section id to which this product belongs. + */ + @JsonProperty(value = "properties.invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /** + * Invoice section name to which this product belongs. + */ + @JsonProperty(value = "properties.invoiceSectionName", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionName; + + /** + * Billing Profile id to which this product belongs. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /** + * Billing Profile name to which this product belongs. + */ + @JsonProperty(value = "properties.billingProfileName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileName; + + /** + * Get the display name of the product. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the date of purchase. + * + * @return the purchaseDate value + */ + public DateTime purchaseDate() { + return this.purchaseDate; + } + + /** + * Get the product type id. + * + * @return the productTypeId value + */ + public String productTypeId() { + return this.productTypeId; + } + + /** + * Get the type of product. + * + * @return the productType value + */ + public String productType() { + return this.productType; + } + + /** + * Get product status. Possible values include: 'Active', 'Inactive', 'PastDue', 'Expiring', 'Expired', 'Disabled', 'Cancelled', 'AutoRenew'. + * + * @return the status value + */ + public ProductStatusType status() { + return this.status; + } + + /** + * Set product status. Possible values include: 'Active', 'Inactive', 'PastDue', 'Expiring', 'Expired', 'Disabled', 'Cancelled', 'AutoRenew'. + * + * @param status the status value to set + * @return the ProductSummaryInner object itself. + */ + public ProductSummaryInner withStatus(ProductStatusType status) { + this.status = status; + return this; + } + + /** + * Get end date. + * + * @return the endDate value + */ + public DateTime endDate() { + return this.endDate; + } + + /** + * Get billing frequency. Possible values include: 'OneTime', 'Monthly', 'UsageBased'. + * + * @return the billingFrequency value + */ + public BillingFrequency billingFrequency() { + return this.billingFrequency; + } + + /** + * Set billing frequency. Possible values include: 'OneTime', 'Monthly', 'UsageBased'. + * + * @param billingFrequency the billingFrequency value to set + * @return the ProductSummaryInner object itself. + */ + public ProductSummaryInner withBillingFrequency(BillingFrequency billingFrequency) { + this.billingFrequency = billingFrequency; + return this; + } + + /** + * Get 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 purchased product quantity. + * + * @return the quantity value + */ + public Double quantity() { + return this.quantity; + } + + /** + * Get sku Id. + * + * @return the skuId value + */ + public String skuId() { + return this.skuId; + } + + /** + * Get sku description. + * + * @return the skuDescription value + */ + public String skuDescription() { + return this.skuDescription; + } + + /** + * Get availability Id. + * + * @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 invoice section id to which this product belongs. + * + * @return the invoiceSectionId value + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get invoice section name to which this product belongs. + * + * @return the invoiceSectionName value + */ + public String invoiceSectionName() { + return this.invoiceSectionName; + } + + /** + * Get billing Profile id to which this product belongs. + * + * @return the billingProfileId value + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get billing Profile name to which this product belongs. + * + * @return the billingProfileName value + */ + public String billingProfileName() { + return this.billingProfileName; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductsImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductsImpl.java new file mode 100644 index 0000000000000..828c68359e958 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductsImpl.java @@ -0,0 +1,134 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Products; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ProductSummary; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ValidateProductTransferEligibilityResult; +import com.microsoft.azure.management.billing.v2018_11_01_preview.UpdateAutoRenewOperationSummary; +import com.microsoft.azure.management.billing.v2018_11_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 ProductSummaryImpl wrapModel(ProductSummaryInner inner) { + return new ProductSummaryImpl(inner, manager()); + } + + @Override + public Observable listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName) { + ProductsInner client = this.inner(); + return client.listByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ProductSummary call(ProductSummaryInner inner) { + return new ProductSummaryImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String invoiceSectionName, String productName) { + ProductsInner client = this.inner(); + return client.getAsync(billingAccountName, invoiceSectionName, productName) + .map(new Func1() { + @Override + public ProductSummary call(ProductSummaryInner inner) { + return new ProductSummaryImpl(inner, manager()); + } + }); + } + + @Override + public Observable transferAsync(String billingAccountName, String invoiceSectionName, String productName, TransferProductRequestProperties parameters) { + ProductsInner client = this.inner(); + return client.transferAsync(billingAccountName, invoiceSectionName, productName, parameters) + .map(new Func1() { + @Override + public ProductSummary call(ProductSummaryInner inner) { + return new ProductSummaryImpl(inner, manager()); + } + }); + } + + @Override + public Observable validateTransferAsync(String billingAccountName, String invoiceSectionName, String productName, TransferProductRequestProperties parameters) { + ProductsInner client = this.inner(); + return client.validateTransferAsync(billingAccountName, invoiceSectionName, productName, parameters) + .map(new Func1() { + @Override + public ValidateProductTransferEligibilityResult call(ValidateProductTransferEligibilityResultInner inner) { + return new ValidateProductTransferEligibilityResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateAutoRenewByBillingAccountNameAsync(String billingAccountName, String productName) { + ProductsInner client = this.inner(); + return client.updateAutoRenewByBillingAccountNameAsync(billingAccountName, productName) + .map(new Func1() { + @Override + public UpdateAutoRenewOperationSummary call(UpdateAutoRenewOperationSummaryInner inner) { + return new UpdateAutoRenewOperationSummaryImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateAutoRenewByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String productName) { + ProductsInner client = this.inner(); + return client.updateAutoRenewByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, productName) + .map(new Func1() { + @Override + public UpdateAutoRenewOperationSummary call(UpdateAutoRenewOperationSummaryInner inner) { + return new UpdateAutoRenewOperationSummaryImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingAccountNameAsync(final String billingAccountName) { + ProductsInner client = this.inner(); + return client.listByBillingAccountNameAsync(billingAccountName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public ProductSummary call(ProductSummaryInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductsInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductsInner.java new file mode 100644 index 0000000000000..6550b5445bb47 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ProductsInner.java @@ -0,0 +1,1424 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ProductsTransferHeaders; +import com.microsoft.azure.management.billing.v2018_11_01_preview.TransferProductRequestProperties; +import com.microsoft.azure.management.billing.v2018_11_01_preview.UpdateAutoRenew; +import com.microsoft.azure.management.billing.v2018_11_01_preview.UpdateAutoRenewRequest; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import 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.v2018_11_01_preview.Products listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Products listByInvoiceSectionName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products") + Observable> listByInvoiceSectionName(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Products get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products/{productName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Path("productName") String productName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Products transfer" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products/{productName}/transfer") + Observable> transfer(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Path("productName") String productName, @Query("api-version") String apiVersion, @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.v2018_11_01_preview.Products validateTransfer" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products/{productName}/validateTransferEligibility") + Observable> validateTransfer(@Path("billingAccountName") String billingAccountName, @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.v2018_11_01_preview.Products updateAutoRenewByBillingAccountName" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/updateAutoRenew") + Observable> updateAutoRenewByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Path("productName") String productName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body UpdateAutoRenewRequest body, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Products updateAutoRenewByInvoiceSectionName" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products/{productName}/updateAutoRenew") + Observable> updateAutoRenewByInvoiceSectionName(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Path("productName") String productName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body UpdateAutoRenewRequest body, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Products listByBillingAccountNameNext" }) + @GET + Observable> listByBillingAccountNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Products listByInvoiceSectionNameNext" }) + @GET + Observable> listByInvoiceSectionNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists products by billing account name. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ProductSummaryInner> object if successful. + */ + public PagedList listByBillingAccountName(final String billingAccountName) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists products by billing account name. + * + * @param billingAccountName Billing Account Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists products by billing account name. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductSummaryInner> object + */ + public Observable> listByBillingAccountNameAsync(final String billingAccountName) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists products by billing account name. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductSummaryInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName) { + return listByBillingAccountNameSinglePageAsync(billingAccountName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists products by billing account name. + * + * @param billingAccountName Billing Account Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists products by billing account name. + * + * @param billingAccountName Billing Account Id. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ProductSummaryInner> object if successful. + */ + public PagedList listByBillingAccountName(final String billingAccountName, final String filter) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists products by billing account name. + * + * @param billingAccountName Billing Account Id. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists products by billing account name. + * + * @param billingAccountName Billing Account Id. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductSummaryInner> object + */ + public Observable> listByBillingAccountNameAsync(final String billingAccountName, final String filter) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists products by billing account name. + * + * @param billingAccountName Billing Account Id. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductSummaryInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName, final String filter) { + return listByBillingAccountNameSinglePageAsync(billingAccountName, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists products by billing account name. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName, final String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists products by invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ProductSummaryInner> object if successful. + */ + public PagedList listByInvoiceSectionName(final String billingAccountName, final String invoiceSectionName) { + ServiceResponse> response = listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists products by invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists products by invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductSummaryInner> object + */ + public Observable> listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName) { + return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists products by invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductSummaryInner> object + */ + public Observable>> listByInvoiceSectionNameWithServiceResponseAsync(final String billingAccountName, final String invoiceSectionName) { + return listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInvoiceSectionNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists products by invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionNameSinglePageAsync(final String billingAccountName, final String invoiceSectionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String filter = null; + return service.listByInvoiceSectionName(billingAccountName, invoiceSectionName, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists products by invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ProductSummaryInner> object if successful. + */ + public PagedList listByInvoiceSectionName(final String billingAccountName, final String invoiceSectionName, final String filter) { + ServiceResponse> response = listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists products by invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists products by invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductSummaryInner> object + */ + public Observable> listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName, final String filter) { + return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists products by invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductSummaryInner> object + */ + public Observable>> listByInvoiceSectionNameWithServiceResponseAsync(final String billingAccountName, final String invoiceSectionName, final String filter) { + return listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInvoiceSectionNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists products by invoice section name. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param invoiceSectionName InvoiceSection Id. + ServiceResponse> * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionNameSinglePageAsync(final String billingAccountName, final String invoiceSectionName, final String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByInvoiceSectionName(billingAccountName, invoiceSectionName, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceSectionNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get a single product by name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ProductSummaryInner object if successful. + */ + public ProductSummaryInner get(String billingAccountName, String invoiceSectionName, String productName) { + return getWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName).toBlocking().single().body(); + } + + /** + * Get a single product by name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String invoiceSectionName, String productName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName), serviceCallback); + } + + /** + * Get a single product by name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductSummaryInner object + */ + public Observable getAsync(String billingAccountName, String invoiceSectionName, String productName) { + return getWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName).map(new Func1, ProductSummaryInner>() { + @Override + public ProductSummaryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get a single product by name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductSummaryInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String productName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (productName == null) { + throw new IllegalArgumentException("Parameter productName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(billingAccountName, 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); + } + + /** + * The operation to transfer a Product to another invoice section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @param parameters Parameters supplied 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 ProductSummaryInner object if successful. + */ + public ProductSummaryInner transfer(String billingAccountName, String invoiceSectionName, String productName, TransferProductRequestProperties parameters) { + return transferWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName, parameters).toBlocking().single().body(); + } + + /** + * The operation to transfer a Product to another invoice section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @param parameters Parameters supplied 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 invoiceSectionName, String productName, TransferProductRequestProperties parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(transferWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName, parameters), serviceCallback); + } + + /** + * The operation to transfer a Product to another invoice section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @param parameters Parameters supplied to the Transfer Product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductSummaryInner object + */ + public Observable transferAsync(String billingAccountName, String invoiceSectionName, String productName, TransferProductRequestProperties parameters) { + return transferWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName, parameters).map(new Func1, ProductSummaryInner>() { + @Override + public ProductSummaryInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * The operation to transfer a Product to another invoice section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @param parameters Parameters supplied to the Transfer Product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ProductSummaryInner object + */ + public Observable> transferWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String productName, TransferProductRequestProperties parameters) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (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, 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 the transfer of products across invoice sections. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @param parameters Parameters supplied to the Transfer Products 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 invoiceSectionName, String productName, TransferProductRequestProperties parameters) { + return validateTransferWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName, parameters).toBlocking().single().body(); + } + + /** + * Validates the transfer of products across invoice sections. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @param parameters Parameters supplied to the Transfer Products 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 invoiceSectionName, String productName, TransferProductRequestProperties parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(validateTransferWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName, parameters), serviceCallback); + } + + /** + * Validates the transfer of products across invoice sections. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @param parameters Parameters supplied to the Transfer Products operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateProductTransferEligibilityResultInner object + */ + public Observable validateTransferAsync(String billingAccountName, String invoiceSectionName, String productName, TransferProductRequestProperties parameters) { + return validateTransferWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName, parameters).map(new Func1, ValidateProductTransferEligibilityResultInner>() { + @Override + public ValidateProductTransferEligibilityResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Validates the transfer of products across invoice sections. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @param parameters Parameters supplied to the Transfer Products operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ValidateProductTransferEligibilityResultInner object + */ + public Observable> validateTransferWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String productName, TransferProductRequestProperties parameters) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (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, 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 billing account name. + * + * @param billingAccountName Billing Account Id. + * @param productName Invoice Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the UpdateAutoRenewOperationSummaryInner object if successful. + */ + public UpdateAutoRenewOperationSummaryInner updateAutoRenewByBillingAccountName(String billingAccountName, String productName) { + return updateAutoRenewByBillingAccountNameWithServiceResponseAsync(billingAccountName, productName).toBlocking().single().body(); + } + + /** + * Cancel auto renew for product by product id and billing account name. + * + * @param billingAccountName Billing Account Id. + * @param productName Invoice Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAutoRenewByBillingAccountNameAsync(String billingAccountName, String productName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateAutoRenewByBillingAccountNameWithServiceResponseAsync(billingAccountName, productName), serviceCallback); + } + + /** + * Cancel auto renew for product by product id and billing account name. + * + * @param billingAccountName Billing Account Id. + * @param productName Invoice Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UpdateAutoRenewOperationSummaryInner object + */ + public Observable updateAutoRenewByBillingAccountNameAsync(String billingAccountName, String productName) { + return updateAutoRenewByBillingAccountNameWithServiceResponseAsync(billingAccountName, productName).map(new Func1, UpdateAutoRenewOperationSummaryInner>() { + @Override + public UpdateAutoRenewOperationSummaryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancel auto renew for product by product id and billing account name. + * + * @param billingAccountName Billing Account Id. + * @param productName Invoice Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UpdateAutoRenewOperationSummaryInner object + */ + public Observable> updateAutoRenewByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String productName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (productName == null) { + throw new IllegalArgumentException("Parameter productName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final UpdateAutoRenew autoRenew = null; + UpdateAutoRenewRequest body = new UpdateAutoRenewRequest(); + body.withAutoRenew(null); + return service.updateAutoRenewByBillingAccountName(billingAccountName, productName, this.client.apiVersion(), this.client.acceptLanguage(), body, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateAutoRenewByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Cancel auto renew for product by product id and billing account name. + * + * @param billingAccountName Billing Account Id. + * @param productName Invoice Id. + * @param autoRenew Request parameters to update auto renew policy a product. Possible values include: 'true', 'false' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the UpdateAutoRenewOperationSummaryInner object if successful. + */ + public UpdateAutoRenewOperationSummaryInner updateAutoRenewByBillingAccountName(String billingAccountName, String productName, UpdateAutoRenew autoRenew) { + return updateAutoRenewByBillingAccountNameWithServiceResponseAsync(billingAccountName, productName, autoRenew).toBlocking().single().body(); + } + + /** + * Cancel auto renew for product by product id and billing account name. + * + * @param billingAccountName Billing Account Id. + * @param productName Invoice Id. + * @param autoRenew Request parameters to update auto renew policy a product. Possible values include: 'true', 'false' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAutoRenewByBillingAccountNameAsync(String billingAccountName, String productName, UpdateAutoRenew autoRenew, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateAutoRenewByBillingAccountNameWithServiceResponseAsync(billingAccountName, productName, autoRenew), serviceCallback); + } + + /** + * Cancel auto renew for product by product id and billing account name. + * + * @param billingAccountName Billing Account Id. + * @param productName Invoice Id. + * @param autoRenew Request parameters to update auto renew policy a product. Possible values include: 'true', 'false' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UpdateAutoRenewOperationSummaryInner object + */ + public Observable updateAutoRenewByBillingAccountNameAsync(String billingAccountName, String productName, UpdateAutoRenew autoRenew) { + return updateAutoRenewByBillingAccountNameWithServiceResponseAsync(billingAccountName, productName, autoRenew).map(new Func1, UpdateAutoRenewOperationSummaryInner>() { + @Override + public UpdateAutoRenewOperationSummaryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancel auto renew for product by product id and billing account name. + * + * @param billingAccountName Billing Account Id. + * @param productName Invoice Id. + * @param autoRenew Request parameters to update auto renew policy a product. Possible values include: 'true', 'false' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UpdateAutoRenewOperationSummaryInner object + */ + public Observable> updateAutoRenewByBillingAccountNameWithServiceResponseAsync(String billingAccountName, String productName, UpdateAutoRenew autoRenew) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (productName == null) { + throw new IllegalArgumentException("Parameter productName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + UpdateAutoRenewRequest body = new UpdateAutoRenewRequest(); + body.withAutoRenew(autoRenew); + return service.updateAutoRenewByBillingAccountName(billingAccountName, productName, this.client.apiVersion(), this.client.acceptLanguage(), body, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateAutoRenewByBillingAccountNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateAutoRenewByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the UpdateAutoRenewOperationSummaryInner object if successful. + */ + public UpdateAutoRenewOperationSummaryInner updateAutoRenewByInvoiceSectionName(String billingAccountName, String invoiceSectionName, String productName) { + return updateAutoRenewByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName).toBlocking().single().body(); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAutoRenewByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String productName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateAutoRenewByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName), serviceCallback); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UpdateAutoRenewOperationSummaryInner object + */ + public Observable updateAutoRenewByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String productName) { + return updateAutoRenewByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName).map(new Func1, UpdateAutoRenewOperationSummaryInner>() { + @Override + public UpdateAutoRenewOperationSummaryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UpdateAutoRenewOperationSummaryInner object + */ + public Observable> updateAutoRenewByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String productName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (productName == null) { + throw new IllegalArgumentException("Parameter productName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final UpdateAutoRenew autoRenew = null; + UpdateAutoRenewRequest body = new UpdateAutoRenewRequest(); + body.withAutoRenew(null); + return service.updateAutoRenewByInvoiceSectionName(billingAccountName, invoiceSectionName, productName, this.client.apiVersion(), this.client.acceptLanguage(), body, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateAutoRenewByInvoiceSectionNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @param autoRenew Request parameters to update auto renew policy a product. Possible values include: 'true', 'false' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the UpdateAutoRenewOperationSummaryInner object if successful. + */ + public UpdateAutoRenewOperationSummaryInner updateAutoRenewByInvoiceSectionName(String billingAccountName, String invoiceSectionName, String productName, UpdateAutoRenew autoRenew) { + return updateAutoRenewByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName, autoRenew).toBlocking().single().body(); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @param autoRenew Request parameters to update auto renew policy a product. Possible values include: 'true', 'false' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAutoRenewByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String productName, UpdateAutoRenew autoRenew, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateAutoRenewByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName, autoRenew), serviceCallback); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @param autoRenew Request parameters to update auto renew policy a product. Possible values include: 'true', 'false' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UpdateAutoRenewOperationSummaryInner object + */ + public Observable updateAutoRenewByInvoiceSectionNameAsync(String billingAccountName, String invoiceSectionName, String productName, UpdateAutoRenew autoRenew) { + return updateAutoRenewByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, productName, autoRenew).map(new Func1, UpdateAutoRenewOperationSummaryInner>() { + @Override + public UpdateAutoRenewOperationSummaryInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancel auto renew for product by product id and invoice section name. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param productName Invoice Id. + * @param autoRenew Request parameters to update auto renew policy a product. Possible values include: 'true', 'false' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the UpdateAutoRenewOperationSummaryInner object + */ + public Observable> updateAutoRenewByInvoiceSectionNameWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String productName, UpdateAutoRenew autoRenew) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (productName == null) { + throw new IllegalArgumentException("Parameter productName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + UpdateAutoRenewRequest body = new UpdateAutoRenewRequest(); + body.withAutoRenew(autoRenew); + return service.updateAutoRenewByInvoiceSectionName(billingAccountName, invoiceSectionName, productName, this.client.apiVersion(), this.client.acceptLanguage(), body, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateAutoRenewByInvoiceSectionNameDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateAutoRenewByInvoiceSectionNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists products by billing account name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ProductSummaryInner> object if successful. + */ + public PagedList listByBillingAccountNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists products by billing account name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists products by billing account name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductSummaryInner> object + */ + public Observable> listByBillingAccountNameNextAsync(final String nextPageLink) { + return listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists products by billing account name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductSummaryInner> object + */ + public Observable>> listByBillingAccountNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists products by billing account name. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingAccountNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists products by invoice section name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<ProductSummaryInner> object if successful. + */ + public PagedList listByInvoiceSectionNameNext(final String nextPageLink) { + ServiceResponse> response = listByInvoiceSectionNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists products by invoice section name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByInvoiceSectionNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists products by invoice section name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductSummaryInner> object + */ + public Observable> listByInvoiceSectionNameNextAsync(final String nextPageLink) { + return listByInvoiceSectionNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists products by invoice section name. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ProductSummaryInner> object + */ + public Observable>> listByInvoiceSectionNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInvoiceSectionNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists products by invoice section name. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ProductSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionNameNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByInvoiceSectionNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceSectionNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/RecipientTransferDetailsImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/RecipientTransferDetailsImpl.java new file mode 100644 index 0000000000000..27305741e010e --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/RecipientTransferDetailsImpl.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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.RecipientTransferDetails; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_01_preview.EligibleProductType; +import org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2018_11_01_preview.DetailedTransferStatus; +import com.microsoft.azure.management.billing.v2018_11_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 initiatorEmailId() { + return this.inner().initiatorEmailId(); + } + + @Override + public DateTime lastModifiedTime() { + return this.inner().lastModifiedTime(); + } + + @Override + public String recipientEmailId() { + return this.inner().recipientEmailId(); + } + + @Override + public TransferStatus transferStatus() { + return this.inner().transferStatus(); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/RecipientTransferDetailsInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/RecipientTransferDetailsInner.java new file mode 100644 index 0000000000000..db2ea05dfd673 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/RecipientTransferDetailsInner.java @@ -0,0 +1,161 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_01_preview.EligibleProductType; +import com.microsoft.azure.management.billing.v2018_11_01_preview.TransferStatus; +import com.microsoft.azure.management.billing.v2018_11_01_preview.DetailedTransferStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Details of the transfer. + */ +@JsonFlatten +public class RecipientTransferDetailsInner { + /** + * Transfer creation time. + */ + @JsonProperty(value = "properties.creationTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationTime; + + /** + * Transfer expiration time. + */ + @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; + + /** + * Email Id of recipient of transfer. + */ + @JsonProperty(value = "properties.recipientEmailId", access = JsonProperty.Access.WRITE_ONLY) + private String recipientEmailId; + + /** + * Email Id of initiator of transfer. + */ + @JsonProperty(value = "properties.initiatorEmailId", access = JsonProperty.Access.WRITE_ONLY) + private String initiatorEmailId; + + /** + * Email Id who user canceled the transfer. + */ + @JsonProperty(value = "properties.canceledBy", access = JsonProperty.Access.WRITE_ONLY) + private String canceledBy; + + /** + * Transfer last modification time. + */ + @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 transfer creation time. + * + * @return the creationTime value + */ + public DateTime creationTime() { + return this.creationTime; + } + + /** + * Get transfer expiration time. + * + * @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 email Id of recipient of transfer. + * + * @return the recipientEmailId value + */ + public String recipientEmailId() { + return this.recipientEmailId; + } + + /** + * Get email Id of initiator of transfer. + * + * @return the initiatorEmailId value + */ + public String initiatorEmailId() { + return this.initiatorEmailId; + } + + /** + * Get email Id who user canceled the transfer. + * + * @return the canceledBy value + */ + public String canceledBy() { + return this.canceledBy; + } + + /** + * Get transfer last modification time. + * + * @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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/RecipientTransfersImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/RecipientTransfersImpl.java new file mode 100644 index 0000000000000..c50be0b4daebc --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/RecipientTransfersImpl.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. + * abc + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.RecipientTransfers; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2018_11_01_preview.RecipientTransferDetails; + +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 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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/RecipientTransfersInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/RecipientTransfersInner.java new file mode 100644 index 0000000000000..24db54a31d01b --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/RecipientTransfersInner.java @@ -0,0 +1,593 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2018_11_01_preview.AcceptTransferRequest; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.azure.management.billing.v2018_11_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.v2018_11_01_preview.RecipientTransfers accept" }) + @POST("providers/Microsoft.Billing/transfers/{transferName}/acceptTransfer") + Observable> accept(@Path("transferName") String transferName, @Header("accept-language") String acceptLanguage, @Body AcceptTransferRequest body, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.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.v2018_11_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.v2018_11_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.v2018_11_01_preview.RecipientTransfers listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Accepts the transfer with given transfer Id. + * + * @param transferName Transfer 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 RecipientTransferDetailsInner object if successful. + */ + public RecipientTransferDetailsInner accept(String transferName) { + return acceptWithServiceResponseAsync(transferName).toBlocking().single().body(); + } + + /** + * Accepts the transfer with given transfer Id. + * + * @param transferName Transfer 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 acceptAsync(String transferName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(acceptWithServiceResponseAsync(transferName), serviceCallback); + } + + /** + * Accepts the transfer with given transfer Id. + * + * @param transferName Transfer Name. + * @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 the transfer with given transfer Id. + * + * @param transferName Transfer Name. + * @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 body = new AcceptTransferRequest(); + body.withProductDetails(null); + return service.accept(transferName, this.client.acceptLanguage(), body, 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 the transfer with given transfer Id. + * + * @param transferName Transfer Name. + * @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 the transfer with given transfer Id. + * + * @param transferName Transfer Name. + * @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 the transfer with given transfer Id. + * + * @param transferName Transfer Name. + * @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 the transfer with given transfer Id. + * + * @param transferName Transfer Name. + * @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 body = new AcceptTransferRequest(); + body.withProductDetails(productDetails); + return service.accept(transferName, this.client.acceptLanguage(), body, 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); + } + + /** + * Declines the transfer with given transfer Id. + * + * @param transferName Transfer 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 RecipientTransferDetailsInner object if successful. + */ + public RecipientTransferDetailsInner decline(String transferName) { + return declineWithServiceResponseAsync(transferName).toBlocking().single().body(); + } + + /** + * Declines the transfer with given transfer Id. + * + * @param transferName Transfer 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 declineAsync(String transferName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(declineWithServiceResponseAsync(transferName), serviceCallback); + } + + /** + * Declines the transfer with given transfer Id. + * + * @param transferName Transfer Name. + * @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 the transfer with given transfer Id. + * + * @param transferName Transfer Name. + * @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 the transfer with given transfer Id. + * + * @param transferName Transfer 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 RecipientTransferDetailsInner object if successful. + */ + public RecipientTransferDetailsInner get(String transferName) { + return getWithServiceResponseAsync(transferName).toBlocking().single().body(); + } + + /** + * Gets the transfer with given transfer Id. + * + * @param transferName Transfer 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 transferName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(transferName), serviceCallback); + } + + /** + * Gets the transfer with given transfer Id. + * + * @param transferName Transfer Name. + * @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 the transfer with given transfer Id. + * + * @param transferName Transfer Name. + * @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 transfers received by 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 transfers received by 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 transfers received by 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 transfers received by 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 transfers received by 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 transfers received by 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 transfers received by 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 transfers received by 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 transfers received by 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 transfers received by 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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsImpl.java new file mode 100644 index 0000000000000..3c76170d8461e --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsImpl.java @@ -0,0 +1,107 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Transactions; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2018_11_01_preview.TransactionsSummary; + +class TransactionsImpl extends WrapperImpl implements Transactions { + private final BillingManager manager; + + TransactionsImpl(BillingManager manager) { + super(manager.inner().transactions()); + this.manager = manager; + } + + public BillingManager manager() { + return this.manager; + } + + private TransactionsSummaryImpl wrapModel(TransactionsSummaryInner inner) { + return new TransactionsSummaryImpl(inner, manager()); + } + + @Override + public Observable listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate) { + TransactionsInner client = this.inner(); + return client.listByBillingProfileNameAsync(billingAccountName, billingProfileName, startDate, endDate) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TransactionsSummary call(TransactionsSummaryInner inner) { + return new TransactionsSummaryImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByCustomerNameAsync(final String billingAccountName, final String customerName, final String startDate, final String endDate) { + TransactionsInner client = this.inner(); + return client.listByCustomerNameAsync(billingAccountName, customerName, startDate, endDate) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TransactionsSummary call(TransactionsSummaryInner inner) { + return new TransactionsSummaryImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate) { + TransactionsInner client = this.inner(); + return client.listByInvoiceSectionNameAsync(billingAccountName, invoiceSectionName, startDate, endDate) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TransactionsSummary call(TransactionsSummaryInner inner) { + return new TransactionsSummaryImpl(inner, manager()); + } + }); + } + + @Override + public Observable listByBillingAccountNameAsync(final String billingAccountName, final String startDate, final String endDate) { + TransactionsInner client = this.inner(); + return client.listByBillingAccountNameAsync(billingAccountName, startDate, endDate) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TransactionsSummary call(TransactionsSummaryInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsInner.java new file mode 100644 index 0000000000000..c55540dedded7 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsInner.java @@ -0,0 +1,1605 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Transactions. + */ +public class TransactionsInner { + /** The Retrofit service to perform REST calls. */ + private TransactionsService service; + /** The service client containing this operation class. */ + private BillingManagementClientImpl client; + + /** + * Initializes an instance of TransactionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TransactionsInner(Retrofit retrofit, BillingManagementClientImpl client) { + this.service = retrofit.create(TransactionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Transactions to be + * used by Retrofit to perform actually REST calls. + */ + interface TransactionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Transactions listByBillingAccountName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/transactions") + Observable> listByBillingAccountName(@Path("billingAccountName") String billingAccountName, @Query("api-version") String apiVersion, @Query("startDate") String startDate, @Query("endDate") String endDate, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Transactions listByBillingProfileName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/transactions") + Observable> listByBillingProfileName(@Path("billingAccountName") String billingAccountName, @Path("billingProfileName") String billingProfileName, @Query("api-version") String apiVersion, @Query("startDate") String startDate, @Query("endDate") String endDate, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Transactions listByCustomerName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/transactions") + Observable> listByCustomerName(@Path("billingAccountName") String billingAccountName, @Path("customerName") String customerName, @Query("api-version") String apiVersion, @Query("startDate") String startDate, @Query("endDate") String endDate, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Transactions listByInvoiceSectionName" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/transactions") + Observable> listByInvoiceSectionName(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Query("api-version") String apiVersion, @Query("startDate") String startDate, @Query("endDate") String endDate, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Transactions listByBillingAccountNameNext" }) + @GET + Observable> listByBillingAccountNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Transactions listByBillingProfileNameNext" }) + @GET + Observable> listByBillingProfileNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Transactions listByCustomerNameNext" }) + @GET + Observable> listByCustomerNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Transactions listByInvoiceSectionNameNext" }) + @GET + Observable> listByInvoiceSectionNameNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the transactions by billing account name for given start and end date. + * + * @param billingAccountName Billing Account Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TransactionsSummaryInner> object if successful. + */ + public PagedList listByBillingAccountName(final String billingAccountName, final String startDate, final String endDate) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName, startDate, endDate).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transactions by billing account name for given start and end date. + * + * @param billingAccountName Billing Account Id. + * @param startDate Start date + * @param endDate End date + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final String startDate, final String endDate, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName, startDate, endDate), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transactions by billing account name for given start and end date. + * + * @param billingAccountName Billing Account Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable> listByBillingAccountNameAsync(final String billingAccountName, final String startDate, final String endDate) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, startDate, endDate) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transactions by billing account name for given start and end date. + * + * @param billingAccountName Billing Account Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName, final String startDate, final String endDate) { + return listByBillingAccountNameSinglePageAsync(billingAccountName, startDate, endDate) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions by billing account name for given start and end date. + * + * @param billingAccountName Billing Account Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionsSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName, final String startDate, final String endDate) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (startDate == null) { + throw new IllegalArgumentException("Parameter startDate is required and cannot be null."); + } + if (endDate == null) { + throw new IllegalArgumentException("Parameter endDate is required and cannot be null."); + } + final String filter = null; + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), startDate, endDate, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the transactions by billing account name for given start and end date. + * + * @param billingAccountName Billing Account Id. + * @param startDate Start date + * @param endDate End date + * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TransactionsSummaryInner> object if successful. + */ + public PagedList listByBillingAccountName(final String billingAccountName, final String startDate, final String endDate, final String filter) { + ServiceResponse> response = listByBillingAccountNameSinglePageAsync(billingAccountName, startDate, endDate, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transactions by billing account name for given start and end date. + * + * @param billingAccountName Billing Account Id. + * @param startDate Start date + * @param endDate End date + * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameAsync(final String billingAccountName, final String startDate, final String endDate, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameSinglePageAsync(billingAccountName, startDate, endDate, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transactions by billing account name for given start and end date. + * + * @param billingAccountName Billing Account Id. + * @param startDate Start date + * @param endDate End date + * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable> listByBillingAccountNameAsync(final String billingAccountName, final String startDate, final String endDate, final String filter) { + return listByBillingAccountNameWithServiceResponseAsync(billingAccountName, startDate, endDate, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transactions by billing account name for given start and end date. + * + * @param billingAccountName Billing Account Id. + * @param startDate Start date + * @param endDate End date + * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable>> listByBillingAccountNameWithServiceResponseAsync(final String billingAccountName, final String startDate, final String endDate, final String filter) { + return listByBillingAccountNameSinglePageAsync(billingAccountName, startDate, endDate, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions by billing account name for given start and end date. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param startDate Start date + ServiceResponse> * @param endDate End date + ServiceResponse> * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionsSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameSinglePageAsync(final String billingAccountName, final String startDate, final String endDate, final String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (startDate == null) { + throw new IllegalArgumentException("Parameter startDate is required and cannot be null."); + } + if (endDate == null) { + throw new IllegalArgumentException("Parameter endDate is required and cannot be null."); + } + return service.listByBillingAccountName(billingAccountName, this.client.apiVersion(), startDate, endDate, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the transactions by billing profile name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TransactionsSummaryInner> object if successful. + */ + public PagedList listByBillingProfileName(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate) { + ServiceResponse> response = listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName, startDate, endDate).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transactions by billing profile name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param startDate Start date + * @param endDate End date + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName, startDate, endDate), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transactions by billing profile name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable> listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate) { + return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, startDate, endDate) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transactions by billing profile name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable>> listByBillingProfileNameWithServiceResponseAsync(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate) { + return listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName, startDate, endDate) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions by billing profile name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionsSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNameSinglePageAsync(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (startDate == null) { + throw new IllegalArgumentException("Parameter startDate is required and cannot be null."); + } + if (endDate == null) { + throw new IllegalArgumentException("Parameter endDate is required and cannot be null."); + } + final String filter = null; + return service.listByBillingProfileName(billingAccountName, billingProfileName, this.client.apiVersion(), startDate, endDate, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the transactions by billing profile name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param startDate Start date + * @param endDate End date + * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TransactionsSummaryInner> object if successful. + */ + public PagedList listByBillingProfileName(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate, final String filter) { + ServiceResponse> response = listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName, startDate, endDate, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transactions by billing profile name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param startDate Start date + * @param endDate End date + * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName, startDate, endDate, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transactions by billing profile name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param startDate Start date + * @param endDate End date + * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable> listByBillingProfileNameAsync(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate, final String filter) { + return listByBillingProfileNameWithServiceResponseAsync(billingAccountName, billingProfileName, startDate, endDate, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transactions by billing profile name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param billingProfileName Billing Profile Id. + * @param startDate Start date + * @param endDate End date + * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable>> listByBillingProfileNameWithServiceResponseAsync(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate, final String filter) { + return listByBillingProfileNameSinglePageAsync(billingAccountName, billingProfileName, startDate, endDate, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions by billing profile name for given start date and end date. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param billingProfileName Billing Profile Id. + ServiceResponse> * @param startDate Start date + ServiceResponse> * @param endDate End date + ServiceResponse> * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionsSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNameSinglePageAsync(final String billingAccountName, final String billingProfileName, final String startDate, final String endDate, final String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (billingProfileName == null) { + throw new IllegalArgumentException("Parameter billingProfileName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (startDate == null) { + throw new IllegalArgumentException("Parameter startDate is required and cannot be null."); + } + if (endDate == null) { + throw new IllegalArgumentException("Parameter endDate is required and cannot be null."); + } + return service.listByBillingProfileName(billingAccountName, billingProfileName, this.client.apiVersion(), startDate, endDate, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TransactionsSummaryInner> object if successful. + */ + public PagedList listByCustomerName(final String billingAccountName, final String customerName, final String startDate, final String endDate) { + ServiceResponse> response = listByCustomerNameSinglePageAsync(billingAccountName, customerName, startDate, endDate).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param startDate Start date + * @param endDate End date + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByCustomerNameAsync(final String billingAccountName, final String customerName, final String startDate, final String endDate, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCustomerNameSinglePageAsync(billingAccountName, customerName, startDate, endDate), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable> listByCustomerNameAsync(final String billingAccountName, final String customerName, final String startDate, final String endDate) { + return listByCustomerNameWithServiceResponseAsync(billingAccountName, customerName, startDate, endDate) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable>> listByCustomerNameWithServiceResponseAsync(final String billingAccountName, final String customerName, final String startDate, final String endDate) { + return listByCustomerNameSinglePageAsync(billingAccountName, customerName, startDate, endDate) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByCustomerNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionsSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCustomerNameSinglePageAsync(final String billingAccountName, final String customerName, final String startDate, final String endDate) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (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 (startDate == null) { + throw new IllegalArgumentException("Parameter startDate is required and cannot be null."); + } + if (endDate == null) { + throw new IllegalArgumentException("Parameter endDate is required and cannot be null."); + } + final String filter = null; + return service.listByCustomerName(billingAccountName, customerName, this.client.apiVersion(), startDate, endDate, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCustomerNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param startDate Start date + * @param endDate End date + * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TransactionsSummaryInner> object if successful. + */ + public PagedList listByCustomerName(final String billingAccountName, final String customerName, final String startDate, final String endDate, final String filter) { + ServiceResponse> response = listByCustomerNameSinglePageAsync(billingAccountName, customerName, startDate, endDate, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param startDate Start date + * @param endDate End date + * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByCustomerNameAsync(final String billingAccountName, final String customerName, final String startDate, final String endDate, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCustomerNameSinglePageAsync(billingAccountName, customerName, startDate, endDate, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param startDate Start date + * @param endDate End date + * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable> listByCustomerNameAsync(final String billingAccountName, final String customerName, final String startDate, final String endDate, final String filter) { + return listByCustomerNameWithServiceResponseAsync(billingAccountName, customerName, startDate, endDate, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param customerName Customer Id. + * @param startDate Start date + * @param endDate End date + * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable>> listByCustomerNameWithServiceResponseAsync(final String billingAccountName, final String customerName, final String startDate, final String endDate, final String filter) { + return listByCustomerNameSinglePageAsync(billingAccountName, customerName, startDate, endDate, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByCustomerNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param customerName Customer Id. + ServiceResponse> * @param startDate Start date + ServiceResponse> * @param endDate End date + ServiceResponse> * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionsSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCustomerNameSinglePageAsync(final String billingAccountName, final String customerName, final String startDate, final String endDate, final String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (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 (startDate == null) { + throw new IllegalArgumentException("Parameter startDate is required and cannot be null."); + } + if (endDate == null) { + throw new IllegalArgumentException("Parameter endDate is required and cannot be null."); + } + return service.listByCustomerName(billingAccountName, customerName, this.client.apiVersion(), startDate, endDate, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCustomerNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByCustomerNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TransactionsSummaryInner> object if successful. + */ + public PagedList listByInvoiceSectionName(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate) { + ServiceResponse> response = listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName, startDate, endDate).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param startDate Start date + * @param endDate End date + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName, startDate, endDate), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable> listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate) { + return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, startDate, endDate) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable>> listByInvoiceSectionNameWithServiceResponseAsync(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate) { + return listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName, startDate, endDate) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInvoiceSectionNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param startDate Start date + * @param endDate End date + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionsSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionNameSinglePageAsync(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (startDate == null) { + throw new IllegalArgumentException("Parameter startDate is required and cannot be null."); + } + if (endDate == null) { + throw new IllegalArgumentException("Parameter endDate is required and cannot be null."); + } + final String filter = null; + return service.listByInvoiceSectionName(billingAccountName, invoiceSectionName, this.client.apiVersion(), startDate, endDate, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param startDate Start date + * @param endDate End date + * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TransactionsSummaryInner> object if successful. + */ + public PagedList listByInvoiceSectionName(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate, final String filter) { + ServiceResponse> response = listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName, startDate, endDate, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param startDate Start date + * @param endDate End date + * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName, startDate, endDate, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param startDate Start date + * @param endDate End date + * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable> listByInvoiceSectionNameAsync(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate, final String filter) { + return listByInvoiceSectionNameWithServiceResponseAsync(billingAccountName, invoiceSectionName, startDate, endDate, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param startDate Start date + * @param endDate End date + * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable>> listByInvoiceSectionNameWithServiceResponseAsync(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate, final String filter) { + return listByInvoiceSectionNameSinglePageAsync(billingAccountName, invoiceSectionName, startDate, endDate, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInvoiceSectionNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param invoiceSectionName InvoiceSection Id. + ServiceResponse> * @param startDate Start date + ServiceResponse> * @param endDate End date + ServiceResponse> * @param filter May be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionsSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionNameSinglePageAsync(final String billingAccountName, final String invoiceSectionName, final String startDate, final String endDate, final String filter) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (startDate == null) { + throw new IllegalArgumentException("Parameter startDate is required and cannot be null."); + } + if (endDate == null) { + throw new IllegalArgumentException("Parameter endDate is required and cannot be null."); + } + return service.listByInvoiceSectionName(billingAccountName, invoiceSectionName, this.client.apiVersion(), startDate, endDate, filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionNameDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceSectionNameDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the transactions by billing account name for given start and end date. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TransactionsSummaryInner> object if successful. + */ + public PagedList listByBillingAccountNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transactions by billing account name for given start and end date. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingAccountNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingAccountNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transactions by billing account name for given start and end date. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable> listByBillingAccountNameNextAsync(final String nextPageLink) { + return listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transactions by billing account name for given start and end date. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable>> listByBillingAccountNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingAccountNameNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingAccountNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions by billing account name for given start and end date. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionsSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingAccountNameNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingAccountNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingAccountNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingAccountNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the transactions by billing profile name for given start date and end date. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TransactionsSummaryInner> object if successful. + */ + public PagedList listByBillingProfileNameNext(final String nextPageLink) { + ServiceResponse> response = listByBillingProfileNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transactions by billing profile name for given start date and end date. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByBillingProfileNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByBillingProfileNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transactions by billing profile name for given start date and end date. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable> listByBillingProfileNameNextAsync(final String nextPageLink) { + return listByBillingProfileNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transactions by billing profile name for given start date and end date. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable>> listByBillingProfileNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByBillingProfileNameNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByBillingProfileNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions by billing profile name for given start date and end date. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionsSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByBillingProfileNameNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByBillingProfileNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByBillingProfileNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByBillingProfileNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TransactionsSummaryInner> object if successful. + */ + public PagedList listByCustomerNameNext(final String nextPageLink) { + ServiceResponse> response = listByCustomerNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByCustomerNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByCustomerNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable> listByCustomerNameNextAsync(final String nextPageLink) { + return listByCustomerNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable>> listByCustomerNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByCustomerNameNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByCustomerNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionsSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByCustomerNameNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByCustomerNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByCustomerNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByCustomerNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TransactionsSummaryInner> object if successful. + */ + public PagedList listByInvoiceSectionNameNext(final String nextPageLink) { + ServiceResponse> response = listByInvoiceSectionNameNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByInvoiceSectionNameNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByInvoiceSectionNameNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable> listByInvoiceSectionNameNextAsync(final String nextPageLink) { + return listByInvoiceSectionNameNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransactionsSummaryInner> object + */ + public Observable>> listByInvoiceSectionNameNextWithServiceResponseAsync(final String nextPageLink) { + return listByInvoiceSectionNameNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByInvoiceSectionNameNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the transactions by invoice section name for given start date and end date. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransactionsSummaryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByInvoiceSectionNameNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByInvoiceSectionNameNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByInvoiceSectionNameNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByInvoiceSectionNameNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsSummaryImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsSummaryImpl.java new file mode 100644 index 0000000000000..404c17ae61855 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsSummaryImpl.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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.TransactionsSummary; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2018_11_01_preview.TransactionTypeKind; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Amount; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ReservationType; + +class TransactionsSummaryImpl extends WrapperImpl implements TransactionsSummary { + private final BillingManager manager; + + TransactionsSummaryImpl(TransactionsSummaryInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + + + @Override + public String billingProfileId() { + return this.inner().billingProfileId(); + } + + @Override + public String billingProfileName() { + return this.inner().billingProfileName(); + } + + @Override + public String customerDisplayName() { + return this.inner().customerDisplayName(); + } + + @Override + public String customerId() { + return this.inner().customerId(); + } + + @Override + public DateTime dateProperty() { + return this.inner().dateProperty(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String invoice() { + return this.inner().invoice(); + } + + @Override + public String invoiceSectionId() { + return this.inner().invoiceSectionId(); + } + + @Override + public String invoiceSectionName() { + return this.inner().invoiceSectionName(); + } + + @Override + public TransactionTypeKind kind() { + return this.inner().kind(); + } + + @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 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 String subscriptionId() { + return this.inner().subscriptionId(); + } + + @Override + public String subscriptionName() { + return this.inner().subscriptionName(); + } + + @Override + public Amount transactionAmount() { + return this.inner().transactionAmount(); + } + + @Override + public ReservationType transactionType() { + return this.inner().transactionType(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsSummaryInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsSummaryInner.java new file mode 100644 index 0000000000000..e70edea0b91d1 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransactionsSummaryInner.java @@ -0,0 +1,347 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.TransactionTypeKind; +import org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ReservationType; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Amount; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A reservation transaction summary resource. + */ +@JsonFlatten +public class TransactionsSummaryInner extends ProxyResource { + /** + * The kind of transaction. Choices are all and reservation. Possible + * values include: 'all', 'reservation'. + */ + @JsonProperty(value = "properties.kind") + private TransactionTypeKind kind; + + /** + * The date of reservation transaction. + */ + @JsonProperty(value = "properties.date", access = JsonProperty.Access.WRITE_ONLY) + private DateTime dateProperty; + + /** + * Invoice number or 'pending' if not invoiced. + */ + @JsonProperty(value = "properties.invoice", access = JsonProperty.Access.WRITE_ONLY) + private String invoice; + + /** + * The reservation order id. + */ + @JsonProperty(value = "properties.orderId", access = JsonProperty.Access.WRITE_ONLY) + private String orderId; + + /** + * The reservation order name. + */ + @JsonProperty(value = "properties.orderName", access = JsonProperty.Access.WRITE_ONLY) + private String orderName; + + /** + * The product family. + */ + @JsonProperty(value = "properties.productFamily", access = JsonProperty.Access.WRITE_ONLY) + private String productFamily; + + /** + * The product type id. + */ + @JsonProperty(value = "properties.productTypeId", access = JsonProperty.Access.WRITE_ONLY) + private String productTypeId; + + /** + * The type of product. + */ + @JsonProperty(value = "properties.productType", access = JsonProperty.Access.WRITE_ONLY) + private String productType; + + /** + * Product description. + */ + @JsonProperty(value = "properties.productDescription", access = JsonProperty.Access.WRITE_ONLY) + private String productDescription; + + /** + * Transaction types. Possible values include: 'Purchase', 'Usage Charge'. + */ + @JsonProperty(value = "properties.transactionType") + private ReservationType transactionType; + + /** + * Last charge associated with the purchase. + */ + @JsonProperty(value = "properties.transactionAmount", access = JsonProperty.Access.WRITE_ONLY) + private Amount transactionAmount; + + /** + * Purchase quantity. + */ + @JsonProperty(value = "properties.quantity", access = JsonProperty.Access.WRITE_ONLY) + private Integer quantity; + + /** + * Customer id to which this product belongs. + */ + @JsonProperty(value = "properties.customerId", access = JsonProperty.Access.WRITE_ONLY) + private String customerId; + + /** + * Display name of customer to which this product belongs. + */ + @JsonProperty(value = "properties.customerDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String customerDisplayName; + + /** + * Invoice section id to which this product belongs. + */ + @JsonProperty(value = "properties.invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /** + * Invoice section name to which this product belongs. + */ + @JsonProperty(value = "properties.invoiceSectionName", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionName; + + /** + * Billing Profile id to which this product belongs. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /** + * Billing Profile name to which this product belongs. + */ + @JsonProperty(value = "properties.billingProfileName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileName; + + /** + * The subscription id. + */ + @JsonProperty(value = "properties.subscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionId; + + /** + * The subscription name. + */ + @JsonProperty(value = "properties.subscriptionName", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionName; + + /** + * Get the kind of transaction. Choices are all and reservation. Possible values include: 'all', 'reservation'. + * + * @return the kind value + */ + public TransactionTypeKind kind() { + return this.kind; + } + + /** + * Set the kind of transaction. Choices are all and reservation. Possible values include: 'all', 'reservation'. + * + * @param kind the kind value to set + * @return the TransactionsSummaryInner object itself. + */ + public TransactionsSummaryInner withKind(TransactionTypeKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the date of reservation transaction. + * + * @return the dateProperty value + */ + public DateTime dateProperty() { + return this.dateProperty; + } + + /** + * Get invoice number or 'pending' if not invoiced. + * + * @return the invoice value + */ + public String invoice() { + return this.invoice; + } + + /** + * Get the reservation order id. + * + * @return the orderId value + */ + public String orderId() { + return this.orderId; + } + + /** + * Get the reservation order name. + * + * @return the orderName value + */ + public String orderName() { + return this.orderName; + } + + /** + * Get the product family. + * + * @return the productFamily value + */ + public String productFamily() { + return this.productFamily; + } + + /** + * Get the product type id. + * + * @return the productTypeId value + */ + public String productTypeId() { + return this.productTypeId; + } + + /** + * Get the type of product. + * + * @return the productType value + */ + public String productType() { + return this.productType; + } + + /** + * Get product description. + * + * @return the productDescription value + */ + public String productDescription() { + return this.productDescription; + } + + /** + * Get transaction types. Possible values include: 'Purchase', 'Usage Charge'. + * + * @return the transactionType value + */ + public ReservationType transactionType() { + return this.transactionType; + } + + /** + * Set transaction types. Possible values include: 'Purchase', 'Usage Charge'. + * + * @param transactionType the transactionType value to set + * @return the TransactionsSummaryInner object itself. + */ + public TransactionsSummaryInner withTransactionType(ReservationType transactionType) { + this.transactionType = transactionType; + return this; + } + + /** + * Get last charge associated with the purchase. + * + * @return the transactionAmount value + */ + public Amount transactionAmount() { + return this.transactionAmount; + } + + /** + * Get purchase quantity. + * + * @return the quantity value + */ + public Integer quantity() { + return this.quantity; + } + + /** + * Get customer id to which this product belongs. + * + * @return the customerId value + */ + public String customerId() { + return this.customerId; + } + + /** + * Get display name of customer to which this product belongs. + * + * @return the customerDisplayName value + */ + public String customerDisplayName() { + return this.customerDisplayName; + } + + /** + * Get invoice section id to which this product belongs. + * + * @return the invoiceSectionId value + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get invoice section name to which this product belongs. + * + * @return the invoiceSectionName value + */ + public String invoiceSectionName() { + return this.invoiceSectionName; + } + + /** + * Get billing Profile id to which this product belongs. + * + * @return the billingProfileId value + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get billing Profile name to which this product belongs. + * + * @return the billingProfileName value + */ + public String billingProfileName() { + return this.billingProfileName; + } + + /** + * Get the subscription id. + * + * @return the subscriptionId value + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Get the subscription name. + * + * @return the subscriptionName value + */ + public String subscriptionName() { + return this.subscriptionName; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransferBillingSubscriptionResultImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransferBillingSubscriptionResultImpl.java new file mode 100644 index 0000000000000..894374cc05f42 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransferBillingSubscriptionResultInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransferBillingSubscriptionResultInner.java new file mode 100644 index 0000000000000..c6ce0a15bc452 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Request parameters to transfer billing subscription. + */ +@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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransferDetailsImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransferDetailsImpl.java new file mode 100644 index 0000000000000..e7869844f7e68 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransferDetailsImpl.java @@ -0,0 +1,87 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.TransferDetails; +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.v2018_11_01_preview.DetailedTransferStatus; +import com.microsoft.azure.management.billing.v2018_11_01_preview.TransferStatus; + +class TransferDetailsImpl extends WrapperImpl implements TransferDetails { + private final BillingManager manager; + private String billingAccountName; + private String invoiceSectionName; + private String transferName; + + TransferDetailsImpl(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 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 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 TransferStatus transferStatus() { + return this.inner().transferStatus(); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransferDetailsInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransferDetailsInner.java new file mode 100644 index 0000000000000..7dd90f21586c4 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransferDetailsInner.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.v2018_11_01_preview.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.billing.v2018_11_01_preview.TransferStatus; +import java.util.List; +import com.microsoft.azure.management.billing.v2018_11_01_preview.DetailedTransferStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Details of the transfer. + */ +@JsonFlatten +public class TransferDetailsInner { + /** + * Transfer creation time. + */ + @JsonProperty(value = "properties.creationTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime creationTime; + + /** + * Transfer expiration time. + */ + @JsonProperty(value = "properties.expirationTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime expirationTime; + + /** + * Target invoice section Id. + */ + @JsonProperty(value = "properties.invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /** + * Target billing account Id. + */ + @JsonProperty(value = "properties.billingAccountId", access = JsonProperty.Access.WRITE_ONLY) + private String billingAccountId; + + /** + * 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; + + /** + * Email Id of recipient of transfer. + */ + @JsonProperty(value = "properties.recipientEmailId", access = JsonProperty.Access.WRITE_ONLY) + private String recipientEmailId; + + /** + * Email Id of initiator of transfer. + */ + @JsonProperty(value = "properties.initiatorEmailId", access = JsonProperty.Access.WRITE_ONLY) + private String initiatorEmailId; + + /** + * Email Id who user canceled the transfer. + */ + @JsonProperty(value = "properties.canceledBy", access = JsonProperty.Access.WRITE_ONLY) + private String canceledBy; + + /** + * Transfer last modification time. + */ + @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 transfer creation time. + * + * @return the creationTime value + */ + public DateTime creationTime() { + return this.creationTime; + } + + /** + * Get transfer expiration time. + * + * @return the expirationTime value + */ + public DateTime expirationTime() { + return this.expirationTime; + } + + /** + * Get target invoice section Id. + * + * @return the invoiceSectionId value + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get target billing account Id. + * + * @return the billingAccountId value + */ + public String billingAccountId() { + return this.billingAccountId; + } + + /** + * 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 email Id of recipient of transfer. + * + * @return the recipientEmailId value + */ + public String recipientEmailId() { + return this.recipientEmailId; + } + + /** + * Get email Id of initiator of transfer. + * + * @return the initiatorEmailId value + */ + public String initiatorEmailId() { + return this.initiatorEmailId; + } + + /** + * Get email Id who user canceled the transfer. + * + * @return the canceledBy value + */ + public String canceledBy() { + return this.canceledBy; + } + + /** + * Get transfer last modification time. + * + * @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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransfersImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransfersImpl.java new file mode 100644 index 0000000000000..5b2127fb2e484 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.Transfers; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2018_11_01_preview.TransferDetails; +import com.microsoft.azure.management.billing.v2018_11_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 TransferDetailsImpl wrapModel(TransferDetailsInner inner) { + return new TransferDetailsImpl(inner, manager()); + } + + @Override + public Observable listAsync(final String billingAccountName, final String invoiceSectionName) { + TransfersInner client = this.inner(); + return client.listAsync(billingAccountName, invoiceSectionName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public TransferDetails call(TransferDetailsInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String billingAccountName, String invoiceSectionName, String transferName) { + TransfersInner client = this.inner(); + return client.getAsync(billingAccountName, invoiceSectionName, transferName) + .flatMap(new Func1>() { + @Override + public Observable call(TransferDetailsInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((TransferDetails)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable cancelAsync(String billingAccountName, String invoiceSectionName, String transferName) { + TransfersInner client = this.inner(); + return client.cancelAsync(billingAccountName, invoiceSectionName, transferName).toCompletable(); + } + + @Override + public Observable initiateAsync(String billingAccountName, String invoiceSectionName, InitiateTransferRequest body) { + TransfersInner client = this.inner(); + return client.initiateAsync(billingAccountName, invoiceSectionName, body) + .map(new Func1() { + @Override + public TransferDetails call(TransferDetailsInner inner) { + return new TransferDetailsImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransfersInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransfersInner.java new file mode 100644 index 0000000000000..8391524cfb8e8 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/TransfersInner.java @@ -0,0 +1,576 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.billing.v2018_11_01_preview.ErrorResponseException; +import com.microsoft.azure.management.billing.v2018_11_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.v2018_11_01_preview.Transfers initiate" }) + @POST("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/initiateTransfer") + Observable> initiate(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Body InitiateTransferRequest body, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Transfers get" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/transfers/{transferName}") + Observable> get(@Path("billingAccountName") String billingAccountName, @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.v2018_11_01_preview.Transfers cancel" }) + @HTTP(path = "providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/transfers/{transferName}", method = "DELETE", hasBody = true) + Observable> cancel(@Path("billingAccountName") String billingAccountName, @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.v2018_11_01_preview.Transfers list" }) + @GET("providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/transfers") + Observable> list(@Path("billingAccountName") String billingAccountName, @Path("invoiceSectionName") String invoiceSectionName, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2018_11_01_preview.Transfers listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Initiates the request to transfer the legacy subscriptions or RIs. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param body Initiate transfer parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 invoiceSectionName, InitiateTransferRequest body) { + return initiateWithServiceResponseAsync(billingAccountName, invoiceSectionName, body).toBlocking().single().body(); + } + + /** + * Initiates the request to transfer the legacy subscriptions or RIs. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param body Initiate transfer parameters. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture initiateAsync(String billingAccountName, String invoiceSectionName, InitiateTransferRequest body, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(initiateWithServiceResponseAsync(billingAccountName, invoiceSectionName, body), serviceCallback); + } + + /** + * Initiates the request to transfer the legacy subscriptions or RIs. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param body Initiate transfer parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransferDetailsInner object + */ + public Observable initiateAsync(String billingAccountName, String invoiceSectionName, InitiateTransferRequest body) { + return initiateWithServiceResponseAsync(billingAccountName, invoiceSectionName, body).map(new Func1, TransferDetailsInner>() { + @Override + public TransferDetailsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Initiates the request to transfer the legacy subscriptions or RIs. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param body Initiate transfer parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransferDetailsInner object + */ + public Observable> initiateWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, InitiateTransferRequest body) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (body == null) { + throw new IllegalArgumentException("Parameter body is required and cannot be null."); + } + Validator.validate(body); + return service.initiate(billingAccountName, invoiceSectionName, body, 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 the transfer details for given transfer Id. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param transferName Transfer 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 TransferDetailsInner object if successful. + */ + public TransferDetailsInner get(String billingAccountName, String invoiceSectionName, String transferName) { + return getWithServiceResponseAsync(billingAccountName, invoiceSectionName, transferName).toBlocking().single().body(); + } + + /** + * Gets the transfer details for given transfer Id. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param transferName Transfer Name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String billingAccountName, String invoiceSectionName, String transferName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(billingAccountName, invoiceSectionName, transferName), serviceCallback); + } + + /** + * Gets the transfer details for given transfer Id. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param transferName Transfer Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransferDetailsInner object + */ + public Observable getAsync(String billingAccountName, String invoiceSectionName, String transferName) { + return getWithServiceResponseAsync(billingAccountName, invoiceSectionName, transferName).map(new Func1, TransferDetailsInner>() { + @Override + public TransferDetailsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the transfer details for given transfer Id. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param transferName Transfer Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransferDetailsInner object + */ + public Observable> getWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String transferName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (transferName == null) { + throw new IllegalArgumentException("Parameter transferName is required and cannot be null."); + } + return service.get(billingAccountName, 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 the transfer for given transfer Id. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param transferName Transfer 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 TransferDetailsInner object if successful. + */ + public TransferDetailsInner cancel(String billingAccountName, String invoiceSectionName, String transferName) { + return cancelWithServiceResponseAsync(billingAccountName, invoiceSectionName, transferName).toBlocking().single().body(); + } + + /** + * Cancels the transfer for given transfer Id. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param transferName Transfer Name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture cancelAsync(String billingAccountName, String invoiceSectionName, String transferName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(cancelWithServiceResponseAsync(billingAccountName, invoiceSectionName, transferName), serviceCallback); + } + + /** + * Cancels the transfer for given transfer Id. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param transferName Transfer Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransferDetailsInner object + */ + public Observable cancelAsync(String billingAccountName, String invoiceSectionName, String transferName) { + return cancelWithServiceResponseAsync(billingAccountName, invoiceSectionName, transferName).map(new Func1, TransferDetailsInner>() { + @Override + public TransferDetailsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Cancels the transfer for given transfer Id. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param transferName Transfer Name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TransferDetailsInner object + */ + public Observable> cancelWithServiceResponseAsync(String billingAccountName, String invoiceSectionName, String transferName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + if (transferName == null) { + throw new IllegalArgumentException("Parameter transferName is required and cannot be null."); + } + return service.cancel(billingAccountName, 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 all transfer's details initiated from given invoice section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<TransferDetailsInner> object if successful. + */ + public PagedList list(final String billingAccountName, final String invoiceSectionName) { + ServiceResponse> response = listSinglePageAsync(billingAccountName, invoiceSectionName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all transfer's details initiated from given invoice section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String billingAccountName, final String invoiceSectionName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(billingAccountName, invoiceSectionName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all transfer's details initiated from given invoice section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransferDetailsInner> object + */ + public Observable> listAsync(final String billingAccountName, final String invoiceSectionName) { + return listWithServiceResponseAsync(billingAccountName, invoiceSectionName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all transfer's details initiated from given invoice section. + * + * @param billingAccountName Billing Account Id. + * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<TransferDetailsInner> object + */ + public Observable>> listWithServiceResponseAsync(final String billingAccountName, final String invoiceSectionName) { + return listSinglePageAsync(billingAccountName, invoiceSectionName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all transfer's details initiated from given invoice section. + * + ServiceResponse> * @param billingAccountName Billing Account Id. + ServiceResponse> * @param invoiceSectionName InvoiceSection Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<TransferDetailsInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String billingAccountName, final String invoiceSectionName) { + if (billingAccountName == null) { + throw new IllegalArgumentException("Parameter billingAccountName is required and cannot be null."); + } + if (invoiceSectionName == null) { + throw new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null."); + } + return service.list(billingAccountName, 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 all transfer's details initiated from given invoice section. + * + * @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 all transfer's details initiated from given invoice section. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all transfer's details initiated from given invoice section. + * + * @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 all transfer's details initiated from given invoice section. + * + * @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 all transfer's details initiated from given invoice section. + * + 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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/UpdateAutoRenewOperationSummaryImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/UpdateAutoRenewOperationSummaryImpl.java new file mode 100644 index 0000000000000..86b6d1dde6d7e --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/UpdateAutoRenewOperationSummaryImpl.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.UpdateAutoRenewOperationSummary; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import org.joda.time.DateTime; + +class UpdateAutoRenewOperationSummaryImpl extends WrapperImpl implements UpdateAutoRenewOperationSummary { + private final BillingManager manager; + UpdateAutoRenewOperationSummaryImpl(UpdateAutoRenewOperationSummaryInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public DateTime endDate() { + return this.inner().endDate(); + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/UpdateAutoRenewOperationSummaryInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/UpdateAutoRenewOperationSummaryInner.java new file mode 100644 index 0000000000000..ece2c58fb8d4d --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/UpdateAutoRenewOperationSummaryInner.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2018_11_01_preview.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Summary of cancel product operation. + */ +@JsonFlatten +public class UpdateAutoRenewOperationSummaryInner { + /** + * The end date of this asset. + */ + @JsonProperty(value = "properties.endDate") + private DateTime endDate; + + /** + * Get the end date of this asset. + * + * @return the endDate value + */ + public DateTime endDate() { + return this.endDate; + } + + /** + * Set the end date of this asset. + * + * @param endDate the endDate value to set + * @return the UpdateAutoRenewOperationSummaryInner object itself. + */ + public UpdateAutoRenewOperationSummaryInner withEndDate(DateTime endDate) { + this.endDate = endDate; + return this; + } + +} diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ValidateAddressResponseImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ValidateAddressResponseImpl.java new file mode 100644 index 0000000000000..da34924b8644b --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ValidateAddressResponseImpl.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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.ValidateAddressResponse; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_01_preview.AddressValidationStatus; +import java.util.List; + +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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ValidateAddressResponseInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ValidateAddressResponseInner.java new file mode 100644 index 0000000000000..b851cb9ad30d4 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ValidateAddressResponseInner.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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.AddressValidationStatus; +import java.util.List; +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; + + /** + * 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 list of suggested addresses. + * + * @return the suggestedAddresses value + */ + public List suggestedAddresses() { + return this.suggestedAddresses; + } + + /** + * Set 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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ValidateProductTransferEligibilityResultImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ValidateProductTransferEligibilityResultImpl.java new file mode 100644 index 0000000000000..956a316f58abd --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.ValidateProductTransferEligibilityResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ValidateProductTransferEligibilityResultInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ValidateProductTransferEligibilityResultInner.java new file mode 100644 index 0000000000000..fd1c94a3835b0 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ValidateSubscriptionTransferEligibilityResultImpl.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ValidateSubscriptionTransferEligibilityResultImpl.java new file mode 100644 index 0000000000000..27b974a18b08b --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.ValidateSubscriptionTransferEligibilityResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2018_11_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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ValidateSubscriptionTransferEligibilityResultInner.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/ValidateSubscriptionTransferEligibilityResultInner.java new file mode 100644 index 0000000000000..daf9193fbc03a --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; + +import com.microsoft.azure.management.billing.v2018_11_01_preview.ValidateSubscriptionTransferEligibilityError; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of the transfer eligibility validation. + */ +public class ValidateSubscriptionTransferEligibilityResultInner { + /** + * 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 ValidateSubscriptionTransferEligibilityError 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 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-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/package-info.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/implementation/package-info.java new file mode 100644 index 0000000000000..5df83b96788db --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview.implementation; diff --git a/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/package-info.java b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_01_preview/package-info.java new file mode 100644 index 0000000000000..aac8f7553cd43 --- /dev/null +++ b/sdk/billing/mgmt-v2018_11_01_preview/src/main/java/com/microsoft/azure/management/billing/v2018_11_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.v2018_11_01_preview;