From abadfdaf76e7634622b9daf735d79cb7f7b2b119 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 30 Mar 2021 22:22:27 +0000 Subject: [PATCH] CodeGen from PR 13735 in Azure/azure-rest-api-specs Merge d7b6fcbde88519b2193ede7ad1d6993accffd9fe into e6fa7db931a3e5182e5685630971b64987719938 --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 5 + .../azure-resourcemanager-billing/README.md | 99 + .../azure-resourcemanager-billing/pom.xml | 67 + .../billing/BillingManager.java | 456 ++++ .../billing/fluent/AddressClient.java | 40 + .../billing/fluent/AgreementsClient.java | 70 + .../fluent/AvailableBalancesClient.java | 46 + .../billing/fluent/BillingAccountsClient.java | 157 ++ .../fluent/BillingManagementClient.java | 186 ++ .../billing/fluent/BillingPeriodsClient.java | 74 + .../fluent/BillingPermissionsClient.java | 127 + .../billing/fluent/BillingProfilesClient.java | 142 + .../fluent/BillingPropertiesClient.java | 65 + .../fluent/BillingRoleAssignmentsClient.java | 316 +++ .../fluent/BillingRoleDefinitionsClient.java | 211 ++ .../fluent/BillingSubscriptionsClient.java | 292 ++ .../billing/fluent/CustomersClient.java | 110 + .../fluent/EnrollmentAccountsClient.java | 62 + .../billing/fluent/InstructionsClient.java | 112 + .../billing/fluent/InvoiceSectionsClient.java | 163 ++ .../billing/fluent/InvoicesClient.java | 438 +++ .../billing/fluent/OperationsClient.java | 36 + .../billing/fluent/PoliciesClient.java | 139 + .../billing/fluent/ProductsClient.java | 280 ++ .../billing/fluent/ReservationsClient.java | 91 + .../billing/fluent/TransactionsClient.java | 41 + .../billing/fluent/models/AgreementInner.java | 152 ++ .../fluent/models/AvailableBalanceInner.java | 46 + .../fluent/models/BillingAccountInner.java | 264 ++ .../fluent/models/BillingPeriodInner.java | 74 + .../BillingPermissionsPropertiesInner.java | 55 + .../fluent/models/BillingProfileInner.java | 371 +++ .../fluent/models/BillingPropertyInner.java | 298 +++ .../models/BillingRoleAssignmentInner.java | 232 ++ .../models/BillingRoleDefinitionInner.java | 87 + .../models/BillingSubscriptionInner.java | 304 +++ .../billing/fluent/models/CustomerInner.java | 145 + .../fluent/models/CustomerPolicyInner.java | 57 + .../fluent/models/DownloadUrlInner.java | 55 + .../models/EnrollmentAccountSummaryInner.java | 42 + .../fluent/models/InstructionInner.java | 132 + .../billing/fluent/models/InvoiceInner.java | 475 ++++ .../fluent/models/InvoiceSectionInner.java | 131 + ...ceSectionWithCreateSubPermissionInner.java | 193 ++ .../billing/fluent/models/OperationInner.java | 69 + .../billing/fluent/models/PolicyInner.java | 117 + .../billing/fluent/models/ProductInner.java | 406 +++ .../fluent/models/ReservationInner.java | 391 +++ .../fluent/models/TransactionInner.java | 641 +++++ .../models/ValidateAddressResponseInner.java | 108 + ...ProductTransferEligibilityResultInner.java | 71 + ...riptionTransferEligibilityResultInner.java | 71 + .../billing/fluent/models/package-info.java | 9 + .../billing/fluent/package-info.java | 9 + .../implementation/AddressClientImpl.java | 178 ++ .../billing/implementation/AddressImpl.java | 59 + .../billing/implementation/AgreementImpl.java | 78 + .../implementation/AgreementsClientImpl.java | 499 ++++ .../implementation/AgreementsImpl.java | 73 + .../implementation/AvailableBalanceImpl.java | 45 + .../AvailableBalancesClientImpl.java | 214 ++ .../implementation/AvailableBalancesImpl.java | 61 + .../implementation/BillingAccountImpl.java | 100 + .../BillingAccountsClientImpl.java | 949 +++++++ .../implementation/BillingAccountsImpl.java | 105 + .../BillingManagementClientBuilder.java | 146 + .../BillingManagementClientImpl.java | 560 ++++ .../implementation/BillingPeriodImpl.java | 59 + .../BillingPeriodsClientImpl.java | 525 ++++ .../implementation/BillingPeriodsImpl.java | 70 + .../BillingPermissionsClientImpl.java | 1113 ++++++++ .../BillingPermissionsImpl.java | 92 + .../BillingPermissionsPropertiesImpl.java | 49 + .../implementation/BillingProfileImpl.java | 125 + .../BillingProfilesClientImpl.java | 802 ++++++ .../implementation/BillingProfilesImpl.java | 96 + .../BillingPropertiesClientImpl.java | 331 +++ .../implementation/BillingPropertiesImpl.java | 81 + .../implementation/BillingPropertyImpl.java | 111 + .../BillingRoleAssignmentImpl.java | 80 + .../BillingRoleAssignmentsClientImpl.java | 1992 ++++++++++++++ .../BillingRoleAssignmentsImpl.java | 271 ++ .../BillingRoleDefinitionImpl.java | 67 + .../BillingRoleDefinitionsClientImpl.java | 1431 ++++++++++ .../BillingRoleDefinitionsImpl.java | 174 ++ .../BillingSubscriptionImpl.java | 104 + .../BillingSubscriptionsClientImpl.java | 1930 ++++++++++++++ .../BillingSubscriptionsImpl.java | 187 ++ .../billing/implementation/CustomerImpl.java | 73 + .../implementation/CustomerPolicyImpl.java | 45 + .../implementation/CustomersClientImpl.java | 845 ++++++ .../billing/implementation/CustomersImpl.java | 86 + .../implementation/DownloadUrlImpl.java | 36 + .../EnrollmentAccountSummaryImpl.java | 44 + .../EnrollmentAccountsClientImpl.java | 387 +++ .../EnrollmentAccountsImpl.java | 70 + .../implementation/InstructionImpl.java | 56 + .../InstructionsClientImpl.java | 700 +++++ .../implementation/InstructionsImpl.java | 107 + .../billing/implementation/InvoiceImpl.java | 165 ++ .../implementation/InvoiceSectionImpl.java | 69 + ...iceSectionWithCreateSubPermissionImpl.java | 80 + .../InvoiceSectionsClientImpl.java | 856 ++++++ .../implementation/InvoiceSectionsImpl.java | 107 + .../implementation/InvoicesClientImpl.java | 2364 +++++++++++++++++ .../billing/implementation/InvoicesImpl.java | 235 ++ .../billing/implementation/OperationImpl.java | 36 + .../implementation/OperationsClientImpl.java | 270 ++ .../implementation/OperationsImpl.java | 46 + .../implementation/PoliciesClientImpl.java | 704 +++++ .../billing/implementation/PoliciesImpl.java | 135 + .../billing/implementation/PolicyImpl.java | 54 + .../billing/implementation/ProductImpl.java | 133 + .../implementation/ProductsClientImpl.java | 1909 +++++++++++++ .../billing/implementation/ProductsImpl.java | 192 ++ .../implementation/ReservationImpl.java | 124 + .../ReservationsClientImpl.java | 772 ++++++ .../implementation/ReservationsImpl.java | 77 + .../implementation/TransactionImpl.java | 187 ++ .../TransactionsClientImpl.java | 312 +++ .../implementation/TransactionsImpl.java | 47 + .../billing/implementation/Utils.java | 204 ++ .../ValidateAddressResponseImpl.java | 49 + ...eProductTransferEligibilityResultImpl.java | 38 + ...criptionTransferEligibilityResultImpl.java | 39 + .../billing/implementation/package-info.java | 9 + .../billing/models/AcceptanceMode.java | 37 + .../billing/models/AccountStatus.java | 49 + .../billing/models/AccountType.java | 37 + .../billing/models/Address.java | 34 + .../billing/models/AddressDetails.java | 372 +++ .../models/AddressValidationStatus.java | 34 + .../billing/models/Agreement.java | 89 + .../billing/models/AgreementListResult.java | 59 + .../billing/models/AgreementType.java | 40 + .../billing/models/Agreements.java | 63 + .../billing/models/Amount.java | 65 + .../billing/models/AutoRenew.java | 34 + .../billing/models/AvailableBalance.java | 45 + .../billing/models/AvailableBalances.java | 40 + .../billing/models/AzurePlan.java | 65 + .../billing/models/BillingAccount.java | 112 + .../models/BillingAccountListResult.java | 59 + .../models/BillingAccountUpdateRequest.java | 255 ++ .../billing/models/BillingAccounts.java | 111 + .../billing/models/BillingFrequency.java | 37 + .../billing/models/BillingPeriod.java | 61 + .../billing/models/BillingPeriods.java | 67 + .../models/BillingPeriodsListResult.java | 61 + .../billing/models/BillingPermissions.java | 116 + .../models/BillingPermissionsListResult.java | 59 + .../models/BillingPermissionsProperties.java | 32 + .../billing/models/BillingProfile.java | 157 ++ .../models/BillingProfileListResult.java | 59 + .../models/BillingProfileSpendingLimit.java | 34 + .../billing/models/BillingProfileStatus.java | 37 + .../BillingProfileStatusReasonCode.java | 37 + .../billing/models/BillingProfiles.java | 98 + .../BillingProfilesCreateOrUpdateHeaders.java | 76 + ...BillingProfilesCreateOrUpdateResponse.java | 38 + .../models/BillingProfilesOnExpand.java | 78 + .../billing/models/BillingProperties.java | 59 + .../billing/models/BillingProperty.java | 158 ++ .../models/BillingRelationshipType.java | 40 + .../billing/models/BillingRoleAssignment.java | 108 + .../BillingRoleAssignmentListResult.java | 59 + .../models/BillingRoleAssignments.java | 294 ++ .../billing/models/BillingRoleDefinition.java | 60 + .../BillingRoleDefinitionListResult.java | 59 + .../models/BillingRoleDefinitions.java | 195 ++ .../billing/models/BillingSubscription.java | 146 + .../models/BillingSubscriptionStatusType.java | 43 + .../billing/models/BillingSubscriptions.java | 236 ++ .../BillingSubscriptionsListResult.java | 59 + .../BillingSubscriptionsMoveHeaders.java | 76 + .../BillingSubscriptionsMoveResponse.java | 38 + .../billing/models/Category.java | 37 + .../billing/models/Customer.java | 74 + .../billing/models/CustomerListResult.java | 59 + .../billing/models/CustomerPolicy.java | 46 + .../billing/models/Customers.java | 100 + .../billing/models/Department.java | 138 + .../billing/models/Document.java | 70 + .../billing/models/DocumentSource.java | 34 + .../billing/models/DocumentType.java | 40 + .../billing/models/DownloadUrl.java | 32 + .../billing/models/Enrollment.java | 185 ++ .../billing/models/EnrollmentAccount.java | 216 ++ .../models/EnrollmentAccountListResult.java | 59 + .../models/EnrollmentAccountSummary.java | 45 + .../billing/models/EnrollmentAccounts.java | 55 + .../billing/models/EnrollmentPolicies.java | 90 + .../billing/models/ErrorSubDetailsItem.java | 69 + .../models/IndirectRelationshipInfo.java | 108 + .../billing/models/Instruction.java | 67 + .../billing/models/InstructionListResult.java | 59 + .../billing/models/Instructions.java | 104 + .../billing/models/Invoice.java | 226 ++ .../billing/models/InvoiceDocumentType.java | 34 + .../billing/models/InvoiceListResult.java | 59 + .../billing/models/InvoiceSection.java | 76 + .../models/InvoiceSectionListResult.java | 59 + ...tionListWithCreateSubPermissionResult.java | 73 + .../billing/models/InvoiceSectionState.java | 34 + ...InvoiceSectionWithCreateSubPermission.java | 88 + .../billing/models/InvoiceSections.java | 111 + .../InvoiceSectionsCreateOrUpdateHeaders.java | 76 + ...InvoiceSectionsCreateOrUpdateResponse.java | 38 + .../models/InvoiceSectionsOnExpand.java | 78 + .../billing/models/InvoiceStatus.java | 40 + .../billing/models/InvoiceType.java | 37 + .../billing/models/Invoices.java | 288 ++ ...loadBillingSubscriptionInvoiceHeaders.java | 77 + ...oadBillingSubscriptionInvoiceResponse.java | 38 + .../InvoicesDownloadInvoiceHeaders.java | 76 + .../InvoicesDownloadInvoiceResponse.java | 38 + ...MultipleBillingProfileInvoicesHeaders.java | 77 + ...ultipleBillingProfileInvoicesResponse.java | 38 + ...pleBillingSubscriptionInvoicesHeaders.java | 78 + ...leBillingSubscriptionInvoicesResponse.java | 38 + .../models/MarketplacePurchasesPolicy.java | 37 + .../billing/models/Operation.java | 31 + .../billing/models/OperationDisplay.java | 70 + .../billing/models/OperationListResult.java | 60 + .../billing/models/Operations.java | 31 + .../billing/models/Participants.java | 70 + .../billing/models/PaymentMethodFamily.java | 40 + .../billing/models/PaymentProperties.java | 114 + .../billing/models/Policies.java | 128 + .../billing/models/Policy.java | 62 + .../billing/models/Product.java | 195 ++ .../billing/models/ProductStatusType.java | 52 + .../ProductTransferValidationErrorCode.java | 62 + .../billing/models/Products.java | 259 ++ .../billing/models/ProductsListResult.java | 62 + .../billing/models/ProductsMoveHeaders.java | 76 + .../billing/models/ProductsMoveResponse.java | 33 + .../billing/models/RebillDetails.java | 80 + .../billing/models/Reseller.java | 54 + .../billing/models/Reservation.java | 175 ++ .../ReservationPropertyUtilization.java | 69 + .../models/ReservationPurchasesPolicy.java | 34 + .../models/ReservationSkuProperty.java | 39 + .../billing/models/ReservationSummary.java | 114 + .../billing/models/ReservationType.java | 34 + .../ReservationUtilizationAggregates.java | 84 + .../billing/models/Reservations.java | 84 + .../models/ReservationsListResult.java | 88 + .../billing/models/SpendingLimit.java | 34 + .../SpendingLimitForBillingProfile.java | 34 + .../billing/models/StatusReasonCode.java | 37 + .../StatusReasonCodeForBillingProfile.java | 37 + ...bscriptionTransferValidationErrorCode.java | 105 + .../billing/models/TargetCloud.java | 37 + .../billing/models/Transaction.java | 305 +++ .../billing/models/TransactionListResult.java | 59 + .../billing/models/TransactionTypeKind.java | 34 + .../billing/models/Transactions.java | 36 + ...rBillingSubscriptionRequestProperties.java | 59 + .../TransferProductRequestProperties.java | 50 + .../models/ValidateAddressResponse.java | 39 + ...lidateProductTransferEligibilityError.java | 102 + ...idateProductTransferEligibilityResult.java | 32 + ...eSubscriptionTransferEligibilityError.java | 103 + ...SubscriptionTransferEligibilityResult.java | 32 + .../billing/models/ViewCharges.java | 34 + .../billing/models/ViewChargesPolicy.java | 34 + .../billing/models/package-info.java | 9 + .../resourcemanager/billing/package-info.java | 9 + .../src/main/java/module-info.java | 19 + sdk/billing/ci.yml | 33 + sdk/billing/pom.xml | 53 + 274 files changed, 44555 insertions(+) create mode 100644 sdk/billing/azure-resourcemanager-billing/CHANGELOG.md create mode 100644 sdk/billing/azure-resourcemanager-billing/README.md create mode 100644 sdk/billing/azure-resourcemanager-billing/pom.xml create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/BillingManager.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/AddressClient.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/AgreementsClient.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/AvailableBalancesClient.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingAccountsClient.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingManagementClient.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingPeriodsClient.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingPermissionsClient.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingProfilesClient.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingPropertiesClient.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingRoleAssignmentsClient.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingRoleDefinitionsClient.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingSubscriptionsClient.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/CustomersClient.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/EnrollmentAccountsClient.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/InstructionsClient.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/InvoiceSectionsClient.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/InvoicesClient.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/OperationsClient.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/PoliciesClient.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/ProductsClient.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/ReservationsClient.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/TransactionsClient.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/AgreementInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/AvailableBalanceInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingAccountInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingPeriodInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingPermissionsPropertiesInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingProfileInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingPropertyInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingRoleAssignmentInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingRoleDefinitionInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingSubscriptionInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/CustomerInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/CustomerPolicyInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/DownloadUrlInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/EnrollmentAccountSummaryInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InstructionInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InvoiceInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InvoiceSectionInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InvoiceSectionWithCreateSubPermissionInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/OperationInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/PolicyInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/ProductInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/ReservationInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/TransactionInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/ValidateAddressResponseInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/ValidateProductTransferEligibilityResultInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/ValidateSubscriptionTransferEligibilityResultInner.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/package-info.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/package-info.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AddressClientImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AddressImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AgreementImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AgreementsClientImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AgreementsImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AvailableBalanceImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AvailableBalancesClientImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AvailableBalancesImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingAccountImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingAccountsClientImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingAccountsImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingManagementClientBuilder.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingManagementClientImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPeriodImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPeriodsClientImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPeriodsImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPermissionsClientImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPermissionsImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPermissionsPropertiesImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingProfileImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingProfilesClientImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingProfilesImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPropertiesClientImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPropertiesImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPropertyImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleAssignmentImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleAssignmentsClientImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleAssignmentsImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleDefinitionImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleDefinitionsClientImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleDefinitionsImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingSubscriptionImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingSubscriptionsClientImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingSubscriptionsImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/CustomerImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/CustomerPolicyImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/CustomersClientImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/CustomersImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/DownloadUrlImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/EnrollmentAccountSummaryImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/EnrollmentAccountsClientImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/EnrollmentAccountsImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InstructionImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InstructionsClientImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InstructionsImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceSectionImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceSectionWithCreateSubPermissionImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceSectionsClientImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceSectionsImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoicesClientImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoicesImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/OperationImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/OperationsClientImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/OperationsImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/PoliciesClientImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/PoliciesImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/PolicyImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ProductImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ProductsClientImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ProductsImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ReservationImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ReservationsClientImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ReservationsImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/TransactionImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/TransactionsClientImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/TransactionsImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/Utils.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ValidateAddressResponseImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ValidateProductTransferEligibilityResultImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ValidateSubscriptionTransferEligibilityResultImpl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/package-info.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AcceptanceMode.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AccountStatus.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AccountType.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Address.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AddressDetails.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AddressValidationStatus.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Agreement.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AgreementListResult.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AgreementType.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Agreements.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Amount.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AutoRenew.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AvailableBalance.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AvailableBalances.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AzurePlan.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingAccount.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingAccountListResult.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingAccountUpdateRequest.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingAccounts.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingFrequency.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPeriod.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPeriods.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPeriodsListResult.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPermissions.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPermissionsListResult.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPermissionsProperties.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfile.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfileListResult.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfileSpendingLimit.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfileStatus.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfileStatusReasonCode.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfiles.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfilesCreateOrUpdateHeaders.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfilesCreateOrUpdateResponse.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfilesOnExpand.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProperties.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProperty.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRelationshipType.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleAssignment.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleAssignmentListResult.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleAssignments.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleDefinition.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleDefinitionListResult.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleDefinitions.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscription.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionStatusType.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptions.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionsListResult.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionsMoveHeaders.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionsMoveResponse.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Category.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Customer.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/CustomerListResult.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/CustomerPolicy.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Customers.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Department.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Document.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/DocumentSource.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/DocumentType.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/DownloadUrl.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Enrollment.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/EnrollmentAccount.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/EnrollmentAccountListResult.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/EnrollmentAccountSummary.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/EnrollmentAccounts.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/EnrollmentPolicies.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ErrorSubDetailsItem.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/IndirectRelationshipInfo.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Instruction.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InstructionListResult.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Instructions.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Invoice.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceDocumentType.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceListResult.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSection.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionListResult.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionListWithCreateSubPermissionResult.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionState.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionWithCreateSubPermission.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSections.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionsCreateOrUpdateHeaders.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionsCreateOrUpdateResponse.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionsOnExpand.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceStatus.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceType.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Invoices.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadBillingSubscriptionInvoiceHeaders.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadBillingSubscriptionInvoiceResponse.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadInvoiceHeaders.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadInvoiceResponse.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadMultipleBillingProfileInvoicesHeaders.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadMultipleBillingProfileInvoicesResponse.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadMultipleBillingSubscriptionInvoicesResponse.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/MarketplacePurchasesPolicy.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Operation.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/OperationDisplay.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/OperationListResult.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Operations.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Participants.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/PaymentMethodFamily.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/PaymentProperties.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Policies.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Policy.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Product.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductStatusType.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductTransferValidationErrorCode.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Products.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductsListResult.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductsMoveHeaders.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductsMoveResponse.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/RebillDetails.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Reseller.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Reservation.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationPropertyUtilization.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationPurchasesPolicy.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationSkuProperty.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationSummary.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationType.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationUtilizationAggregates.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Reservations.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationsListResult.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/SpendingLimit.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/SpendingLimitForBillingProfile.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/StatusReasonCode.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/StatusReasonCodeForBillingProfile.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/SubscriptionTransferValidationErrorCode.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TargetCloud.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Transaction.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransactionListResult.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransactionTypeKind.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Transactions.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransferBillingSubscriptionRequestProperties.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransferProductRequestProperties.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ValidateAddressResponse.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ValidateProductTransferEligibilityError.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ValidateProductTransferEligibilityResult.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ValidateSubscriptionTransferEligibilityError.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ValidateSubscriptionTransferEligibilityResult.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ViewCharges.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ViewChargesPolicy.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/package-info.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/package-info.java create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/java/module-info.java create mode 100644 sdk/billing/ci.yml create mode 100644 sdk/billing/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 047cc34a7de57..adec505f2bed3 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -220,6 +220,7 @@ com.azure.resourcemanager:azure-resourcemanager-kubernetesconfiguration;1.0.0-be com.azure.resourcemanager:azure-resourcemanager-resourcegraph;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-changeanalysis;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-delegatednetwork;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-billing;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. diff --git a/pom.xml b/pom.xml index 5c5f884ed3871..07bea08c921aa 100644 --- a/pom.xml +++ b/pom.xml @@ -657,6 +657,7 @@ sdk/attestation sdk/authorization sdk/batch + sdk/billing sdk/boms sdk/changeanalysis sdk/cognitiveservices diff --git a/sdk/billing/azure-resourcemanager-billing/CHANGELOG.md b/sdk/billing/azure-resourcemanager-billing/CHANGELOG.md new file mode 100644 index 0000000000000..4bef046d124c3 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-03-30) + +- Azure Resource Manager Billing client library for Java. This package contains Microsoft Azure SDK for Billing Management SDK. Billing client provides access to billing resources for Azure subscriptions. Package tag package-2020-05. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/billing/azure-resourcemanager-billing/README.md b/sdk/billing/azure-resourcemanager-billing/README.md new file mode 100644 index 0000000000000..d4c02a9503711 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/README.md @@ -0,0 +1,99 @@ +# Azure Resource Manager Billing client library for Java + +Azure Resource Manager Billing client library for Java. + +This package contains Microsoft Azure SDK for Billing Management SDK. Billing client provides access to billing resources for Azure subscriptions. Package tag package-2020-05. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-billing;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-billing + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +BillingManager manager = BillingManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/billing/azure-resourcemanager-billing/pom.xml b/sdk/billing/azure-resourcemanager-billing/pom.xml new file mode 100644 index 0000000000000..fcf5629fd1875 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/pom.xml @@ -0,0 +1,67 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-billing + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Billing Management + This package contains Microsoft Azure SDK for Billing Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Billing client provides access to billing resources for Azure subscriptions. Package tag package-2020-05. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.14.1 + + + com.azure + azure-core-management + 1.2.0 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/BillingManager.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/BillingManager.java new file mode 100644 index 0000000000000..45265eb1e0b17 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/BillingManager.java @@ -0,0 +1,456 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.BillingManagementClient; +import com.azure.resourcemanager.billing.implementation.AddressImpl; +import com.azure.resourcemanager.billing.implementation.AgreementsImpl; +import com.azure.resourcemanager.billing.implementation.AvailableBalancesImpl; +import com.azure.resourcemanager.billing.implementation.BillingAccountsImpl; +import com.azure.resourcemanager.billing.implementation.BillingManagementClientBuilder; +import com.azure.resourcemanager.billing.implementation.BillingPeriodsImpl; +import com.azure.resourcemanager.billing.implementation.BillingPermissionsImpl; +import com.azure.resourcemanager.billing.implementation.BillingProfilesImpl; +import com.azure.resourcemanager.billing.implementation.BillingPropertiesImpl; +import com.azure.resourcemanager.billing.implementation.BillingRoleAssignmentsImpl; +import com.azure.resourcemanager.billing.implementation.BillingRoleDefinitionsImpl; +import com.azure.resourcemanager.billing.implementation.BillingSubscriptionsImpl; +import com.azure.resourcemanager.billing.implementation.CustomersImpl; +import com.azure.resourcemanager.billing.implementation.EnrollmentAccountsImpl; +import com.azure.resourcemanager.billing.implementation.InstructionsImpl; +import com.azure.resourcemanager.billing.implementation.InvoiceSectionsImpl; +import com.azure.resourcemanager.billing.implementation.InvoicesImpl; +import com.azure.resourcemanager.billing.implementation.OperationsImpl; +import com.azure.resourcemanager.billing.implementation.PoliciesImpl; +import com.azure.resourcemanager.billing.implementation.ProductsImpl; +import com.azure.resourcemanager.billing.implementation.ReservationsImpl; +import com.azure.resourcemanager.billing.implementation.TransactionsImpl; +import com.azure.resourcemanager.billing.models.Address; +import com.azure.resourcemanager.billing.models.Agreements; +import com.azure.resourcemanager.billing.models.AvailableBalances; +import com.azure.resourcemanager.billing.models.BillingAccounts; +import com.azure.resourcemanager.billing.models.BillingPeriods; +import com.azure.resourcemanager.billing.models.BillingPermissions; +import com.azure.resourcemanager.billing.models.BillingProfiles; +import com.azure.resourcemanager.billing.models.BillingProperties; +import com.azure.resourcemanager.billing.models.BillingRoleAssignments; +import com.azure.resourcemanager.billing.models.BillingRoleDefinitions; +import com.azure.resourcemanager.billing.models.BillingSubscriptions; +import com.azure.resourcemanager.billing.models.Customers; +import com.azure.resourcemanager.billing.models.EnrollmentAccounts; +import com.azure.resourcemanager.billing.models.Instructions; +import com.azure.resourcemanager.billing.models.InvoiceSections; +import com.azure.resourcemanager.billing.models.Invoices; +import com.azure.resourcemanager.billing.models.Operations; +import com.azure.resourcemanager.billing.models.Policies; +import com.azure.resourcemanager.billing.models.Products; +import com.azure.resourcemanager.billing.models.Reservations; +import com.azure.resourcemanager.billing.models.Transactions; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to BillingManager. Billing client provides access to billing resources for Azure subscriptions. */ +public final class BillingManager { + private BillingAccounts billingAccounts; + + private Address address; + + private AvailableBalances availableBalances; + + private Instructions instructions; + + private BillingProfiles billingProfiles; + + private Customers customers; + + private InvoiceSections invoiceSections; + + private BillingPermissions billingPermissions; + + private BillingSubscriptions billingSubscriptions; + + private Products products; + + private Invoices invoices; + + private Transactions transactions; + + private Policies policies; + + private BillingProperties billingProperties; + + private Operations operations; + + private BillingRoleDefinitions billingRoleDefinitions; + + private BillingRoleAssignments billingRoleAssignments; + + private Agreements agreements; + + private Reservations reservations; + + private EnrollmentAccounts enrollmentAccounts; + + private BillingPeriods billingPeriods; + + private final BillingManagementClient clientObject; + + private BillingManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new BillingManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Billing service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Billing service API instance. + */ + public static BillingManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create BillingManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new BillingManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Billing service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Billing service API instance. + */ + public BillingManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.billing") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new BillingManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of BillingAccounts. */ + public BillingAccounts billingAccounts() { + if (this.billingAccounts == null) { + this.billingAccounts = new BillingAccountsImpl(clientObject.getBillingAccounts(), this); + } + return billingAccounts; + } + + /** @return Resource collection API of Address. */ + public Address address() { + if (this.address == null) { + this.address = new AddressImpl(clientObject.getAddress(), this); + } + return address; + } + + /** @return Resource collection API of AvailableBalances. */ + public AvailableBalances availableBalances() { + if (this.availableBalances == null) { + this.availableBalances = new AvailableBalancesImpl(clientObject.getAvailableBalances(), this); + } + return availableBalances; + } + + /** @return Resource collection API of Instructions. */ + public Instructions instructions() { + if (this.instructions == null) { + this.instructions = new InstructionsImpl(clientObject.getInstructions(), this); + } + return instructions; + } + + /** @return Resource collection API of BillingProfiles. */ + public BillingProfiles billingProfiles() { + if (this.billingProfiles == null) { + this.billingProfiles = new BillingProfilesImpl(clientObject.getBillingProfiles(), this); + } + return billingProfiles; + } + + /** @return Resource collection API of Customers. */ + public Customers customers() { + if (this.customers == null) { + this.customers = new CustomersImpl(clientObject.getCustomers(), this); + } + return customers; + } + + /** @return Resource collection API of InvoiceSections. */ + public InvoiceSections invoiceSections() { + if (this.invoiceSections == null) { + this.invoiceSections = new InvoiceSectionsImpl(clientObject.getInvoiceSections(), this); + } + return invoiceSections; + } + + /** @return Resource collection API of BillingPermissions. */ + public BillingPermissions billingPermissions() { + if (this.billingPermissions == null) { + this.billingPermissions = new BillingPermissionsImpl(clientObject.getBillingPermissions(), this); + } + return billingPermissions; + } + + /** @return Resource collection API of BillingSubscriptions. */ + public BillingSubscriptions billingSubscriptions() { + if (this.billingSubscriptions == null) { + this.billingSubscriptions = new BillingSubscriptionsImpl(clientObject.getBillingSubscriptions(), this); + } + return billingSubscriptions; + } + + /** @return Resource collection API of Products. */ + public Products products() { + if (this.products == null) { + this.products = new ProductsImpl(clientObject.getProducts(), this); + } + return products; + } + + /** @return Resource collection API of Invoices. */ + public Invoices invoices() { + if (this.invoices == null) { + this.invoices = new InvoicesImpl(clientObject.getInvoices(), this); + } + return invoices; + } + + /** @return Resource collection API of Transactions. */ + public Transactions transactions() { + if (this.transactions == null) { + this.transactions = new TransactionsImpl(clientObject.getTransactions(), this); + } + return transactions; + } + + /** @return Resource collection API of Policies. */ + public Policies policies() { + if (this.policies == null) { + this.policies = new PoliciesImpl(clientObject.getPolicies(), this); + } + return policies; + } + + /** @return Resource collection API of BillingProperties. */ + public BillingProperties billingProperties() { + if (this.billingProperties == null) { + this.billingProperties = new BillingPropertiesImpl(clientObject.getBillingProperties(), this); + } + return billingProperties; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of BillingRoleDefinitions. */ + public BillingRoleDefinitions billingRoleDefinitions() { + if (this.billingRoleDefinitions == null) { + this.billingRoleDefinitions = + new BillingRoleDefinitionsImpl(clientObject.getBillingRoleDefinitions(), this); + } + return billingRoleDefinitions; + } + + /** @return Resource collection API of BillingRoleAssignments. */ + public BillingRoleAssignments billingRoleAssignments() { + if (this.billingRoleAssignments == null) { + this.billingRoleAssignments = + new BillingRoleAssignmentsImpl(clientObject.getBillingRoleAssignments(), this); + } + return billingRoleAssignments; + } + + /** @return Resource collection API of Agreements. */ + public Agreements agreements() { + if (this.agreements == null) { + this.agreements = new AgreementsImpl(clientObject.getAgreements(), this); + } + return agreements; + } + + /** @return Resource collection API of Reservations. */ + public Reservations reservations() { + if (this.reservations == null) { + this.reservations = new ReservationsImpl(clientObject.getReservations(), this); + } + return reservations; + } + + /** @return Resource collection API of EnrollmentAccounts. */ + public EnrollmentAccounts enrollmentAccounts() { + if (this.enrollmentAccounts == null) { + this.enrollmentAccounts = new EnrollmentAccountsImpl(clientObject.getEnrollmentAccounts(), this); + } + return enrollmentAccounts; + } + + /** @return Resource collection API of BillingPeriods. */ + public BillingPeriods billingPeriods() { + if (this.billingPeriods == null) { + this.billingPeriods = new BillingPeriodsImpl(clientObject.getBillingPeriods(), this); + } + return billingPeriods; + } + + /** + * @return Wrapped service client BillingManagementClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + */ + public BillingManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/AddressClient.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/AddressClient.java new file mode 100644 index 0000000000000..66eecfbbab468 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/AddressClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.billing.fluent.models.ValidateAddressResponseInner; +import com.azure.resourcemanager.billing.models.AddressDetails; + +/** An instance of this class provides access to all the operations defined in AddressClient. */ +public interface AddressClient { + /** + * Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. + * + * @param address Address details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the address validation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ValidateAddressResponseInner validate(AddressDetails address); + + /** + * Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. + * + * @param address Address details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the address validation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response validateWithResponse(AddressDetails address, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/AgreementsClient.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/AgreementsClient.java new file mode 100644 index 0000000000000..ad29ace3539db --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/AgreementsClient.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.billing.fluent.models.AgreementInner; + +/** An instance of this class provides access to all the operations defined in AgreementsClient. */ +public interface AgreementsClient { + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing agreements. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingAccount(String billingAccountName); + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the participants. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing agreements. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingAccount(String billingAccountName, String expand, Context context); + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an agreement by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AgreementInner get(String billingAccountName, String agreementName); + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @param expand May be used to expand the participants. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an agreement by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String billingAccountName, String agreementName, String expand, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/AvailableBalancesClient.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/AvailableBalancesClient.java new file mode 100644 index 0000000000000..3b9e3e6df4776 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/AvailableBalancesClient.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.billing.fluent.models.AvailableBalanceInner; + +/** An instance of this class provides access to all the operations defined in AvailableBalancesClient. */ +public interface AvailableBalancesClient { + /** + * The available credit balance for a billing profile. This is the balance that can be used for pay now to settle + * due or past due invoices. The operation is supported only for billing accounts with agreement type Microsoft + * Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the latest Azure credit balance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AvailableBalanceInner get(String billingAccountName, String billingProfileName); + + /** + * The available credit balance for a billing profile. This is the balance that can be used for pay now to settle + * due or past due invoices. The operation is supported only for billing accounts with agreement type Microsoft + * Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the latest Azure credit balance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String billingAccountName, String billingProfileName, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingAccountsClient.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingAccountsClient.java new file mode 100644 index 0000000000000..cc282b809d923 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingAccountsClient.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.billing.fluent.models.BillingAccountInner; +import com.azure.resourcemanager.billing.fluent.models.InvoiceSectionWithCreateSubPermissionInner; +import com.azure.resourcemanager.billing.models.BillingAccountUpdateRequest; + +/** An instance of this class provides access to all the operations defined in BillingAccountsClient. */ +public interface BillingAccountsClient { + /** + * Lists the billing accounts that a user has access to. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists the billing accounts that a user has access to. + * + * @param expand May be used to expand the soldTo, invoice sections and billing profiles. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String expand, Context context); + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingAccountInner get(String billingAccountName); + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the soldTo, invoice sections and billing profiles. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String billingAccountName, String expand, Context context); + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BillingAccountInner> beginUpdate( + String billingAccountName, BillingAccountUpdateRequest parameters); + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BillingAccountInner> beginUpdate( + String billingAccountName, BillingAccountUpdateRequest parameters, Context context); + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingAccountInner update(String billingAccountName, BillingAccountUpdateRequest parameters); + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingAccountInner update(String billingAccountName, BillingAccountUpdateRequest parameters, Context context); + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice section properties with create subscription permission. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listInvoiceSectionsByCreateSubscriptionPermission( + String billingAccountName); + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice section properties with create subscription permission. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listInvoiceSectionsByCreateSubscriptionPermission( + String billingAccountName, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingManagementClient.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingManagementClient.java new file mode 100644 index 0000000000000..cea1c2b7e3764 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingManagementClient.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for BillingManagementClient class. */ +public interface BillingManagementClient { + /** + * Gets The ID that uniquely identifies an Azure subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the BillingAccountsClient object to access its operations. + * + * @return the BillingAccountsClient object. + */ + BillingAccountsClient getBillingAccounts(); + + /** + * Gets the AddressClient object to access its operations. + * + * @return the AddressClient object. + */ + AddressClient getAddress(); + + /** + * Gets the AvailableBalancesClient object to access its operations. + * + * @return the AvailableBalancesClient object. + */ + AvailableBalancesClient getAvailableBalances(); + + /** + * Gets the InstructionsClient object to access its operations. + * + * @return the InstructionsClient object. + */ + InstructionsClient getInstructions(); + + /** + * Gets the BillingProfilesClient object to access its operations. + * + * @return the BillingProfilesClient object. + */ + BillingProfilesClient getBillingProfiles(); + + /** + * Gets the CustomersClient object to access its operations. + * + * @return the CustomersClient object. + */ + CustomersClient getCustomers(); + + /** + * Gets the InvoiceSectionsClient object to access its operations. + * + * @return the InvoiceSectionsClient object. + */ + InvoiceSectionsClient getInvoiceSections(); + + /** + * Gets the BillingPermissionsClient object to access its operations. + * + * @return the BillingPermissionsClient object. + */ + BillingPermissionsClient getBillingPermissions(); + + /** + * Gets the BillingSubscriptionsClient object to access its operations. + * + * @return the BillingSubscriptionsClient object. + */ + BillingSubscriptionsClient getBillingSubscriptions(); + + /** + * Gets the ProductsClient object to access its operations. + * + * @return the ProductsClient object. + */ + ProductsClient getProducts(); + + /** + * Gets the InvoicesClient object to access its operations. + * + * @return the InvoicesClient object. + */ + InvoicesClient getInvoices(); + + /** + * Gets the TransactionsClient object to access its operations. + * + * @return the TransactionsClient object. + */ + TransactionsClient getTransactions(); + + /** + * Gets the PoliciesClient object to access its operations. + * + * @return the PoliciesClient object. + */ + PoliciesClient getPolicies(); + + /** + * Gets the BillingPropertiesClient object to access its operations. + * + * @return the BillingPropertiesClient object. + */ + BillingPropertiesClient getBillingProperties(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the BillingRoleDefinitionsClient object to access its operations. + * + * @return the BillingRoleDefinitionsClient object. + */ + BillingRoleDefinitionsClient getBillingRoleDefinitions(); + + /** + * Gets the BillingRoleAssignmentsClient object to access its operations. + * + * @return the BillingRoleAssignmentsClient object. + */ + BillingRoleAssignmentsClient getBillingRoleAssignments(); + + /** + * Gets the AgreementsClient object to access its operations. + * + * @return the AgreementsClient object. + */ + AgreementsClient getAgreements(); + + /** + * Gets the ReservationsClient object to access its operations. + * + * @return the ReservationsClient object. + */ + ReservationsClient getReservations(); + + /** + * Gets the EnrollmentAccountsClient object to access its operations. + * + * @return the EnrollmentAccountsClient object. + */ + EnrollmentAccountsClient getEnrollmentAccounts(); + + /** + * Gets the BillingPeriodsClient object to access its operations. + * + * @return the BillingPeriodsClient object. + */ + BillingPeriodsClient getBillingPeriods(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingPeriodsClient.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingPeriodsClient.java new file mode 100644 index 0000000000000..9b05db568d5a8 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingPeriodsClient.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.billing.fluent.models.BillingPeriodInner; + +/** An instance of this class provides access to all the operations defined in BillingPeriodsClient. */ +public interface BillingPeriodsClient { + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for + * Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web + * portal are not supported through this preview API. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing billing periods. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for + * Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web + * portal are not supported through this preview API. + * + * @param filter May be used to filter billing periods by billingPeriodEndDate. The filter supports 'eq', 'lt', + * 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @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 top May be used to limit the number of results to the most recent N billing periods. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing billing periods. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter, String skiptoken, Integer top, Context context); + + /** + * Gets a named billing period. This is only supported for Azure Web-Direct subscriptions. Other subscription types + * which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @param billingPeriodName The name of a BillingPeriod resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a named billing period. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingPeriodInner get(String billingPeriodName); + + /** + * Gets a named billing period. This is only supported for Azure Web-Direct subscriptions. Other subscription types + * which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @param billingPeriodName The name of a BillingPeriod resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a named billing period. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String billingPeriodName, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingPermissionsClient.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingPermissionsClient.java new file mode 100644 index 0000000000000..806c78a4a825a --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingPermissionsClient.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.billing.fluent.models.BillingPermissionsPropertiesInner; + +/** An instance of this class provides access to all the operations defined in BillingPermissionsClient. */ +public interface BillingPermissionsClient { + /** + * Lists the billing permissions the caller has for a customer. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCustomer(String billingAccountName, String customerName); + + /** + * Lists the billing permissions the caller has for a customer. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCustomer( + String billingAccountName, String customerName, Context context); + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingAccount(String billingAccountName); + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingAccount(String billingAccountName, Context context); + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInvoiceSections( + String billingAccountName, String billingProfileName, String invoiceSectionName); + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInvoiceSections( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context); + + /** + * Lists the billing permissions the caller has on a billing profile. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName); + + /** + * Lists the billing permissions the caller has on a billing profile. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingProfilesClient.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingProfilesClient.java new file mode 100644 index 0000000000000..9d9733411ec2a --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingProfilesClient.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.billing.fluent.models.BillingProfileInner; + +/** An instance of this class provides access to all the operations defined in BillingProfilesClient. */ +public interface BillingProfilesClient { + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with + * agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing profiles. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingAccount(String billingAccountName); + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with + * agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the invoice sections. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing profiles. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingAccount(String billingAccountName, String expand, Context context); + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft + * Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingProfileInner get(String billingAccountName, String billingProfileName); + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft + * Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param expand May be used to expand the invoice sections. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String billingAccountName, String billingProfileName, String expand, Context context); + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BillingProfileInner> beginCreateOrUpdate( + String billingAccountName, String billingProfileName, BillingProfileInner parameters); + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BillingProfileInner> beginCreateOrUpdate( + String billingAccountName, String billingProfileName, BillingProfileInner parameters, Context context); + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingProfileInner createOrUpdate( + String billingAccountName, String billingProfileName, BillingProfileInner parameters); + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingProfileInner createOrUpdate( + String billingAccountName, String billingProfileName, BillingProfileInner parameters, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingPropertiesClient.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingPropertiesClient.java new file mode 100644 index 0000000000000..6fb632b38e703 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingPropertiesClient.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.billing.fluent.models.BillingPropertyInner; + +/** An instance of this class provides access to all the operations defined in BillingPropertiesClient. */ +public interface BillingPropertiesClient { + /** + * Get the billing properties for a subscription. This operation is not supported for billing accounts with + * agreement type Enterprise Agreement. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the billing properties for a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingPropertyInner get(); + + /** + * Get the billing properties for a subscription. This operation is not supported for billing accounts with + * agreement type Enterprise Agreement. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the billing properties for a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(Context context); + + /** + * Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported + * only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param parameters Request parameters that are provided to the update billing property operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingPropertyInner update(BillingPropertyInner parameters); + + /** + * Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported + * only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param parameters Request parameters that are provided to the update billing property operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(BillingPropertyInner parameters, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingRoleAssignmentsClient.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingRoleAssignmentsClient.java new file mode 100644 index 0000000000000..35f767918b95c --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingRoleAssignmentsClient.java @@ -0,0 +1,316 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.billing.fluent.models.BillingRoleAssignmentInner; + +/** An instance of this class provides access to all the operations defined in BillingRoleAssignmentsClient. */ +public interface BillingRoleAssignmentsClient { + /** + * Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingRoleAssignmentInner getByBillingAccount(String billingAccountName, String billingRoleAssignmentName); + + /** + * Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByBillingAccountWithResponse( + String billingAccountName, String billingRoleAssignmentName, Context context); + + /** + * Deletes a role assignment for the caller on a billing account. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingRoleAssignmentInner deleteByBillingAccount(String billingAccountName, String billingRoleAssignmentName); + + /** + * Deletes a role assignment for the caller on a billing account. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteByBillingAccountWithResponse( + String billingAccountName, String billingRoleAssignmentName, Context context); + + /** + * Gets a role assignment for the caller on an invoice section. The operation is supported for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingRoleAssignmentInner getByInvoiceSection( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleAssignmentName); + + /** + * Gets a role assignment for the caller on an invoice section. The operation is supported for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByInvoiceSectionWithResponse( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleAssignmentName, + Context context); + + /** + * Deletes a role assignment for the caller on an invoice section. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingRoleAssignmentInner deleteByInvoiceSection( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleAssignmentName); + + /** + * Deletes a role assignment for the caller on an invoice section. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteByInvoiceSectionWithResponse( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleAssignmentName, + Context context); + + /** + * Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingRoleAssignmentInner getByBillingProfile( + String billingAccountName, String billingProfileName, String billingRoleAssignmentName); + + /** + * Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByBillingProfileWithResponse( + String billingAccountName, String billingProfileName, String billingRoleAssignmentName, Context context); + + /** + * Deletes a role assignment for the caller on a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingRoleAssignmentInner deleteByBillingProfile( + String billingAccountName, String billingProfileName, String billingRoleAssignmentName); + + /** + * Deletes a role assignment for the caller on a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteByBillingProfileWithResponse( + String billingAccountName, String billingProfileName, String billingRoleAssignmentName, Context context); + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingAccount(String billingAccountName); + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingAccount(String billingAccountName, Context context); + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName); + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context); + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName); + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingRoleDefinitionsClient.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingRoleDefinitionsClient.java new file mode 100644 index 0000000000000..ae03cfa9580fb --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingRoleDefinitionsClient.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.billing.fluent.models.BillingRoleDefinitionInner; + +/** An instance of this class provides access to all the operations defined in BillingRoleDefinitionsClient. */ +public interface BillingRoleDefinitionsClient { + /** + * Gets the definition for a role on a billing account. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingRoleDefinitionInner getByBillingAccount(String billingAccountName, String billingRoleDefinitionName); + + /** + * Gets the definition for a role on a billing account. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByBillingAccountWithResponse( + String billingAccountName, String billingRoleDefinitionName, Context context); + + /** + * Gets the definition for a role on an invoice section. The operation is supported only for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingRoleDefinitionInner getByInvoiceSection( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleDefinitionName); + + /** + * Gets the definition for a role on an invoice section. The operation is supported only for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByInvoiceSectionWithResponse( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleDefinitionName, + Context context); + + /** + * Gets the definition for a role on a billing profile. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingRoleDefinitionInner getByBillingProfile( + String billingAccountName, String billingProfileName, String billingRoleDefinitionName); + + /** + * Gets the definition for a role on a billing profile. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByBillingProfileWithResponse( + String billingAccountName, String billingProfileName, String billingRoleDefinitionName, Context context); + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingAccount(String billingAccountName); + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingAccount(String billingAccountName, Context context); + + /** + * Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName); + + /** + * Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context); + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName); + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingSubscriptionsClient.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingSubscriptionsClient.java new file mode 100644 index 0000000000000..d88c471e5f9f2 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/BillingSubscriptionsClient.java @@ -0,0 +1,292 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.billing.fluent.models.BillingSubscriptionInner; +import com.azure.resourcemanager.billing.fluent.models.ValidateSubscriptionTransferEligibilityResultInner; +import com.azure.resourcemanager.billing.models.TransferBillingSubscriptionRequestProperties; + +/** An instance of this class provides access to all the operations defined in BillingSubscriptionsClient. */ +public interface BillingSubscriptionsClient { + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCustomer(String billingAccountName, String customerName); + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCustomer( + String billingAccountName, String customerName, Context context); + + /** + * Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement + * type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingAccount(String billingAccountName); + + /** + * Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement + * type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingAccount(String billingAccountName, Context context); + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName); + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context); + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing + * accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName); + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing + * accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context); + + /** + * Gets a subscription by its ID. The operation is supported for billing accounts with agreement type Microsoft + * Customer Agreement and Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a subscription by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingSubscriptionInner get(String billingAccountName); + + /** + * Gets a subscription by its ID. The operation is supported for billing accounts with agreement type Microsoft + * Customer Agreement and Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a subscription by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String billingAccountName, Context context); + + /** + * Updates the properties of a billing subscription. Currently, cost center can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingSubscriptionInner update(String billingAccountName, BillingSubscriptionInner parameters); + + /** + * Updates the properties of a billing subscription. Currently, cost center can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing subscription operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String billingAccountName, BillingSubscriptionInner parameters, Context context); + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the move subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BillingSubscriptionInner> beginMove( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters); + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the move subscription operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BillingSubscriptionInner> beginMove( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters, Context context); + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the move subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingSubscriptionInner move(String billingAccountName, TransferBillingSubscriptionRequestProperties parameters); + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the move subscription operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BillingSubscriptionInner move( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters, Context context); + + /** + * Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for + * billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the validate move eligibility operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the transfer eligibility validation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ValidateSubscriptionTransferEligibilityResultInner validateMove( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters); + + /** + * Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for + * billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the validate move eligibility operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the transfer eligibility validation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response validateMoveWithResponse( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/CustomersClient.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/CustomersClient.java new file mode 100644 index 0000000000000..0331888c57e6c --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/CustomersClient.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.billing.fluent.models.CustomerInner; + +/** An instance of this class provides access to all the operations defined in CustomersClient. */ +public interface CustomersClient { + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts + * with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName); + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts + * with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param search Used for searching customers by their name. Any customer with name containing the search text will + * be included in the response. + * @param filter May be used to filter the list of customers. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, String search, String filter, Context context); + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts + * with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingAccount(String billingAccountName); + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts + * with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param search Used for searching customers by their name. Any customer with name containing the search text will + * be included in the response. + * @param filter May be used to filter the list of customers. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingAccount( + String billingAccountName, String search, String filter, Context context); + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft + * Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a customer by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomerInner get(String billingAccountName, String customerName); + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft + * Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param expand May be used to expand enabledAzurePlans and resellers. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a customer by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String billingAccountName, String customerName, String expand, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/EnrollmentAccountsClient.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/EnrollmentAccountsClient.java new file mode 100644 index 0000000000000..5e167c1f147bf --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/EnrollmentAccountsClient.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.billing.fluent.models.EnrollmentAccountSummaryInner; + +/** An instance of this class provides access to all the operations defined in EnrollmentAccountsClient. */ +public interface EnrollmentAccountsClient { + /** + * Lists the enrollment accounts the caller has access to. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing enrollment accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists the enrollment accounts the caller has access to. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing enrollment accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets a enrollment account by name. + * + * @param name Enrollment Account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a enrollment account by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnrollmentAccountSummaryInner get(String name); + + /** + * Gets a enrollment account by name. + * + * @param name Enrollment Account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a enrollment account by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String name, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/InstructionsClient.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/InstructionsClient.java new file mode 100644 index 0000000000000..5b8116658c0bc --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/InstructionsClient.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.billing.fluent.models.InstructionInner; + +/** An instance of this class provides access to all the operations defined in InstructionsClient. */ +public interface InstructionsClient { + /** + * Lists the instructions by billing profile id. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing instructions used during invoice generation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName); + + /** + * Lists the instructions by billing profile id. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing instructions used during invoice generation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context); + + /** + * Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instruction by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstructionInner get(String billingAccountName, String billingProfileName, String instructionName); + + /** + * Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instruction by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String billingAccountName, String billingProfileName, String instructionName, Context context); + + /** + * Creates or updates an instruction. These are custom billing instructions and are only applicable for certain + * customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @param parameters The new instruction. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instruction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InstructionInner put( + String billingAccountName, String billingProfileName, String instructionName, InstructionInner parameters); + + /** + * Creates or updates an instruction. These are custom billing instructions and are only applicable for certain + * customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @param parameters The new instruction. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instruction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response putWithResponse( + String billingAccountName, + String billingProfileName, + String instructionName, + InstructionInner parameters, + Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/InvoiceSectionsClient.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/InvoiceSectionsClient.java new file mode 100644 index 0000000000000..1012343bf0c54 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/InvoiceSectionsClient.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.billing.fluent.models.InvoiceSectionInner; + +/** An instance of this class provides access to all the operations defined in InvoiceSectionsClient. */ +public interface InvoiceSectionsClient { + /** + * Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice sections. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName); + + /** + * Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice sections. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context); + + /** + * Gets an invoice section by its ID. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InvoiceSectionInner get(String billingAccountName, String billingProfileName, String invoiceSectionName); + + /** + * Gets an invoice section by its ID. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context); + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, InvoiceSectionInner> beginCreateOrUpdate( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + InvoiceSectionInner parameters); + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, InvoiceSectionInner> beginCreateOrUpdate( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + InvoiceSectionInner parameters, + Context context); + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InvoiceSectionInner createOrUpdate( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + InvoiceSectionInner parameters); + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InvoiceSectionInner createOrUpdate( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + InvoiceSectionInner parameters, + Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/InvoicesClient.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/InvoicesClient.java new file mode 100644 index 0000000000000..14ca1a33b4e9d --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/InvoicesClient.java @@ -0,0 +1,438 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.billing.fluent.models.DownloadUrlInner; +import com.azure.resourcemanager.billing.fluent.models.InvoiceInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in InvoicesClient. */ +public interface InvoicesClient { + /** + * Lists the invoices for a billing account for a given start date and end date. The operation is supported for + * billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingAccount( + String billingAccountName, String periodStartDate, String periodEndDate); + + /** + * Lists the invoices for a billing account for a given start date and end date. The operation is supported for + * billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingAccount( + String billingAccountName, String periodStartDate, String periodEndDate, Context context); + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for + * billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate); + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for + * billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingProfile( + String billingAccountName, + String billingProfileName, + String periodStartDate, + String periodEndDate, + Context context); + + /** + * Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by billing account name and ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InvoiceInner get(String billingAccountName, String invoiceName); + + /** + * Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by billing account name and ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String billingAccountName, String invoiceName, Context context); + + /** + * Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner + * Agreement or Microsoft Customer Agreement. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InvoiceInner getById(String invoiceName); + + /** + * Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner + * Agreement or Microsoft Customer Agreement. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByIdWithResponse(String invoiceName, Context context); + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft + * Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DownloadUrlInner> beginDownloadInvoice( + String billingAccountName, String invoiceName, String downloadToken); + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft + * Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DownloadUrlInner> beginDownloadInvoice( + String billingAccountName, String invoiceName, String downloadToken, Context context); + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft + * Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DownloadUrlInner downloadInvoice(String billingAccountName, String invoiceName, String downloadToken); + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft + * Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DownloadUrlInner downloadInvoice( + String billingAccountName, String invoiceName, String downloadToken, Context context); + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The + * operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DownloadUrlInner> beginDownloadMultipleBillingProfileInvoices( + String billingAccountName, List downloadUrls); + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The + * operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DownloadUrlInner> beginDownloadMultipleBillingProfileInvoices( + String billingAccountName, List downloadUrls, Context context); + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The + * operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DownloadUrlInner downloadMultipleBillingProfileInvoices(String billingAccountName, List downloadUrls); + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The + * operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DownloadUrlInner downloadMultipleBillingProfileInvoices( + String billingAccountName, List downloadUrls, Context context); + + /** + * Lists the invoices for a subscription. + * + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingSubscription(String periodStartDate, String periodEndDate); + + /** + * Lists the invoices for a subscription. + * + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingSubscription( + String periodStartDate, String periodEndDate, Context context); + + /** + * Gets an invoice by subscription ID and invoice ID. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by subscription ID and invoice ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InvoiceInner getBySubscriptionAndInvoiceId(String invoiceName); + + /** + * Gets an invoice by subscription ID and invoice ID. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by subscription ID and invoice ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getBySubscriptionAndInvoiceIdWithResponse(String invoiceName, Context context); + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DownloadUrlInner> beginDownloadBillingSubscriptionInvoice( + String invoiceName, String downloadToken); + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DownloadUrlInner> beginDownloadBillingSubscriptionInvoice( + String invoiceName, String downloadToken, Context context); + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DownloadUrlInner downloadBillingSubscriptionInvoice(String invoiceName, String downloadToken); + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DownloadUrlInner downloadBillingSubscriptionInvoice(String invoiceName, String downloadToken, Context context); + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DownloadUrlInner> beginDownloadMultipleBillingSubscriptionInvoices( + List downloadUrls); + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DownloadUrlInner> beginDownloadMultipleBillingSubscriptionInvoices( + List downloadUrls, Context context); + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DownloadUrlInner downloadMultipleBillingSubscriptionInvoices(List downloadUrls); + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DownloadUrlInner downloadMultipleBillingSubscriptionInvoices(List downloadUrls, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/OperationsClient.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/OperationsClient.java new file mode 100644 index 0000000000000..103f7ad487db5 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.billing.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists the available billing REST API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing operations and a URL link to get the next set of results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists the available billing REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing operations and a URL link to get the next set of results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/PoliciesClient.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/PoliciesClient.java new file mode 100644 index 0000000000000..d6853d3867daa --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/PoliciesClient.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.billing.fluent.models.CustomerPolicyInner; +import com.azure.resourcemanager.billing.fluent.models.PolicyInner; + +/** An instance of this class provides access to all the operations defined in PoliciesClient. */ +public interface PoliciesClient { + /** + * Lists the policies for a billing profile. This operation is supported only for billing accounts with agreement + * type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PolicyInner getByBillingProfile(String billingAccountName, String billingProfileName); + + /** + * Lists the policies for a billing profile. This operation is supported only for billing accounts with agreement + * type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByBillingProfileWithResponse( + String billingAccountName, String billingProfileName, Context context); + + /** + * Updates the policies for a billing profile. This operation is supported only for billing accounts with agreement + * type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters Request parameters that are provided to the update policies operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PolicyInner update(String billingAccountName, String billingProfileName, PolicyInner parameters); + + /** + * Updates the policies for a billing profile. This operation is supported only for billing accounts with agreement + * type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters Request parameters that are provided to the update policies operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String billingAccountName, String billingProfileName, PolicyInner parameters, Context context); + + /** + * Lists the policies for a customer. This operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the customer's Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomerPolicyInner getByCustomer(String billingAccountName, String customerName); + + /** + * Lists the policies for a customer. This operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the customer's Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByCustomerWithResponse( + String billingAccountName, String customerName, Context context); + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param parameters Request parameters that are provided to the update policies operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the customer's Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CustomerPolicyInner updateCustomer(String billingAccountName, String customerName, CustomerPolicyInner parameters); + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param parameters Request parameters that are provided to the update policies operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the customer's Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateCustomerWithResponse( + String billingAccountName, String customerName, CustomerPolicyInner parameters, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/ProductsClient.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/ProductsClient.java new file mode 100644 index 0000000000000..f611f10a553b1 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/ProductsClient.java @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.billing.fluent.models.ProductInner; +import com.azure.resourcemanager.billing.fluent.models.ValidateProductTransferEligibilityResultInner; +import com.azure.resourcemanager.billing.models.ProductsMoveResponse; +import com.azure.resourcemanager.billing.models.TransferProductRequestProperties; + +/** An instance of this class provides access to all the operations defined in ProductsClient. */ +public interface ProductsClient { + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported + * only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCustomer(String billingAccountName, String customerName); + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported + * only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCustomer(String billingAccountName, String customerName, Context context); + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is + * supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingAccount(String billingAccountName); + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is + * supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. + * It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value + * are separated by a colon (:). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingAccount(String billingAccountName, String filter, Context context); + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is + * supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName); + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is + * supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. + * It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value + * are separated by a colon (:). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, String filter, Context context); + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName); + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. + * It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value + * are separated by a colon (:). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInvoiceSection( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String filter, + Context context); + + /** + * Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProductInner get(String billingAccountName, String productName); + + /** + * Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String billingAccountName, String productName, Context context); + + /** + * Updates the properties of a Product. Currently, auto renew can be updated. The operation is supported only for + * billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the update product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProductInner update(String billingAccountName, String productName, ProductInner parameters); + + /** + * Updates the properties of a Product. Currently, auto renew can be updated. The operation is supported only for + * billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the update product operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String billingAccountName, String productName, ProductInner parameters, Context context); + + /** + * Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported only for products that are purchased with a + * recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the move product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProductInner move(String billingAccountName, String productName, TransferProductRequestProperties parameters); + + /** + * Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported only for products that are purchased with a + * recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the move product operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProductsMoveResponse moveWithResponse( + String billingAccountName, String productName, TransferProductRequestProperties parameters, Context context); + + /** + * Validates if a product's charges can be moved to a new invoice section. This operation is supported only for + * products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft + * Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the validate move eligibility operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the product transfer eligibility validation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ValidateProductTransferEligibilityResultInner validateMove( + String billingAccountName, String productName, TransferProductRequestProperties parameters); + + /** + * Validates if a product's charges can be moved to a new invoice section. This operation is supported only for + * products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft + * Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the validate move eligibility operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the product transfer eligibility validation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response validateMoveWithResponse( + String billingAccountName, String productName, TransferProductRequestProperties parameters, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/ReservationsClient.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/ReservationsClient.java new file mode 100644 index 0000000000000..c6817aeabd16d --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/ReservationsClient.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.billing.fluent.models.ReservationInner; + +/** An instance of this class provides access to all the operations defined in ReservationsClient. */ +public interface ReservationsClient { + /** + * Lists the reservations for a billing account and the roll up counts of reservations group by provisioning states. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingAccount(String billingAccountName); + + /** + * Lists the reservations for a billing account and the roll up counts of reservations group by provisioning states. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does + * not currently support 'ne', 'gt', 'le', 'ge', or 'not'. + * @param orderby May be used to sort order by reservation properties. + * @param refreshsummary To indicate whether to refresh the roll up counts of the reservations group by provisioning + * states. + * @param selectedState The selected provisioning state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingAccount( + String billingAccountName, + String filter, + String orderby, + String refreshsummary, + String selectedState, + Context context); + + /** + * Lists the reservations for a billing profile and the roll up counts of reservations group by provisioning state. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName); + + /** + * Lists the reservations for a billing profile and the roll up counts of reservations group by provisioning state. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does + * not currently support 'ne', 'gt', 'le', 'ge', or 'not'. + * @param orderby May be used to sort order by reservation properties. + * @param refreshsummary To indicate whether to refresh the roll up counts of the reservations group by provisioning + * state. + * @param selectedState The selected provisioning state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBillingProfile( + String billingAccountName, + String billingProfileName, + String filter, + String orderby, + String refreshsummary, + String selectedState, + Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/TransactionsClient.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/TransactionsClient.java new file mode 100644 index 0000000000000..403f959e8a876 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/TransactionsClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.billing.fluent.models.TransactionInner; + +/** An instance of this class provides access to all the operations defined in TransactionsClient. */ +public interface TransactionsClient { + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of transactions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInvoice(String billingAccountName, String invoiceName); + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of transactions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByInvoice(String billingAccountName, String invoiceName, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/AgreementInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/AgreementInner.java new file mode 100644 index 0000000000000..a054e2418f26a --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/AgreementInner.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.models.AcceptanceMode; +import com.azure.resourcemanager.billing.models.Category; +import com.azure.resourcemanager.billing.models.Participants; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** An agreement. */ +@JsonFlatten +@Fluent +public class AgreementInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AgreementInner.class); + + /* + * The URL to download the agreement. + */ + @JsonProperty(value = "properties.agreementLink", access = JsonProperty.Access.WRITE_ONLY) + private String agreementLink; + + /* + * The category of the agreement signed by a customer. + */ + @JsonProperty(value = "properties.category", access = JsonProperty.Access.WRITE_ONLY) + private Category category; + + /* + * The mode of acceptance for an agreement. + */ + @JsonProperty(value = "properties.acceptanceMode", access = JsonProperty.Access.WRITE_ONLY) + private AcceptanceMode acceptanceMode; + + /* + * The date from which the agreement is effective. + */ + @JsonProperty(value = "properties.effectiveDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime effectiveDate; + + /* + * The date when the agreement expires. + */ + @JsonProperty(value = "properties.expirationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime expirationDate; + + /* + * The list of participants that participates in acceptance of an + * agreement. + */ + @JsonProperty(value = "properties.participants") + private List participants; + + /* + * The current status of the agreement. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /** + * Get the agreementLink property: The URL to download the agreement. + * + * @return the agreementLink value. + */ + public String agreementLink() { + return this.agreementLink; + } + + /** + * Get the category property: The category of the agreement signed by a customer. + * + * @return the category value. + */ + public Category category() { + return this.category; + } + + /** + * Get the acceptanceMode property: The mode of acceptance for an agreement. + * + * @return the acceptanceMode value. + */ + public AcceptanceMode acceptanceMode() { + return this.acceptanceMode; + } + + /** + * Get the effectiveDate property: The date from which the agreement is effective. + * + * @return the effectiveDate value. + */ + public OffsetDateTime effectiveDate() { + return this.effectiveDate; + } + + /** + * Get the expirationDate property: The date when the agreement expires. + * + * @return the expirationDate value. + */ + public OffsetDateTime expirationDate() { + return this.expirationDate; + } + + /** + * Get the participants property: The list of participants that participates in acceptance of an agreement. + * + * @return the participants value. + */ + public List participants() { + return this.participants; + } + + /** + * Set the participants property: The list of participants that participates in acceptance of an agreement. + * + * @param participants the participants value to set. + * @return the AgreementInner object itself. + */ + public AgreementInner withParticipants(List participants) { + this.participants = participants; + return this; + } + + /** + * Get the status property: The current status of the agreement. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (participants() != null) { + participants().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/AvailableBalanceInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/AvailableBalanceInner.java new file mode 100644 index 0000000000000..eb47ad9c60ea9 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/AvailableBalanceInner.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.models.Amount; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The latest Azure credit balance. This is the balance available for pay now. */ +@JsonFlatten +@Immutable +public class AvailableBalanceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AvailableBalanceInner.class); + + /* + * Balance amount. + */ + @JsonProperty(value = "properties.amount", access = JsonProperty.Access.WRITE_ONLY) + private Amount amount; + + /** + * Get the amount property: Balance amount. + * + * @return the amount value. + */ + public Amount amount() { + return this.amount; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (amount() != null) { + amount().validate(); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingAccountInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingAccountInner.java new file mode 100644 index 0000000000000..f27fe52e5f2e3 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingAccountInner.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.models.AccountStatus; +import com.azure.resourcemanager.billing.models.AccountType; +import com.azure.resourcemanager.billing.models.AddressDetails; +import com.azure.resourcemanager.billing.models.AgreementType; +import com.azure.resourcemanager.billing.models.BillingProfilesOnExpand; +import com.azure.resourcemanager.billing.models.Department; +import com.azure.resourcemanager.billing.models.Enrollment; +import com.azure.resourcemanager.billing.models.EnrollmentAccount; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A billing account. */ +@JsonFlatten +@Fluent +public class BillingAccountInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingAccountInner.class); + + /* + * The billing account name. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /* + * The address of the individual or organization that is responsible for + * the billing account. + */ + @JsonProperty(value = "properties.soldTo") + private AddressDetails soldTo; + + /* + * The type of agreement. + */ + @JsonProperty(value = "properties.agreementType", access = JsonProperty.Access.WRITE_ONLY) + private AgreementType agreementType; + + /* + * The type of customer. + */ + @JsonProperty(value = "properties.accountType", access = JsonProperty.Access.WRITE_ONLY) + private AccountType accountType; + + /* + * The current status of the billing account. + */ + @JsonProperty(value = "properties.accountStatus", access = JsonProperty.Access.WRITE_ONLY) + private AccountStatus accountStatus; + + /* + * The billing profiles associated with the billing account. By default + * this is not populated, unless it's specified in $expand. + */ + @JsonProperty(value = "properties.billingProfiles") + private BillingProfilesOnExpand 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; + + /* + * Indicates whether user has read access to the billing account. + */ + @JsonProperty(value = "properties.hasReadAccess", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasReadAccess; + + /** + * Get the displayName property: The billing account name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The billing account name. + * + * @param displayName the displayName value to set. + * @return the BillingAccountInner object itself. + */ + public BillingAccountInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the soldTo property: The address of the individual or organization that is responsible for the billing + * account. + * + * @return the soldTo value. + */ + public AddressDetails soldTo() { + return this.soldTo; + } + + /** + * Set the soldTo property: The address of the individual or organization that is responsible for the billing + * account. + * + * @param soldTo the soldTo value to set. + * @return the BillingAccountInner object itself. + */ + public BillingAccountInner withSoldTo(AddressDetails soldTo) { + this.soldTo = soldTo; + return this; + } + + /** + * Get the agreementType property: The type of agreement. + * + * @return the agreementType value. + */ + public AgreementType agreementType() { + return this.agreementType; + } + + /** + * Get the accountType property: The type of customer. + * + * @return the accountType value. + */ + public AccountType accountType() { + return this.accountType; + } + + /** + * Get the accountStatus property: The current status of the billing account. + * + * @return the accountStatus value. + */ + public AccountStatus accountStatus() { + return this.accountStatus; + } + + /** + * Get the billingProfiles property: The billing profiles associated with the billing account. By default this is + * not populated, unless it's specified in $expand. + * + * @return the billingProfiles value. + */ + public BillingProfilesOnExpand billingProfiles() { + return this.billingProfiles; + } + + /** + * Set the billingProfiles property: The billing profiles associated with the billing account. By default this is + * not populated, unless it's specified in $expand. + * + * @param billingProfiles the billingProfiles value to set. + * @return the BillingAccountInner object itself. + */ + public BillingAccountInner withBillingProfiles(BillingProfilesOnExpand billingProfiles) { + this.billingProfiles = billingProfiles; + return this; + } + + /** + * Get the enrollmentDetails property: 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 property: The departments associated to the enrollment. + * + * @return the departments value. + */ + public List departments() { + return this.departments; + } + + /** + * Set the departments property: 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 enrollmentAccounts property: The accounts associated to the enrollment. + * + * @return the enrollmentAccounts value. + */ + public List enrollmentAccounts() { + return this.enrollmentAccounts; + } + + /** + * Set the enrollmentAccounts property: 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 the hasReadAccess property: Indicates whether user has read access to the billing account. + * + * @return the hasReadAccess value. + */ + public Boolean hasReadAccess() { + return this.hasReadAccess; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (soldTo() != null) { + soldTo().validate(); + } + if (billingProfiles() != null) { + billingProfiles().validate(); + } + if (enrollmentDetails() != null) { + enrollmentDetails().validate(); + } + if (departments() != null) { + departments().forEach(e -> e.validate()); + } + if (enrollmentAccounts() != null) { + enrollmentAccounts().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingPeriodInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingPeriodInner.java new file mode 100644 index 0000000000000..7a5ddd901e396 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingPeriodInner.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.LocalDate; +import java.util.List; + +/** A billing period resource. */ +@JsonFlatten +@Immutable +public class BillingPeriodInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingPeriodInner.class); + + /* + * The start of the date range covered by the billing period. + */ + @JsonProperty(value = "properties.billingPeriodStartDate", access = JsonProperty.Access.WRITE_ONLY) + private LocalDate billingPeriodStartDate; + + /* + * The end of the date range covered by the billing period. + */ + @JsonProperty(value = "properties.billingPeriodEndDate", access = JsonProperty.Access.WRITE_ONLY) + private LocalDate billingPeriodEndDate; + + /* + * Array of invoice ids that associated with. + */ + @JsonProperty(value = "properties.invoiceIds", access = JsonProperty.Access.WRITE_ONLY) + private List invoiceIds; + + /** + * Get the billingPeriodStartDate property: The start of the date range covered by the billing period. + * + * @return the billingPeriodStartDate value. + */ + public LocalDate billingPeriodStartDate() { + return this.billingPeriodStartDate; + } + + /** + * Get the billingPeriodEndDate property: The end of the date range covered by the billing period. + * + * @return the billingPeriodEndDate value. + */ + public LocalDate billingPeriodEndDate() { + return this.billingPeriodEndDate; + } + + /** + * Get the invoiceIds property: Array of invoice ids that associated with. + * + * @return the invoiceIds value. + */ + public List invoiceIds() { + return this.invoiceIds; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingPermissionsPropertiesInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingPermissionsPropertiesInner.java new file mode 100644 index 0000000000000..b44d405928f96 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingPermissionsPropertiesInner.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The set of allowed action and not allowed actions a caller has on a billing account. */ +@Immutable +public final class BillingPermissionsPropertiesInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingPermissionsPropertiesInner.class); + + /* + * The set of actions that the caller is allowed to perform. + */ + @JsonProperty(value = "actions", access = JsonProperty.Access.WRITE_ONLY) + private List actions; + + /* + * The set of actions that the caller is not allowed to perform. + */ + @JsonProperty(value = "notActions", access = JsonProperty.Access.WRITE_ONLY) + private List notActions; + + /** + * Get the actions property: The set of actions that the caller is allowed to perform. + * + * @return the actions value. + */ + public List actions() { + return this.actions; + } + + /** + * Get the notActions property: The set of actions that the caller is not allowed to perform. + * + * @return the notActions value. + */ + public List notActions() { + return this.notActions; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingProfileInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingProfileInner.java new file mode 100644 index 0000000000000..f648f9f027b3d --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingProfileInner.java @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.models.AddressDetails; +import com.azure.resourcemanager.billing.models.AzurePlan; +import com.azure.resourcemanager.billing.models.BillingProfileStatus; +import com.azure.resourcemanager.billing.models.BillingRelationshipType; +import com.azure.resourcemanager.billing.models.IndirectRelationshipInfo; +import com.azure.resourcemanager.billing.models.InvoiceSectionsOnExpand; +import com.azure.resourcemanager.billing.models.SpendingLimit; +import com.azure.resourcemanager.billing.models.StatusReasonCode; +import com.azure.resourcemanager.billing.models.TargetCloud; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A billing profile. */ +@JsonFlatten +@Fluent +public class BillingProfileInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingProfileInner.class); + + /* + * The name of the billing profile. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /* + * The purchase order name that will appear on the invoices generated for + * the billing profile. + */ + @JsonProperty(value = "properties.poNumber") + private String poNumber; + + /* + * Identifies which services and purchases are paid by a billing profile. + */ + @JsonProperty(value = "properties.billingRelationshipType", access = JsonProperty.Access.WRITE_ONLY) + private BillingRelationshipType billingRelationshipType; + + /* + * Billing address. + */ + @JsonProperty(value = "properties.billTo") + private AddressDetails billTo; + + /* + * Identifies the billing profile that is linked to another billing profile + * in indirect purchase motion. + */ + @JsonProperty(value = "properties.indirectRelationshipInfo", access = JsonProperty.Access.WRITE_ONLY) + private IndirectRelationshipInfo indirectRelationshipInfo; + + /* + * Flag controlling whether the invoices for the billing profile are sent + * through email. + */ + @JsonProperty(value = "properties.invoiceEmailOptIn") + private Boolean invoiceEmailOptIn; + + /* + * The day of the month when the invoice for the billing profile is + * generated. + */ + @JsonProperty(value = "properties.invoiceDay", access = JsonProperty.Access.WRITE_ONLY) + private Integer invoiceDay; + + /* + * The currency in which the charges for the billing profile are billed. + */ + @JsonProperty(value = "properties.currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /* + * Information about the enabled azure plans. + */ + @JsonProperty(value = "properties.enabledAzurePlans") + private List enabledAzurePlans; + + /* + * The invoice sections associated to the billing profile. By default this + * is not populated, unless it's specified in $expand. + */ + @JsonProperty(value = "properties.invoiceSections") + private InvoiceSectionsOnExpand invoiceSections; + + /* + * Indicates whether user has read access to the billing profile. + */ + @JsonProperty(value = "properties.hasReadAccess", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasReadAccess; + + /* + * The system generated unique identifier for a billing profile. + */ + @JsonProperty(value = "properties.systemId", access = JsonProperty.Access.WRITE_ONLY) + private String systemId; + + /* + * The status of the billing profile. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private BillingProfileStatus status; + + /* + * Reason for the specified billing profile status. + */ + @JsonProperty(value = "properties.statusReasonCode", access = JsonProperty.Access.WRITE_ONLY) + private StatusReasonCode statusReasonCode; + + /* + * The billing profile spending limit. + */ + @JsonProperty(value = "properties.spendingLimit", access = JsonProperty.Access.WRITE_ONLY) + private SpendingLimit spendingLimit; + + /* + * Identifies the cloud environments that are associated with a billing + * profile. This is a system managed optional field and gets updated as the + * billing profile gets associated with accounts in various clouds. + */ + @JsonProperty(value = "properties.targetClouds", access = JsonProperty.Access.WRITE_ONLY) + private List targetClouds; + + /** + * Get the displayName property: The name of the billing profile. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The name of the billing profile. + * + * @param displayName the displayName value to set. + * @return the BillingProfileInner object itself. + */ + public BillingProfileInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the poNumber property: The purchase order name that will appear on the invoices generated for the billing + * profile. + * + * @return the poNumber value. + */ + public String poNumber() { + return this.poNumber; + } + + /** + * Set the poNumber property: The purchase order name that will appear on the invoices generated for the billing + * profile. + * + * @param poNumber the poNumber value to set. + * @return the BillingProfileInner object itself. + */ + public BillingProfileInner withPoNumber(String poNumber) { + this.poNumber = poNumber; + return this; + } + + /** + * Get the billingRelationshipType property: Identifies which services and purchases are paid by a billing profile. + * + * @return the billingRelationshipType value. + */ + public BillingRelationshipType billingRelationshipType() { + return this.billingRelationshipType; + } + + /** + * Get the billTo property: Billing address. + * + * @return the billTo value. + */ + public AddressDetails billTo() { + return this.billTo; + } + + /** + * Set the billTo property: Billing address. + * + * @param billTo the billTo value to set. + * @return the BillingProfileInner object itself. + */ + public BillingProfileInner withBillTo(AddressDetails billTo) { + this.billTo = billTo; + return this; + } + + /** + * Get the indirectRelationshipInfo property: Identifies the billing profile that is linked to another billing + * profile in indirect purchase motion. + * + * @return the indirectRelationshipInfo value. + */ + public IndirectRelationshipInfo indirectRelationshipInfo() { + return this.indirectRelationshipInfo; + } + + /** + * Get the invoiceEmailOptIn property: Flag controlling whether the invoices for the billing profile are sent + * through email. + * + * @return the invoiceEmailOptIn value. + */ + public Boolean invoiceEmailOptIn() { + return this.invoiceEmailOptIn; + } + + /** + * Set the invoiceEmailOptIn property: Flag controlling whether the invoices for the billing profile are sent + * through email. + * + * @param invoiceEmailOptIn the invoiceEmailOptIn value to set. + * @return the BillingProfileInner object itself. + */ + public BillingProfileInner withInvoiceEmailOptIn(Boolean invoiceEmailOptIn) { + this.invoiceEmailOptIn = invoiceEmailOptIn; + return this; + } + + /** + * Get the invoiceDay property: The day of the month when the invoice for the billing profile is generated. + * + * @return the invoiceDay value. + */ + public Integer invoiceDay() { + return this.invoiceDay; + } + + /** + * Get the currency property: The currency in which the charges for the billing profile are billed. + * + * @return the currency value. + */ + public String currency() { + return this.currency; + } + + /** + * Get the enabledAzurePlans property: Information about the enabled azure plans. + * + * @return the enabledAzurePlans value. + */ + public List enabledAzurePlans() { + return this.enabledAzurePlans; + } + + /** + * Set the enabledAzurePlans property: Information about the enabled azure plans. + * + * @param enabledAzurePlans the enabledAzurePlans value to set. + * @return the BillingProfileInner object itself. + */ + public BillingProfileInner withEnabledAzurePlans(List enabledAzurePlans) { + this.enabledAzurePlans = enabledAzurePlans; + return this; + } + + /** + * Get the invoiceSections property: The invoice sections associated to the billing profile. By default this is not + * populated, unless it's specified in $expand. + * + * @return the invoiceSections value. + */ + public InvoiceSectionsOnExpand invoiceSections() { + return this.invoiceSections; + } + + /** + * Set the invoiceSections property: The invoice sections associated to the billing profile. By default this is not + * populated, unless it's specified in $expand. + * + * @param invoiceSections the invoiceSections value to set. + * @return the BillingProfileInner object itself. + */ + public BillingProfileInner withInvoiceSections(InvoiceSectionsOnExpand invoiceSections) { + this.invoiceSections = invoiceSections; + return this; + } + + /** + * Get the hasReadAccess property: Indicates whether user has read access to the billing profile. + * + * @return the hasReadAccess value. + */ + public Boolean hasReadAccess() { + return this.hasReadAccess; + } + + /** + * Get the systemId property: The system generated unique identifier for a billing profile. + * + * @return the systemId value. + */ + public String systemId() { + return this.systemId; + } + + /** + * Get the status property: The status of the billing profile. + * + * @return the status value. + */ + public BillingProfileStatus status() { + return this.status; + } + + /** + * Get the statusReasonCode property: Reason for the specified billing profile status. + * + * @return the statusReasonCode value. + */ + public StatusReasonCode statusReasonCode() { + return this.statusReasonCode; + } + + /** + * Get the spendingLimit property: The billing profile spending limit. + * + * @return the spendingLimit value. + */ + public SpendingLimit spendingLimit() { + return this.spendingLimit; + } + + /** + * Get the targetClouds property: Identifies the cloud environments that are associated with a billing profile. This + * is a system managed optional field and gets updated as the billing profile gets associated with accounts in + * various clouds. + * + * @return the targetClouds value. + */ + public List targetClouds() { + return this.targetClouds; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (billTo() != null) { + billTo().validate(); + } + if (indirectRelationshipInfo() != null) { + indirectRelationshipInfo().validate(); + } + if (enabledAzurePlans() != null) { + enabledAzurePlans().forEach(e -> e.validate()); + } + if (invoiceSections() != null) { + invoiceSections().validate(); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingPropertyInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingPropertyInner.java new file mode 100644 index 0000000000000..1632e77f0864e --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingPropertyInner.java @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.models.BillingProfileSpendingLimit; +import com.azure.resourcemanager.billing.models.BillingProfileStatus; +import com.azure.resourcemanager.billing.models.BillingProfileStatusReasonCode; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A billing property. */ +@JsonFlatten +@Fluent +public class BillingPropertyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingPropertyInner.class); + + /* + * The email address on which the account admin gets all Azure + * notifications. + */ + @JsonProperty(value = "properties.accountAdminNotificationEmailAddress", access = JsonProperty.Access.WRITE_ONLY) + private String accountAdminNotificationEmailAddress; + + /* + * The Azure AD tenant ID of the billing account for the subscription. + */ + @JsonProperty(value = "properties.billingTenantId", access = JsonProperty.Access.WRITE_ONLY) + private String billingTenantId; + + /* + * The ID of the billing account to which the subscription is billed. + */ + @JsonProperty(value = "properties.billingAccountId", access = JsonProperty.Access.WRITE_ONLY) + private String billingAccountId; + + /* + * The name of the billing account to which the subscription is billed. + */ + @JsonProperty(value = "properties.billingAccountDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String billingAccountDisplayName; + + /* + * The ID of the billing profile to which the subscription is billed. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /* + * The name of the billing profile to which the subscription is billed. + */ + @JsonProperty(value = "properties.billingProfileDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileDisplayName; + + /* + * The status of the billing profile. + */ + @JsonProperty(value = "properties.billingProfileStatus", access = JsonProperty.Access.WRITE_ONLY) + private BillingProfileStatus billingProfileStatus; + + /* + * Reason for the specified billing profile status. + */ + @JsonProperty(value = "properties.billingProfileStatusReasonCode", access = JsonProperty.Access.WRITE_ONLY) + private BillingProfileStatusReasonCode billingProfileStatusReasonCode; + + /* + * The billing profile spending limit. + */ + @JsonProperty(value = "properties.billingProfileSpendingLimit", access = JsonProperty.Access.WRITE_ONLY) + private BillingProfileSpendingLimit billingProfileSpendingLimit; + + /* + * The cost center applied to the subscription. + */ + @JsonProperty(value = "properties.costCenter") + private String costCenter; + + /* + * The ID of the invoice section to which the subscription is billed. + */ + @JsonProperty(value = "properties.invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /* + * The name of the invoice section to which the subscription is billed. + */ + @JsonProperty(value = "properties.invoiceSectionDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionDisplayName; + + /* + * Indicates whether user is the account admin. + */ + @JsonProperty(value = "properties.isAccountAdmin", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isAccountAdmin; + + /* + * The product ID of the Azure plan. + */ + @JsonProperty(value = "properties.productId", access = JsonProperty.Access.WRITE_ONLY) + private String productId; + + /* + * The product name of the Azure plan. + */ + @JsonProperty(value = "properties.productName", access = JsonProperty.Access.WRITE_ONLY) + private String productName; + + /* + * The sku ID of the Azure plan for the subscription. + */ + @JsonProperty(value = "properties.skuId", access = JsonProperty.Access.WRITE_ONLY) + private String skuId; + + /* + * The sku description of the Azure plan for the subscription. + */ + @JsonProperty(value = "properties.skuDescription", access = JsonProperty.Access.WRITE_ONLY) + private String skuDescription; + + /** + * Get the accountAdminNotificationEmailAddress property: The email address on which the account admin gets all + * Azure notifications. + * + * @return the accountAdminNotificationEmailAddress value. + */ + public String accountAdminNotificationEmailAddress() { + return this.accountAdminNotificationEmailAddress; + } + + /** + * Get the billingTenantId property: The Azure AD tenant ID of the billing account for the subscription. + * + * @return the billingTenantId value. + */ + public String billingTenantId() { + return this.billingTenantId; + } + + /** + * Get the billingAccountId property: The ID of the billing account to which the subscription is billed. + * + * @return the billingAccountId value. + */ + public String billingAccountId() { + return this.billingAccountId; + } + + /** + * Get the billingAccountDisplayName property: The name of the billing account to which the subscription is billed. + * + * @return the billingAccountDisplayName value. + */ + public String billingAccountDisplayName() { + return this.billingAccountDisplayName; + } + + /** + * Get the billingProfileId property: The ID of the billing profile to which the subscription is billed. + * + * @return the billingProfileId value. + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the billingProfileDisplayName property: The name of the billing profile to which the subscription is billed. + * + * @return the billingProfileDisplayName value. + */ + public String billingProfileDisplayName() { + return this.billingProfileDisplayName; + } + + /** + * Get the billingProfileStatus property: The status of the billing profile. + * + * @return the billingProfileStatus value. + */ + public BillingProfileStatus billingProfileStatus() { + return this.billingProfileStatus; + } + + /** + * Get the billingProfileStatusReasonCode property: Reason for the specified billing profile status. + * + * @return the billingProfileStatusReasonCode value. + */ + public BillingProfileStatusReasonCode billingProfileStatusReasonCode() { + return this.billingProfileStatusReasonCode; + } + + /** + * Get the billingProfileSpendingLimit property: The billing profile spending limit. + * + * @return the billingProfileSpendingLimit value. + */ + public BillingProfileSpendingLimit billingProfileSpendingLimit() { + return this.billingProfileSpendingLimit; + } + + /** + * Get the costCenter property: The cost center applied to the subscription. + * + * @return the costCenter value. + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Set the costCenter property: The cost center applied to the subscription. + * + * @param costCenter the costCenter value to set. + * @return the BillingPropertyInner object itself. + */ + public BillingPropertyInner withCostCenter(String costCenter) { + this.costCenter = costCenter; + return this; + } + + /** + * Get the invoiceSectionId property: The ID of the invoice section to which the subscription is billed. + * + * @return the invoiceSectionId value. + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get the invoiceSectionDisplayName property: The name of the invoice section to which the subscription is billed. + * + * @return the invoiceSectionDisplayName value. + */ + public String invoiceSectionDisplayName() { + return this.invoiceSectionDisplayName; + } + + /** + * Get the isAccountAdmin property: Indicates whether user is the account admin. + * + * @return the isAccountAdmin value. + */ + public Boolean isAccountAdmin() { + return this.isAccountAdmin; + } + + /** + * Get the productId property: The product ID of the Azure plan. + * + * @return the productId value. + */ + public String productId() { + return this.productId; + } + + /** + * Get the productName property: The product name of the Azure plan. + * + * @return the productName value. + */ + public String productName() { + return this.productName; + } + + /** + * Get the skuId property: The sku ID of the Azure plan for the subscription. + * + * @return the skuId value. + */ + public String skuId() { + return this.skuId; + } + + /** + * Get the skuDescription property: The sku description of the Azure plan for the subscription. + * + * @return the skuDescription value. + */ + public String skuDescription() { + return this.skuDescription; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingRoleAssignmentInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingRoleAssignmentInner.java new file mode 100644 index 0000000000000..a8dc13c2c9a5a --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingRoleAssignmentInner.java @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The role assignment. */ +@JsonFlatten +@Fluent +public class BillingRoleAssignmentInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingRoleAssignmentInner.class); + + /* + * The date the role assignment was created. + */ + @JsonProperty(value = "properties.createdOn", access = JsonProperty.Access.WRITE_ONLY) + private String createdOn; + + /* + * The tenant Id of the user who created the role assignment. + */ + @JsonProperty(value = "properties.createdByPrincipalTenantId", access = JsonProperty.Access.WRITE_ONLY) + private String createdByPrincipalTenantId; + + /* + * The principal Id of the user who created the role assignment. + */ + @JsonProperty(value = "properties.createdByPrincipalId", access = JsonProperty.Access.WRITE_ONLY) + private String createdByPrincipalId; + + /* + * The email address of the user who created the role assignment. + */ + @JsonProperty(value = "properties.createdByUserEmailAddress", access = JsonProperty.Access.WRITE_ONLY) + private String createdByUserEmailAddress; + + /* + * The principal id of the user to whom the role was assigned. + */ + @JsonProperty(value = "properties.principalId") + private String principalId; + + /* + * The principal tenant id of the user to whom the role was assigned. + */ + @JsonProperty(value = "properties.principalTenantId") + private String principalTenantId; + + /* + * The ID of the role definition. + */ + @JsonProperty(value = "properties.roleDefinitionId") + private String roleDefinitionId; + + /* + * The scope at which the role was assigned. + */ + @JsonProperty(value = "properties.scope", access = JsonProperty.Access.WRITE_ONLY) + private String scope; + + /* + * The authentication type. + */ + @JsonProperty(value = "properties.userAuthenticationType") + private String userAuthenticationType; + + /* + * The email address of the user. + */ + @JsonProperty(value = "properties.userEmailAddress") + private String userEmailAddress; + + /** + * Get the createdOn property: The date the role assignment was created. + * + * @return the createdOn value. + */ + public String createdOn() { + return this.createdOn; + } + + /** + * Get the createdByPrincipalTenantId property: The tenant Id of the user who created the role assignment. + * + * @return the createdByPrincipalTenantId value. + */ + public String createdByPrincipalTenantId() { + return this.createdByPrincipalTenantId; + } + + /** + * Get the createdByPrincipalId property: The principal Id of the user who created the role assignment. + * + * @return the createdByPrincipalId value. + */ + public String createdByPrincipalId() { + return this.createdByPrincipalId; + } + + /** + * Get the createdByUserEmailAddress property: The email address of the user who created the role assignment. + * + * @return the createdByUserEmailAddress value. + */ + public String createdByUserEmailAddress() { + return this.createdByUserEmailAddress; + } + + /** + * Get the principalId property: The principal id of the user to whom the role was assigned. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principalId property: The principal id of the user to whom the role was assigned. + * + * @param principalId the principalId value to set. + * @return the BillingRoleAssignmentInner object itself. + */ + public BillingRoleAssignmentInner withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the principalTenantId property: The principal tenant id of the user to whom the role was assigned. + * + * @return the principalTenantId value. + */ + public String principalTenantId() { + return this.principalTenantId; + } + + /** + * Set the principalTenantId property: The principal tenant id of the user to whom the role was assigned. + * + * @param principalTenantId the principalTenantId value to set. + * @return the BillingRoleAssignmentInner object itself. + */ + public BillingRoleAssignmentInner withPrincipalTenantId(String principalTenantId) { + this.principalTenantId = principalTenantId; + return this; + } + + /** + * Get the roleDefinitionId property: The ID of the role definition. + * + * @return the roleDefinitionId value. + */ + public String roleDefinitionId() { + return this.roleDefinitionId; + } + + /** + * Set the roleDefinitionId property: The ID of the role definition. + * + * @param roleDefinitionId the roleDefinitionId value to set. + * @return the BillingRoleAssignmentInner object itself. + */ + public BillingRoleAssignmentInner withRoleDefinitionId(String roleDefinitionId) { + this.roleDefinitionId = roleDefinitionId; + return this; + } + + /** + * Get the scope property: The scope at which the role was assigned. + * + * @return the scope value. + */ + public String scope() { + return this.scope; + } + + /** + * Get the userAuthenticationType property: The authentication type. + * + * @return the userAuthenticationType value. + */ + public String userAuthenticationType() { + return this.userAuthenticationType; + } + + /** + * Set the userAuthenticationType property: The authentication type. + * + * @param userAuthenticationType the userAuthenticationType value to set. + * @return the BillingRoleAssignmentInner object itself. + */ + public BillingRoleAssignmentInner withUserAuthenticationType(String userAuthenticationType) { + this.userAuthenticationType = userAuthenticationType; + return this; + } + + /** + * Get the userEmailAddress property: The email address of the user. + * + * @return the userEmailAddress value. + */ + public String userEmailAddress() { + return this.userEmailAddress; + } + + /** + * Set the userEmailAddress property: The email address of the user. + * + * @param userEmailAddress the userEmailAddress value to set. + * @return the BillingRoleAssignmentInner object itself. + */ + public BillingRoleAssignmentInner withUserEmailAddress(String userEmailAddress) { + this.userEmailAddress = userEmailAddress; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingRoleDefinitionInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingRoleDefinitionInner.java new file mode 100644 index 0000000000000..27dbe8fbd5124 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingRoleDefinitionInner.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties of a role definition. */ +@JsonFlatten +@Fluent +public class BillingRoleDefinitionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingRoleDefinitionInner.class); + + /* + * The role description + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * The billingPermissions the role has + */ + @JsonProperty(value = "properties.permissions") + private List permissions; + + /* + * The name of the role + */ + @JsonProperty(value = "properties.roleName", access = JsonProperty.Access.WRITE_ONLY) + private String roleName; + + /** + * Get the description property: The role description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the permissions property: The billingPermissions the role has. + * + * @return the permissions value. + */ + public List permissions() { + return this.permissions; + } + + /** + * Set the permissions property: The billingPermissions the role has. + * + * @param permissions the permissions value to set. + * @return the BillingRoleDefinitionInner object itself. + */ + public BillingRoleDefinitionInner withPermissions(List permissions) { + this.permissions = permissions; + return this; + } + + /** + * Get the roleName property: The name of the role. + * + * @return the roleName value. + */ + public String roleName() { + return this.roleName; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (permissions() != null) { + permissions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingSubscriptionInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingSubscriptionInner.java new file mode 100644 index 0000000000000..123ee76d91bd1 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingSubscriptionInner.java @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.models.Amount; +import com.azure.resourcemanager.billing.models.BillingSubscriptionStatusType; +import com.azure.resourcemanager.billing.models.Reseller; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** A billing subscription. */ +@JsonFlatten +@Fluent +public class BillingSubscriptionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingSubscriptionInner.class); + + /* + * The name of the subscription. + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * The ID of the subscription. + */ + @JsonProperty(value = "properties.subscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private UUID subscriptionId; + + /* + * The current billing status of the subscription. + */ + @JsonProperty(value = "properties.subscriptionBillingStatus") + private BillingSubscriptionStatusType subscriptionBillingStatus; + + /* + * The last month charges. + */ + @JsonProperty(value = "properties.lastMonthCharges", access = JsonProperty.Access.WRITE_ONLY) + private Amount lastMonthCharges; + + /* + * The current month to date charges. + */ + @JsonProperty(value = "properties.monthToDateCharges", access = JsonProperty.Access.WRITE_ONLY) + private Amount monthToDateCharges; + + /* + * The ID of the billing profile to which the subscription is billed. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /* + * The name of the billing profile to which the subscription is billed. + */ + @JsonProperty(value = "properties.billingProfileDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileDisplayName; + + /* + * The cost center applied to the subscription. + */ + @JsonProperty(value = "properties.costCenter") + private String costCenter; + + /* + * The ID of the customer for whom the subscription was created. The field + * is applicable only for Microsoft Partner Agreement billing account. + */ + @JsonProperty(value = "properties.customerId", access = JsonProperty.Access.WRITE_ONLY) + private String customerId; + + /* + * The name of the customer for whom the subscription was created. The + * field is applicable only for Microsoft Partner Agreement billing + * account. + */ + @JsonProperty(value = "properties.customerDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String customerDisplayName; + + /* + * The ID of the invoice section to which the subscription is billed. + */ + @JsonProperty(value = "properties.invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /* + * The name of the invoice section to which the subscription is billed. + */ + @JsonProperty(value = "properties.invoiceSectionDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionDisplayName; + + /* + * Reseller for this subscription. + */ + @JsonProperty(value = "properties.reseller", access = JsonProperty.Access.WRITE_ONLY) + private Reseller reseller; + + /* + * The sku ID of the Azure plan for the subscription. + */ + @JsonProperty(value = "properties.skuId") + private String skuId; + + /* + * The sku description of the Azure plan for the subscription. + */ + @JsonProperty(value = "properties.skuDescription", access = JsonProperty.Access.WRITE_ONLY) + private String skuDescription; + + /** + * Get the displayName property: The name of the subscription. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the subscriptionId property: The ID of the subscription. + * + * @return the subscriptionId value. + */ + public UUID subscriptionId() { + return this.subscriptionId; + } + + /** + * Get the subscriptionBillingStatus property: The current billing status of the subscription. + * + * @return the subscriptionBillingStatus value. + */ + public BillingSubscriptionStatusType subscriptionBillingStatus() { + return this.subscriptionBillingStatus; + } + + /** + * Set the subscriptionBillingStatus property: The current billing status of the subscription. + * + * @param subscriptionBillingStatus the subscriptionBillingStatus value to set. + * @return the BillingSubscriptionInner object itself. + */ + public BillingSubscriptionInner withSubscriptionBillingStatus( + BillingSubscriptionStatusType subscriptionBillingStatus) { + this.subscriptionBillingStatus = subscriptionBillingStatus; + return this; + } + + /** + * Get the lastMonthCharges property: The last month charges. + * + * @return the lastMonthCharges value. + */ + public Amount lastMonthCharges() { + return this.lastMonthCharges; + } + + /** + * Get the monthToDateCharges property: The current month to date charges. + * + * @return the monthToDateCharges value. + */ + public Amount monthToDateCharges() { + return this.monthToDateCharges; + } + + /** + * Get the billingProfileId property: The ID of the billing profile to which the subscription is billed. + * + * @return the billingProfileId value. + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the billingProfileDisplayName property: The name of the billing profile to which the subscription is billed. + * + * @return the billingProfileDisplayName value. + */ + public String billingProfileDisplayName() { + return this.billingProfileDisplayName; + } + + /** + * Get the costCenter property: The cost center applied to the subscription. + * + * @return the costCenter value. + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Set the costCenter property: The cost center applied to the subscription. + * + * @param costCenter the costCenter value to set. + * @return the BillingSubscriptionInner object itself. + */ + public BillingSubscriptionInner withCostCenter(String costCenter) { + this.costCenter = costCenter; + return this; + } + + /** + * Get the customerId property: The ID of the customer for whom the subscription was created. The field is + * applicable only for Microsoft Partner Agreement billing account. + * + * @return the customerId value. + */ + public String customerId() { + return this.customerId; + } + + /** + * Get the customerDisplayName property: The name of the customer for whom the subscription was created. The field + * is applicable only for Microsoft Partner Agreement billing account. + * + * @return the customerDisplayName value. + */ + public String customerDisplayName() { + return this.customerDisplayName; + } + + /** + * Get the invoiceSectionId property: The ID of the invoice section to which the subscription is billed. + * + * @return the invoiceSectionId value. + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get the invoiceSectionDisplayName property: The name of the invoice section to which the subscription is billed. + * + * @return the invoiceSectionDisplayName value. + */ + public String invoiceSectionDisplayName() { + return this.invoiceSectionDisplayName; + } + + /** + * Get the reseller property: Reseller for this subscription. + * + * @return the reseller value. + */ + public Reseller reseller() { + return this.reseller; + } + + /** + * Get the skuId property: The sku ID of the Azure plan for the subscription. + * + * @return the skuId value. + */ + public String skuId() { + return this.skuId; + } + + /** + * Set the skuId property: The sku ID of the Azure plan for the subscription. + * + * @param skuId the skuId value to set. + * @return the BillingSubscriptionInner object itself. + */ + public BillingSubscriptionInner withSkuId(String skuId) { + this.skuId = skuId; + return this; + } + + /** + * Get the skuDescription property: The sku description of the Azure plan for the subscription. + * + * @return the skuDescription value. + */ + public String skuDescription() { + return this.skuDescription; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (lastMonthCharges() != null) { + lastMonthCharges().validate(); + } + if (monthToDateCharges() != null) { + monthToDateCharges().validate(); + } + if (reseller() != null) { + reseller().validate(); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/CustomerInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/CustomerInner.java new file mode 100644 index 0000000000000..ca617e779cf57 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/CustomerInner.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.models.AzurePlan; +import com.azure.resourcemanager.billing.models.Reseller; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A partner's customer. */ +@JsonFlatten +@Fluent +public class CustomerInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomerInner.class); + + /* + * The ID of the billing profile for the invoice section. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /* + * The name of the billing profile for the invoice section. + */ + @JsonProperty(value = "properties.billingProfileDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileDisplayName; + + /* + * The name of the customer. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /* + * Azure plans enabled for the customer. + */ + @JsonProperty(value = "properties.enabledAzurePlans") + private List enabledAzurePlans; + + /* + * The list of resellers for which an Azure plan is enabled for the + * customer. + */ + @JsonProperty(value = "properties.resellers") + private List resellers; + + /** + * Get the billingProfileId property: The ID of the billing profile for the invoice section. + * + * @return the billingProfileId value. + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the billingProfileDisplayName property: The name of the billing profile for the invoice section. + * + * @return the billingProfileDisplayName value. + */ + public String billingProfileDisplayName() { + return this.billingProfileDisplayName; + } + + /** + * Get the displayName property: The name of the customer. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: 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 the enabledAzurePlans property: Azure plans enabled for the customer. + * + * @return the enabledAzurePlans value. + */ + public List enabledAzurePlans() { + return this.enabledAzurePlans; + } + + /** + * Set the enabledAzurePlans property: Azure plans enabled for the customer. + * + * @param enabledAzurePlans the enabledAzurePlans value to set. + * @return the CustomerInner object itself. + */ + public CustomerInner withEnabledAzurePlans(List enabledAzurePlans) { + this.enabledAzurePlans = enabledAzurePlans; + return this; + } + + /** + * Get the resellers property: The list of resellers for which an Azure plan is enabled for the customer. + * + * @return the resellers value. + */ + public List resellers() { + return this.resellers; + } + + /** + * Set the resellers property: The list of resellers for which an Azure plan is enabled for the customer. + * + * @param resellers the resellers value to set. + * @return the CustomerInner object itself. + */ + public CustomerInner withResellers(List resellers) { + this.resellers = resellers; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (enabledAzurePlans() != null) { + enabledAzurePlans().forEach(e -> e.validate()); + } + if (resellers() != null) { + resellers().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/CustomerPolicyInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/CustomerPolicyInner.java new file mode 100644 index 0000000000000..1afee3cd70825 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/CustomerPolicyInner.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.models.ViewCharges; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The customer's Policy. */ +@JsonFlatten +@Fluent +public class CustomerPolicyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomerPolicyInner.class); + + /* + * The policy that controls whether the users in customer's organization + * can view charges at pay-as-you-go prices. + */ + @JsonProperty(value = "properties.viewCharges") + private ViewCharges viewCharges; + + /** + * Get the viewCharges property: The policy that controls whether the users in customer's organization can view + * charges at pay-as-you-go prices. + * + * @return the viewCharges value. + */ + public ViewCharges viewCharges() { + return this.viewCharges; + } + + /** + * Set the viewCharges property: The policy that controls whether the users in customer's organization can view + * charges at pay-as-you-go prices. + * + * @param viewCharges the viewCharges value to set. + * @return the CustomerPolicyInner object itself. + */ + public CustomerPolicyInner withViewCharges(ViewCharges viewCharges) { + this.viewCharges = viewCharges; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/DownloadUrlInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/DownloadUrlInner.java new file mode 100644 index 0000000000000..f8b4bc915aad2 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/DownloadUrlInner.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A secure URL that can be used to download a an entity until the URL expires. */ +@Immutable +public final class DownloadUrlInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DownloadUrlInner.class); + + /* + * The time in UTC when the download URL will expire. + */ + @JsonProperty(value = "expiryTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime expiryTime; + + /* + * The URL to the PDF file. + */ + @JsonProperty(value = "url", access = JsonProperty.Access.WRITE_ONLY) + private String url; + + /** + * Get the expiryTime property: The time in UTC when the download URL will expire. + * + * @return the expiryTime value. + */ + public OffsetDateTime expiryTime() { + return this.expiryTime; + } + + /** + * Get the url property: The URL to the PDF file. + * + * @return the url value. + */ + public String url() { + return this.url; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/EnrollmentAccountSummaryInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/EnrollmentAccountSummaryInner.java new file mode 100644 index 0000000000000..7a6232e5373e2 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/EnrollmentAccountSummaryInner.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An enrollment account resource. */ +@JsonFlatten +@Immutable +public class EnrollmentAccountSummaryInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EnrollmentAccountSummaryInner.class); + + /* + * The account owner's principal name. + */ + @JsonProperty(value = "properties.principalName", access = JsonProperty.Access.WRITE_ONLY) + private String principalName; + + /** + * Get the principalName property: The account owner's principal name. + * + * @return the principalName value. + */ + public String principalName() { + return this.principalName; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InstructionInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InstructionInner.java new file mode 100644 index 0000000000000..7ca04a46c7717 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InstructionInner.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** An instruction. */ +@JsonFlatten +@Fluent +public class InstructionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InstructionInner.class); + + /* + * The amount budgeted for this billing instruction. + */ + @JsonProperty(value = "properties.amount") + private Float amount; + + /* + * The date this billing instruction goes into effect. + */ + @JsonProperty(value = "properties.startDate") + private OffsetDateTime startDate; + + /* + * The date this billing instruction is no longer in effect. + */ + @JsonProperty(value = "properties.endDate") + private OffsetDateTime endDate; + + /* + * The date this billing instruction was created. + */ + @JsonProperty(value = "properties.creationDate") + private OffsetDateTime creationDate; + + /** + * Get the amount property: The amount budgeted for this billing instruction. + * + * @return the amount value. + */ + public Float amount() { + return this.amount; + } + + /** + * Set the amount property: The amount budgeted for this billing instruction. + * + * @param amount the amount value to set. + * @return the InstructionInner object itself. + */ + public InstructionInner withAmount(Float amount) { + this.amount = amount; + return this; + } + + /** + * Get the startDate property: The date this billing instruction goes into effect. + * + * @return the startDate value. + */ + public OffsetDateTime startDate() { + return this.startDate; + } + + /** + * Set the startDate property: The date this billing instruction goes into effect. + * + * @param startDate the startDate value to set. + * @return the InstructionInner object itself. + */ + public InstructionInner withStartDate(OffsetDateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get the endDate property: The date this billing instruction is no longer in effect. + * + * @return the endDate value. + */ + public OffsetDateTime endDate() { + return this.endDate; + } + + /** + * Set the endDate property: The date this billing instruction is no longer in effect. + * + * @param endDate the endDate value to set. + * @return the InstructionInner object itself. + */ + public InstructionInner withEndDate(OffsetDateTime endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get the creationDate property: The date this billing instruction was created. + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Set the creationDate property: The date this billing instruction was created. + * + * @param creationDate the creationDate value to set. + * @return the InstructionInner object itself. + */ + public InstructionInner withCreationDate(OffsetDateTime creationDate) { + this.creationDate = creationDate; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InvoiceInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InvoiceInner.java new file mode 100644 index 0000000000000..ccfc256173265 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InvoiceInner.java @@ -0,0 +1,475 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.models.Amount; +import com.azure.resourcemanager.billing.models.Document; +import com.azure.resourcemanager.billing.models.InvoiceDocumentType; +import com.azure.resourcemanager.billing.models.InvoiceStatus; +import com.azure.resourcemanager.billing.models.InvoiceType; +import com.azure.resourcemanager.billing.models.PaymentProperties; +import com.azure.resourcemanager.billing.models.RebillDetails; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An invoice. */ +@JsonFlatten +@Immutable +public class InvoiceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InvoiceInner.class); + + /* + * The due date for the invoice. + */ + @JsonProperty(value = "properties.dueDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime dueDate; + + /* + * The date when the invoice was generated. + */ + @JsonProperty(value = "properties.invoiceDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime invoiceDate; + + /* + * The current status of the invoice. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private InvoiceStatus status; + + /* + * The amount due as of now. + */ + @JsonProperty(value = "properties.amountDue", access = JsonProperty.Access.WRITE_ONLY) + private Amount amountDue; + + /* + * The amount of Azure prepayment applied to the charges. This field is + * applicable to billing accounts with agreement type Microsoft Customer + * Agreement. + */ + @JsonProperty(value = "properties.azurePrepaymentApplied", access = JsonProperty.Access.WRITE_ONLY) + private Amount azurePrepaymentApplied; + + /* + * The total charges for the invoice billing period. + */ + @JsonProperty(value = "properties.billedAmount", access = JsonProperty.Access.WRITE_ONLY) + private Amount billedAmount; + + /* + * The total refund for returns and cancellations during the invoice + * billing period. This field is applicable to billing accounts with + * agreement type Microsoft Customer Agreement. + */ + @JsonProperty(value = "properties.creditAmount", access = JsonProperty.Access.WRITE_ONLY) + private Amount creditAmount; + + /* + * The amount of free Azure credits applied to the charges. This field is + * applicable to billing accounts with agreement type Microsoft Customer + * Agreement. + */ + @JsonProperty(value = "properties.freeAzureCreditApplied", access = JsonProperty.Access.WRITE_ONLY) + private Amount freeAzureCreditApplied; + + /* + * The pre-tax amount due. This field is applicable to billing accounts + * with agreement type Microsoft Customer Agreement. + */ + @JsonProperty(value = "properties.subTotal", access = JsonProperty.Access.WRITE_ONLY) + private Amount subTotal; + + /* + * The amount of tax charged for the billing period. This field is + * applicable to billing accounts with agreement type Microsoft Customer + * Agreement. + */ + @JsonProperty(value = "properties.taxAmount", access = JsonProperty.Access.WRITE_ONLY) + private Amount taxAmount; + + /* + * The amount due when the invoice was generated. This field is applicable + * to billing accounts with agreement type Microsoft Customer Agreement. + */ + @JsonProperty(value = "properties.totalAmount", access = JsonProperty.Access.WRITE_ONLY) + private Amount totalAmount; + + /* + * The start date of the billing period for which the invoice is generated. + */ + @JsonProperty(value = "properties.invoicePeriodStartDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime invoicePeriodStartDate; + + /* + * The end date of the billing period for which the invoice is generated. + */ + @JsonProperty(value = "properties.invoicePeriodEndDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime invoicePeriodEndDate; + + /* + * Invoice type. + */ + @JsonProperty(value = "properties.invoiceType", access = JsonProperty.Access.WRITE_ONLY) + private InvoiceType invoiceType; + + /* + * Specifies if the invoice is generated as part of monthly invoicing cycle + * or not. This field is applicable to billing accounts with agreement type + * Microsoft Customer Agreement. + */ + @JsonProperty(value = "properties.isMonthlyInvoice", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isMonthlyInvoice; + + /* + * The ID of the billing profile for which the invoice is generated. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /* + * The name of the billing profile for which the invoice is generated. + */ + @JsonProperty(value = "properties.billingProfileDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileDisplayName; + + /* + * An optional purchase order number for the invoice. + */ + @JsonProperty(value = "properties.purchaseOrderNumber", access = JsonProperty.Access.WRITE_ONLY) + private String purchaseOrderNumber; + + /* + * List of documents available to download such as invoice and tax receipt. + */ + @JsonProperty(value = "properties.documents", access = JsonProperty.Access.WRITE_ONLY) + private List documents; + + /* + * List of payments. + */ + @JsonProperty(value = "properties.payments", access = JsonProperty.Access.WRITE_ONLY) + private List payments; + + /* + * Rebill details for an invoice. + */ + @JsonProperty(value = "properties.rebillDetails", access = JsonProperty.Access.WRITE_ONLY) + private Map rebillDetails; + + /* + * The type of the document. + */ + @JsonProperty(value = "properties.documentType", access = JsonProperty.Access.WRITE_ONLY) + private InvoiceDocumentType documentType; + + /* + * The Id of the active invoice which is originally billed after this + * invoice was voided. This field is applicable to the void invoices only. + */ + @JsonProperty(value = "properties.billedDocumentId", access = JsonProperty.Access.WRITE_ONLY) + private String billedDocumentId; + + /* + * The Id of the invoice which got voided and this credit note was issued + * as a result. This field is applicable to the credit notes only. + */ + @JsonProperty(value = "properties.creditForDocumentId", access = JsonProperty.Access.WRITE_ONLY) + private String creditForDocumentId; + + /* + * The ID of the subscription for which the invoice is generated. + */ + @JsonProperty(value = "properties.subscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionId; + + /** + * Get the dueDate property: The due date for the invoice. + * + * @return the dueDate value. + */ + public OffsetDateTime dueDate() { + return this.dueDate; + } + + /** + * Get the invoiceDate property: The date when the invoice was generated. + * + * @return the invoiceDate value. + */ + public OffsetDateTime invoiceDate() { + return this.invoiceDate; + } + + /** + * Get the status property: The current status of the invoice. + * + * @return the status value. + */ + public InvoiceStatus status() { + return this.status; + } + + /** + * Get the amountDue property: The amount due as of now. + * + * @return the amountDue value. + */ + public Amount amountDue() { + return this.amountDue; + } + + /** + * Get the azurePrepaymentApplied property: The amount of Azure prepayment applied to the charges. This field is + * applicable to billing accounts with agreement type Microsoft Customer Agreement. + * + * @return the azurePrepaymentApplied value. + */ + public Amount azurePrepaymentApplied() { + return this.azurePrepaymentApplied; + } + + /** + * Get the billedAmount property: The total charges for the invoice billing period. + * + * @return the billedAmount value. + */ + public Amount billedAmount() { + return this.billedAmount; + } + + /** + * Get the creditAmount property: The total refund for returns and cancellations during the invoice billing period. + * This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. + * + * @return the creditAmount value. + */ + public Amount creditAmount() { + return this.creditAmount; + } + + /** + * Get the freeAzureCreditApplied property: The amount of free Azure credits applied to the charges. This field is + * applicable to billing accounts with agreement type Microsoft Customer Agreement. + * + * @return the freeAzureCreditApplied value. + */ + public Amount freeAzureCreditApplied() { + return this.freeAzureCreditApplied; + } + + /** + * Get the subTotal property: The pre-tax amount due. This field is applicable to billing accounts with agreement + * type Microsoft Customer Agreement. + * + * @return the subTotal value. + */ + public Amount subTotal() { + return this.subTotal; + } + + /** + * Get the taxAmount property: The amount of tax charged for the billing period. This field is applicable to billing + * accounts with agreement type Microsoft Customer Agreement. + * + * @return the taxAmount value. + */ + public Amount taxAmount() { + return this.taxAmount; + } + + /** + * Get the totalAmount property: The amount due when the invoice was generated. This field is applicable to billing + * accounts with agreement type Microsoft Customer Agreement. + * + * @return the totalAmount value. + */ + public Amount totalAmount() { + return this.totalAmount; + } + + /** + * Get the invoicePeriodStartDate property: The start date of the billing period for which the invoice is generated. + * + * @return the invoicePeriodStartDate value. + */ + public OffsetDateTime invoicePeriodStartDate() { + return this.invoicePeriodStartDate; + } + + /** + * Get the invoicePeriodEndDate property: The end date of the billing period for which the invoice is generated. + * + * @return the invoicePeriodEndDate value. + */ + public OffsetDateTime invoicePeriodEndDate() { + return this.invoicePeriodEndDate; + } + + /** + * Get the invoiceType property: Invoice type. + * + * @return the invoiceType value. + */ + public InvoiceType invoiceType() { + return this.invoiceType; + } + + /** + * Get the isMonthlyInvoice property: Specifies if the invoice is generated as part of monthly invoicing cycle or + * not. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. + * + * @return the isMonthlyInvoice value. + */ + public Boolean isMonthlyInvoice() { + return this.isMonthlyInvoice; + } + + /** + * Get the billingProfileId property: The ID of the billing profile for which the invoice is generated. + * + * @return the billingProfileId value. + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the billingProfileDisplayName property: The name of the billing profile for which the invoice is generated. + * + * @return the billingProfileDisplayName value. + */ + public String billingProfileDisplayName() { + return this.billingProfileDisplayName; + } + + /** + * Get the purchaseOrderNumber property: An optional purchase order number for the invoice. + * + * @return the purchaseOrderNumber value. + */ + public String purchaseOrderNumber() { + return this.purchaseOrderNumber; + } + + /** + * Get the documents property: List of documents available to download such as invoice and tax receipt. + * + * @return the documents value. + */ + public List documents() { + return this.documents; + } + + /** + * Get the payments property: List of payments. + * + * @return the payments value. + */ + public List payments() { + return this.payments; + } + + /** + * Get the rebillDetails property: Rebill details for an invoice. + * + * @return the rebillDetails value. + */ + public Map rebillDetails() { + return this.rebillDetails; + } + + /** + * Get the documentType property: The type of the document. + * + * @return the documentType value. + */ + public InvoiceDocumentType documentType() { + return this.documentType; + } + + /** + * Get the billedDocumentId property: The Id of the active invoice which is originally billed after this invoice was + * voided. This field is applicable to the void invoices only. + * + * @return the billedDocumentId value. + */ + public String billedDocumentId() { + return this.billedDocumentId; + } + + /** + * Get the creditForDocumentId property: The Id of the invoice which got voided and this credit note was issued as a + * result. This field is applicable to the credit notes only. + * + * @return the creditForDocumentId value. + */ + public String creditForDocumentId() { + return this.creditForDocumentId; + } + + /** + * Get the subscriptionId property: The ID of the subscription for which the invoice is generated. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (amountDue() != null) { + amountDue().validate(); + } + if (azurePrepaymentApplied() != null) { + azurePrepaymentApplied().validate(); + } + if (billedAmount() != null) { + billedAmount().validate(); + } + if (creditAmount() != null) { + creditAmount().validate(); + } + if (freeAzureCreditApplied() != null) { + freeAzureCreditApplied().validate(); + } + if (subTotal() != null) { + subTotal().validate(); + } + if (taxAmount() != null) { + taxAmount().validate(); + } + if (totalAmount() != null) { + totalAmount().validate(); + } + if (documents() != null) { + documents().forEach(e -> e.validate()); + } + if (payments() != null) { + payments().forEach(e -> e.validate()); + } + if (rebillDetails() != null) { + rebillDetails() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InvoiceSectionInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InvoiceSectionInner.java new file mode 100644 index 0000000000000..683a8e10f8684 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InvoiceSectionInner.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.models.InvoiceSectionState; +import com.azure.resourcemanager.billing.models.TargetCloud; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An invoice section. */ +@JsonFlatten +@Fluent +public class InvoiceSectionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InvoiceSectionInner.class); + + /* + * The name of the invoice section. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /* + * Dictionary of metadata associated with the invoice section. + */ + @JsonProperty(value = "properties.labels") + private Map labels; + + /* + * Identifies the state of an invoice section. + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private InvoiceSectionState state; + + /* + * The system generated unique identifier for an invoice section. + */ + @JsonProperty(value = "properties.systemId", access = JsonProperty.Access.WRITE_ONLY) + private String systemId; + + /* + * Identifies the cloud environments that are associated with an invoice + * section. This is a system managed optional field and gets updated as the + * invoice section gets associated with accounts in various clouds. + */ + @JsonProperty(value = "properties.targetCloud", access = JsonProperty.Access.WRITE_ONLY) + private TargetCloud targetCloud; + + /** + * Get the displayName property: The name of the invoice section. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The name of the invoice section. + * + * @param displayName the displayName value to set. + * @return the InvoiceSectionInner object itself. + */ + public InvoiceSectionInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the labels property: Dictionary of metadata associated with the invoice section. + * + * @return the labels value. + */ + public Map labels() { + return this.labels; + } + + /** + * Set the labels property: Dictionary of metadata associated with the invoice section. + * + * @param labels the labels value to set. + * @return the InvoiceSectionInner object itself. + */ + public InvoiceSectionInner withLabels(Map labels) { + this.labels = labels; + return this; + } + + /** + * Get the state property: Identifies the state of an invoice section. + * + * @return the state value. + */ + public InvoiceSectionState state() { + return this.state; + } + + /** + * Get the systemId property: The system generated unique identifier for an invoice section. + * + * @return the systemId value. + */ + public String systemId() { + return this.systemId; + } + + /** + * Get the targetCloud property: Identifies the cloud environments that are associated with an invoice section. This + * is a system managed optional field and gets updated as the invoice section gets associated with accounts in + * various clouds. + * + * @return the targetCloud value. + */ + public TargetCloud targetCloud() { + return this.targetCloud; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InvoiceSectionWithCreateSubPermissionInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InvoiceSectionWithCreateSubPermissionInner.java new file mode 100644 index 0000000000000..b704b84fb1e88 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/InvoiceSectionWithCreateSubPermissionInner.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.models.AzurePlan; +import com.azure.resourcemanager.billing.models.BillingProfileStatus; +import com.azure.resourcemanager.billing.models.SpendingLimitForBillingProfile; +import com.azure.resourcemanager.billing.models.StatusReasonCodeForBillingProfile; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Invoice section properties with create subscription permission. */ +@Fluent +public final class InvoiceSectionWithCreateSubPermissionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InvoiceSectionWithCreateSubPermissionInner.class); + + /* + * The ID of the invoice section. + */ + @JsonProperty(value = "invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /* + * The name of the invoice section. + */ + @JsonProperty(value = "invoiceSectionDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionDisplayName; + + /* + * The system generated unique identifier for an invoice section. + */ + @JsonProperty(value = "invoiceSectionSystemId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionSystemId; + + /* + * The ID of the billing profile for the invoice section. + */ + @JsonProperty(value = "billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /* + * The name of the billing profile for the invoice section. + */ + @JsonProperty(value = "billingProfileDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileDisplayName; + + /* + * The status of the billing profile. + */ + @JsonProperty(value = "billingProfileStatus", access = JsonProperty.Access.WRITE_ONLY) + private BillingProfileStatus billingProfileStatus; + + /* + * Reason for the specified billing profile status. + */ + @JsonProperty(value = "billingProfileStatusReasonCode", access = JsonProperty.Access.WRITE_ONLY) + private StatusReasonCodeForBillingProfile billingProfileStatusReasonCode; + + /* + * The billing profile spending limit. + */ + @JsonProperty(value = "billingProfileSpendingLimit", access = JsonProperty.Access.WRITE_ONLY) + private SpendingLimitForBillingProfile billingProfileSpendingLimit; + + /* + * The system generated unique identifier for a billing profile. + */ + @JsonProperty(value = "billingProfileSystemId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileSystemId; + + /* + * Enabled azure plans for the associated billing profile. + */ + @JsonProperty(value = "enabledAzurePlans") + private List enabledAzurePlans; + + /** + * Get the invoiceSectionId property: The ID of the invoice section. + * + * @return the invoiceSectionId value. + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get the invoiceSectionDisplayName property: The name of the invoice section. + * + * @return the invoiceSectionDisplayName value. + */ + public String invoiceSectionDisplayName() { + return this.invoiceSectionDisplayName; + } + + /** + * Get the invoiceSectionSystemId property: The system generated unique identifier for an invoice section. + * + * @return the invoiceSectionSystemId value. + */ + public String invoiceSectionSystemId() { + return this.invoiceSectionSystemId; + } + + /** + * Get the billingProfileId property: The ID of the billing profile for the invoice section. + * + * @return the billingProfileId value. + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the billingProfileDisplayName property: The name of the billing profile for the invoice section. + * + * @return the billingProfileDisplayName value. + */ + public String billingProfileDisplayName() { + return this.billingProfileDisplayName; + } + + /** + * Get the billingProfileStatus property: The status of the billing profile. + * + * @return the billingProfileStatus value. + */ + public BillingProfileStatus billingProfileStatus() { + return this.billingProfileStatus; + } + + /** + * Get the billingProfileStatusReasonCode property: Reason for the specified billing profile status. + * + * @return the billingProfileStatusReasonCode value. + */ + public StatusReasonCodeForBillingProfile billingProfileStatusReasonCode() { + return this.billingProfileStatusReasonCode; + } + + /** + * Get the billingProfileSpendingLimit property: The billing profile spending limit. + * + * @return the billingProfileSpendingLimit value. + */ + public SpendingLimitForBillingProfile billingProfileSpendingLimit() { + return this.billingProfileSpendingLimit; + } + + /** + * Get the billingProfileSystemId property: The system generated unique identifier for a billing profile. + * + * @return the billingProfileSystemId value. + */ + public String billingProfileSystemId() { + return this.billingProfileSystemId; + } + + /** + * Get the enabledAzurePlans property: Enabled azure plans for the associated billing profile. + * + * @return the enabledAzurePlans value. + */ + public List enabledAzurePlans() { + return this.enabledAzurePlans; + } + + /** + * Set the enabledAzurePlans property: Enabled azure plans for the associated billing profile. + * + * @param enabledAzurePlans the enabledAzurePlans value to set. + * @return the InvoiceSectionWithCreateSubPermissionInner object itself. + */ + public InvoiceSectionWithCreateSubPermissionInner withEnabledAzurePlans(List enabledAzurePlans) { + this.enabledAzurePlans = enabledAzurePlans; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (enabledAzurePlans() != null) { + enabledAzurePlans().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/OperationInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..c157c8d508c0d --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/OperationInner.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A Billing REST API operation. */ +@Fluent +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * 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 the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the display property: The object that represents the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/PolicyInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/PolicyInner.java new file mode 100644 index 0000000000000..818b9fd08dfbb --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/PolicyInner.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.models.MarketplacePurchasesPolicy; +import com.azure.resourcemanager.billing.models.ReservationPurchasesPolicy; +import com.azure.resourcemanager.billing.models.ViewChargesPolicy; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A policy. */ +@JsonFlatten +@Fluent +public class PolicyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PolicyInner.class); + + /* + * The policy that controls whether Azure marketplace purchases are allowed + * for a billing profile. + */ + @JsonProperty(value = "properties.marketplacePurchases") + private MarketplacePurchasesPolicy marketplacePurchases; + + /* + * The policy that controls whether Azure reservation purchases are allowed + * for a billing profile. + */ + @JsonProperty(value = "properties.reservationPurchases") + private ReservationPurchasesPolicy reservationPurchases; + + /* + * The policy that controls whether users with Azure RBAC access to a + * subscription can view its charges. + */ + @JsonProperty(value = "properties.viewCharges") + private ViewChargesPolicy viewCharges; + + /** + * Get the marketplacePurchases property: The policy that controls whether Azure marketplace purchases are allowed + * for a billing profile. + * + * @return the marketplacePurchases value. + */ + public MarketplacePurchasesPolicy marketplacePurchases() { + return this.marketplacePurchases; + } + + /** + * Set the marketplacePurchases property: The policy that controls whether Azure marketplace purchases are allowed + * for a billing profile. + * + * @param marketplacePurchases the marketplacePurchases value to set. + * @return the PolicyInner object itself. + */ + public PolicyInner withMarketplacePurchases(MarketplacePurchasesPolicy marketplacePurchases) { + this.marketplacePurchases = marketplacePurchases; + return this; + } + + /** + * Get the reservationPurchases property: The policy that controls whether Azure reservation purchases are allowed + * for a billing profile. + * + * @return the reservationPurchases value. + */ + public ReservationPurchasesPolicy reservationPurchases() { + return this.reservationPurchases; + } + + /** + * Set the reservationPurchases property: The policy that controls whether Azure reservation purchases are allowed + * for a billing profile. + * + * @param reservationPurchases the reservationPurchases value to set. + * @return the PolicyInner object itself. + */ + public PolicyInner withReservationPurchases(ReservationPurchasesPolicy reservationPurchases) { + this.reservationPurchases = reservationPurchases; + return this; + } + + /** + * Get the viewCharges property: The policy that controls whether users with Azure RBAC access to a subscription can + * view its charges. + * + * @return the viewCharges value. + */ + public ViewChargesPolicy viewCharges() { + return this.viewCharges; + } + + /** + * Set the viewCharges property: The policy that controls whether users with Azure RBAC access to a subscription can + * view its charges. + * + * @param viewCharges the viewCharges value to set. + * @return the PolicyInner object itself. + */ + public PolicyInner withViewCharges(ViewChargesPolicy viewCharges) { + this.viewCharges = viewCharges; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/ProductInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/ProductInner.java new file mode 100644 index 0000000000000..da4d72edfc27b --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/ProductInner.java @@ -0,0 +1,406 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.models.Amount; +import com.azure.resourcemanager.billing.models.AutoRenew; +import com.azure.resourcemanager.billing.models.BillingFrequency; +import com.azure.resourcemanager.billing.models.ProductStatusType; +import com.azure.resourcemanager.billing.models.Reseller; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A product. */ +@JsonFlatten +@Fluent +public class ProductInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProductInner.class); + + /* + * Indicates whether auto renewal is turned on or off for a product. + */ + @JsonProperty(value = "properties.autoRenew") + private AutoRenew autoRenew; + + /* + * The display name of the product. + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * The date when the product was purchased. + */ + @JsonProperty(value = "properties.purchaseDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime purchaseDate; + + /* + * The ID of the type of product. + */ + @JsonProperty(value = "properties.productTypeId", access = JsonProperty.Access.WRITE_ONLY) + private String productTypeId; + + /* + * The description of the type of product. + */ + @JsonProperty(value = "properties.productType", access = JsonProperty.Access.WRITE_ONLY) + private String productType; + + /* + * The current status of the product. + */ + @JsonProperty(value = "properties.status") + private ProductStatusType status; + + /* + * The date when the product will be renewed or canceled. + */ + @JsonProperty(value = "properties.endDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endDate; + + /* + * The frequency at which the product will be billed. + */ + @JsonProperty(value = "properties.billingFrequency") + private BillingFrequency billingFrequency; + + /* + * The last month charges. + */ + @JsonProperty(value = "properties.lastCharge", access = JsonProperty.Access.WRITE_ONLY) + private Amount lastCharge; + + /* + * The date of the last charge. + */ + @JsonProperty(value = "properties.lastChargeDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastChargeDate; + + /* + * The quantity purchased for the product. + */ + @JsonProperty(value = "properties.quantity", access = JsonProperty.Access.WRITE_ONLY) + private Float quantity; + + /* + * The sku ID of the product. + */ + @JsonProperty(value = "properties.skuId", access = JsonProperty.Access.WRITE_ONLY) + private String skuId; + + /* + * The sku description of the product. + */ + @JsonProperty(value = "properties.skuDescription", access = JsonProperty.Access.WRITE_ONLY) + private String skuDescription; + + /* + * The id of the tenant in which the product is used. + */ + @JsonProperty(value = "properties.tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The availability of the product. + */ + @JsonProperty(value = "properties.availabilityId", access = JsonProperty.Access.WRITE_ONLY) + private String availabilityId; + + /* + * The ID of the invoice section to which the product is billed. + */ + @JsonProperty(value = "properties.invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /* + * The name of the invoice section to which the product is billed. + */ + @JsonProperty(value = "properties.invoiceSectionDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionDisplayName; + + /* + * The ID of the billing profile to which the product is billed. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /* + * The name of the billing profile to which the product is billed. + */ + @JsonProperty(value = "properties.billingProfileDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileDisplayName; + + /* + * The ID of the customer for whom the product was purchased. The field is + * applicable only for Microsoft Partner Agreement billing account. + */ + @JsonProperty(value = "properties.customerId", access = JsonProperty.Access.WRITE_ONLY) + private String customerId; + + /* + * The name of the customer for whom the product was purchased. The field + * is applicable only for Microsoft Partner Agreement billing account. + */ + @JsonProperty(value = "properties.customerDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String customerDisplayName; + + /* + * Reseller for this product. + */ + @JsonProperty(value = "properties.reseller", access = JsonProperty.Access.WRITE_ONLY) + private Reseller reseller; + + /** + * Get the autoRenew property: Indicates whether auto renewal is turned on or off for a product. + * + * @return the autoRenew value. + */ + public AutoRenew autoRenew() { + return this.autoRenew; + } + + /** + * Set the autoRenew property: Indicates whether auto renewal is turned on or off for a product. + * + * @param autoRenew the autoRenew value to set. + * @return the ProductInner object itself. + */ + public ProductInner withAutoRenew(AutoRenew autoRenew) { + this.autoRenew = autoRenew; + return this; + } + + /** + * Get the displayName property: The display name of the product. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the purchaseDate property: The date when the product was purchased. + * + * @return the purchaseDate value. + */ + public OffsetDateTime purchaseDate() { + return this.purchaseDate; + } + + /** + * Get the productTypeId property: The ID of the type of product. + * + * @return the productTypeId value. + */ + public String productTypeId() { + return this.productTypeId; + } + + /** + * Get the productType property: The description of the type of product. + * + * @return the productType value. + */ + public String productType() { + return this.productType; + } + + /** + * Get the status property: The current status of the product. + * + * @return the status value. + */ + public ProductStatusType status() { + return this.status; + } + + /** + * Set the status property: The current status of the product. + * + * @param status the status value to set. + * @return the ProductInner object itself. + */ + public ProductInner withStatus(ProductStatusType status) { + this.status = status; + return this; + } + + /** + * Get the endDate property: The date when the product will be renewed or canceled. + * + * @return the endDate value. + */ + public OffsetDateTime endDate() { + return this.endDate; + } + + /** + * Get the billingFrequency property: The frequency at which the product will be billed. + * + * @return the billingFrequency value. + */ + public BillingFrequency billingFrequency() { + return this.billingFrequency; + } + + /** + * Set the billingFrequency property: The frequency at which the product will be billed. + * + * @param billingFrequency the billingFrequency value to set. + * @return the ProductInner object itself. + */ + public ProductInner withBillingFrequency(BillingFrequency billingFrequency) { + this.billingFrequency = billingFrequency; + return this; + } + + /** + * Get the lastCharge property: The last month charges. + * + * @return the lastCharge value. + */ + public Amount lastCharge() { + return this.lastCharge; + } + + /** + * Get the lastChargeDate property: The date of the last charge. + * + * @return the lastChargeDate value. + */ + public OffsetDateTime lastChargeDate() { + return this.lastChargeDate; + } + + /** + * Get the quantity property: The quantity purchased for the product. + * + * @return the quantity value. + */ + public Float quantity() { + return this.quantity; + } + + /** + * Get the skuId property: The sku ID of the product. + * + * @return the skuId value. + */ + public String skuId() { + return this.skuId; + } + + /** + * Get the skuDescription property: The sku description of the product. + * + * @return the skuDescription value. + */ + public String skuDescription() { + return this.skuDescription; + } + + /** + * Get the tenantId property: The id of the tenant in which the product is used. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the availabilityId property: The availability of the product. + * + * @return the availabilityId value. + */ + public String availabilityId() { + return this.availabilityId; + } + + /** + * Get the invoiceSectionId property: The ID of the invoice section to which the product is billed. + * + * @return the invoiceSectionId value. + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get the invoiceSectionDisplayName property: The name of the invoice section to which the product is billed. + * + * @return the invoiceSectionDisplayName value. + */ + public String invoiceSectionDisplayName() { + return this.invoiceSectionDisplayName; + } + + /** + * Get the billingProfileId property: The ID of the billing profile to which the product is billed. + * + * @return the billingProfileId value. + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the billingProfileDisplayName property: The name of the billing profile to which the product is billed. + * + * @return the billingProfileDisplayName value. + */ + public String billingProfileDisplayName() { + return this.billingProfileDisplayName; + } + + /** + * Get the customerId property: The ID of the customer for whom the product was purchased. The field is applicable + * only for Microsoft Partner Agreement billing account. + * + * @return the customerId value. + */ + public String customerId() { + return this.customerId; + } + + /** + * Get the customerDisplayName property: The name of the customer for whom the product was purchased. The field is + * applicable only for Microsoft Partner Agreement billing account. + * + * @return the customerDisplayName value. + */ + public String customerDisplayName() { + return this.customerDisplayName; + } + + /** + * Get the reseller property: Reseller for this product. + * + * @return the reseller value. + */ + public Reseller reseller() { + return this.reseller; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (lastCharge() != null) { + lastCharge().validate(); + } + if (reseller() != null) { + reseller().validate(); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/ReservationInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/ReservationInner.java new file mode 100644 index 0000000000000..257cb0ba6812a --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/ReservationInner.java @@ -0,0 +1,391 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.models.ReservationPropertyUtilization; +import com.azure.resourcemanager.billing.models.ReservationSkuProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The definition of the reservation. */ +@JsonFlatten +@Fluent +public class ReservationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReservationInner.class); + + /* + * The id of the reservation. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The name of the reservation. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The type of the reservation. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The location of the reservation. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * The sku information associated to this reservation + */ + @JsonProperty(value = "sku") + private ReservationSkuProperty sku; + + /* + * The array of applied scopes of a reservation. Will be null if the + * reservation is in Shared scope + */ + @JsonProperty(value = "properties.appliedScopes") + private List appliedScopes; + + /* + * The applied scope type of the reservation. + */ + @JsonProperty(value = "properties.appliedScopeType", access = JsonProperty.Access.WRITE_ONLY) + private String appliedScopeType; + + /* + * The reserved source type of the reservation, e.g. virtual machine. + */ + @JsonProperty(value = "properties.reservedResourceType", access = JsonProperty.Access.WRITE_ONLY) + private String reservedResourceType; + + /* + * The number of the reservation. + */ + @JsonProperty(value = "properties.quantity", access = JsonProperty.Access.WRITE_ONLY) + private Float quantity; + + /* + * The provisioning state of the reservation, e.g. Succeeded + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The expiry date of the reservation + */ + @JsonProperty(value = "properties.expiryDate", access = JsonProperty.Access.WRITE_ONLY) + private String expiryDate; + + /* + * The provisioning state of the reservation, e.g. Succeeded + */ + @JsonProperty(value = "properties.provisioningSubState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningSubState; + + /* + * The display name of the reservation + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * The provisioning state of the reservation for display, e.g. Succeeded + */ + @JsonProperty(value = "properties.displayProvisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String displayProvisioningState; + + /* + * The renew state of the reservation for display, e.g. On + */ + @JsonProperty(value = "properties.userFriendlyRenewState", access = JsonProperty.Access.WRITE_ONLY) + private String userFriendlyRenewState; + + /* + * The applied scope type of the reservation for display, e.g. Shared + */ + @JsonProperty(value = "properties.userFriendlyAppliedScopeType", access = JsonProperty.Access.WRITE_ONLY) + private String userFriendlyAppliedScopeType; + + /* + * The effective date time of the reservation + */ + @JsonProperty(value = "properties.effectiveDateTime", access = JsonProperty.Access.WRITE_ONLY) + private String effectiveDateTime; + + /* + * The sku description of the reservation + */ + @JsonProperty(value = "properties.skuDescription", access = JsonProperty.Access.WRITE_ONLY) + private String skuDescription; + + /* + * The term of the reservation, e.g. P1Y + */ + @JsonProperty(value = "properties.term", access = JsonProperty.Access.WRITE_ONLY) + private String term; + + /* + * The renew state of the reservation + */ + @JsonProperty(value = "properties.renew", access = JsonProperty.Access.WRITE_ONLY) + private Boolean renew; + + /* + * The renew source of the reservation + */ + @JsonProperty(value = "properties.renewSource", access = JsonProperty.Access.WRITE_ONLY) + private String renewSource; + + /* + * Reservation utilization + */ + @JsonProperty(value = "properties.utilization", access = JsonProperty.Access.WRITE_ONLY) + private ReservationPropertyUtilization utilization; + + /** + * Get the id property: The id of the reservation. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: The name of the reservation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: The type of the reservation. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the location property: The location of the reservation. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the sku property: The sku information associated to this reservation. + * + * @return the sku value. + */ + public ReservationSkuProperty sku() { + return this.sku; + } + + /** + * Set the sku property: The sku information associated to this reservation. + * + * @param sku the sku value to set. + * @return the ReservationInner object itself. + */ + public ReservationInner withSku(ReservationSkuProperty sku) { + this.sku = sku; + return this; + } + + /** + * Get the appliedScopes property: The array of applied scopes of a reservation. Will be null if the reservation is + * in Shared scope. + * + * @return the appliedScopes value. + */ + public List appliedScopes() { + return this.appliedScopes; + } + + /** + * Set the appliedScopes property: The array of applied scopes of a reservation. Will be null if the reservation is + * in Shared scope. + * + * @param appliedScopes the appliedScopes value to set. + * @return the ReservationInner object itself. + */ + public ReservationInner withAppliedScopes(List appliedScopes) { + this.appliedScopes = appliedScopes; + return this; + } + + /** + * Get the appliedScopeType property: The applied scope type of the reservation. + * + * @return the appliedScopeType value. + */ + public String appliedScopeType() { + return this.appliedScopeType; + } + + /** + * Get the reservedResourceType property: The reserved source type of the reservation, e.g. virtual machine. + * + * @return the reservedResourceType value. + */ + public String reservedResourceType() { + return this.reservedResourceType; + } + + /** + * Get the quantity property: The number of the reservation. + * + * @return the quantity value. + */ + public Float quantity() { + return this.quantity; + } + + /** + * Get the provisioningState property: The provisioning state of the reservation, e.g. Succeeded. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the expiryDate property: The expiry date of the reservation. + * + * @return the expiryDate value. + */ + public String expiryDate() { + return this.expiryDate; + } + + /** + * Get the provisioningSubState property: The provisioning state of the reservation, e.g. Succeeded. + * + * @return the provisioningSubState value. + */ + public String provisioningSubState() { + return this.provisioningSubState; + } + + /** + * Get the displayName property: The display name of the reservation. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the displayProvisioningState property: The provisioning state of the reservation for display, e.g. Succeeded. + * + * @return the displayProvisioningState value. + */ + public String displayProvisioningState() { + return this.displayProvisioningState; + } + + /** + * Get the userFriendlyRenewState property: The renew state of the reservation for display, e.g. On. + * + * @return the userFriendlyRenewState value. + */ + public String userFriendlyRenewState() { + return this.userFriendlyRenewState; + } + + /** + * Get the userFriendlyAppliedScopeType property: The applied scope type of the reservation for display, e.g. + * Shared. + * + * @return the userFriendlyAppliedScopeType value. + */ + public String userFriendlyAppliedScopeType() { + return this.userFriendlyAppliedScopeType; + } + + /** + * Get the effectiveDateTime property: The effective date time of the reservation. + * + * @return the effectiveDateTime value. + */ + public String effectiveDateTime() { + return this.effectiveDateTime; + } + + /** + * Get the skuDescription property: The sku description of the reservation. + * + * @return the skuDescription value. + */ + public String skuDescription() { + return this.skuDescription; + } + + /** + * Get the term property: The term of the reservation, e.g. P1Y. + * + * @return the term value. + */ + public String term() { + return this.term; + } + + /** + * Get the renew property: The renew state of the reservation. + * + * @return the renew value. + */ + public Boolean renew() { + return this.renew; + } + + /** + * Get the renewSource property: The renew source of the reservation. + * + * @return the renewSource value. + */ + public String renewSource() { + return this.renewSource; + } + + /** + * Get the utilization property: Reservation utilization. + * + * @return the utilization value. + */ + public ReservationPropertyUtilization utilization() { + return this.utilization; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (utilization() != null) { + utilization().validate(); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/TransactionInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/TransactionInner.java new file mode 100644 index 0000000000000..95d0948f3bf3f --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/TransactionInner.java @@ -0,0 +1,641 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.models.Amount; +import com.azure.resourcemanager.billing.models.ReservationType; +import com.azure.resourcemanager.billing.models.TransactionTypeKind; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A transaction. */ +@JsonFlatten +@Fluent +public class TransactionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TransactionInner.class); + + /* + * The kind of transaction. Options are all or reservation. + */ + @JsonProperty(value = "properties.kind") + private TransactionTypeKind kind; + + /* + * The date of transaction. + */ + @JsonProperty(value = "properties.date", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime date; + + /* + * Invoice on which the transaction was billed or 'pending' if the + * transaction is not billed. + */ + @JsonProperty(value = "properties.invoice", access = JsonProperty.Access.WRITE_ONLY) + private String invoice; + + /* + * The ID of the invoice on which the transaction was billed. This field is + * only applicable for transactions which are billed. + */ + @JsonProperty(value = "properties.invoiceId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceId; + + /* + * The order ID of the reservation. The field is only applicable for + * transaction of kind reservation. + */ + @JsonProperty(value = "properties.orderId", access = JsonProperty.Access.WRITE_ONLY) + private String orderId; + + /* + * The name of the reservation order. The field is only applicable for + * transactions of kind reservation. + */ + @JsonProperty(value = "properties.orderName", access = JsonProperty.Access.WRITE_ONLY) + private String orderName; + + /* + * The family of the product for which the transaction took place. + */ + @JsonProperty(value = "properties.productFamily", access = JsonProperty.Access.WRITE_ONLY) + private String productFamily; + + /* + * The ID of the product type for which the transaction took place. + */ + @JsonProperty(value = "properties.productTypeId", access = JsonProperty.Access.WRITE_ONLY) + private String productTypeId; + + /* + * The type of the product for which the transaction took place. + */ + @JsonProperty(value = "properties.productType", access = JsonProperty.Access.WRITE_ONLY) + private String productType; + + /* + * The description of the product for which the transaction took place. + */ + @JsonProperty(value = "properties.productDescription", access = JsonProperty.Access.WRITE_ONLY) + private String productDescription; + + /* + * The type of transaction. + */ + @JsonProperty(value = "properties.transactionType") + private ReservationType transactionType; + + /* + * The charge associated with the transaction. + */ + @JsonProperty(value = "properties.transactionAmount", access = JsonProperty.Access.WRITE_ONLY) + private Amount transactionAmount; + + /* + * The quantity purchased in the transaction. + */ + @JsonProperty(value = "properties.quantity", access = JsonProperty.Access.WRITE_ONLY) + private Integer quantity; + + /* + * The ID of the invoice section which will be billed for the transaction. + */ + @JsonProperty(value = "properties.invoiceSectionId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionId; + + /* + * The name of the invoice section which will be billed for the + * transaction. + */ + @JsonProperty(value = "properties.invoiceSectionDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceSectionDisplayName; + + /* + * The ID of the billing profile which will be billed for the transaction. + */ + @JsonProperty(value = "properties.billingProfileId", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileId; + + /* + * The name of the billing profile which will be billed for the + * transaction. + */ + @JsonProperty(value = "properties.billingProfileDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String billingProfileDisplayName; + + /* + * The ID of the customer for which the transaction took place. The field + * is applicable only for Microsoft Partner Agreement billing account. + */ + @JsonProperty(value = "properties.customerId", access = JsonProperty.Access.WRITE_ONLY) + private String customerId; + + /* + * The name of the customer for which the transaction took place. The field + * is applicable only for Microsoft Partner Agreement billing account. + */ + @JsonProperty(value = "properties.customerDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String customerDisplayName; + + /* + * The ID of the subscription that was used for the transaction. The field + * is only applicable for transaction of kind reservation. + */ + @JsonProperty(value = "properties.subscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionId; + + /* + * The name of the subscription that was used for the transaction. The + * field is only applicable for transaction of kind reservation. + */ + @JsonProperty(value = "properties.subscriptionName", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionName; + + /* + * The type of azure plan of the subscription that was used for the + * transaction. + */ + @JsonProperty(value = "properties.azurePlan", access = JsonProperty.Access.WRITE_ONLY) + private String azurePlan; + + /* + * The amount of any Azure credits automatically applied to this + * transaction. + */ + @JsonProperty(value = "properties.azureCreditApplied", access = JsonProperty.Access.WRITE_ONLY) + private Amount azureCreditApplied; + + /* + * The ISO 4217 code for the currency in which this transaction is billed. + */ + @JsonProperty(value = "properties.billingCurrency", access = JsonProperty.Access.WRITE_ONLY) + private String billingCurrency; + + /* + * The percentage discount, if any, applied to this transaction. + */ + @JsonProperty(value = "properties.discount", access = JsonProperty.Access.WRITE_ONLY) + private Float discount; + + /* + * The price of the product after applying any discounts. + */ + @JsonProperty(value = "properties.effectivePrice", access = JsonProperty.Access.WRITE_ONLY) + private Amount effectivePrice; + + /* + * The exchange rate used to convert charged amount to billing currency, if + * applicable. + */ + @JsonProperty(value = "properties.exchangeRate", access = JsonProperty.Access.WRITE_ONLY) + private Float exchangeRate; + + /* + * The retail price of the product. + */ + @JsonProperty(value = "properties.marketPrice", access = JsonProperty.Access.WRITE_ONLY) + private Amount marketPrice; + + /* + * The ISO 4217 code for the currency in which the product is priced. + */ + @JsonProperty(value = "properties.pricingCurrency", access = JsonProperty.Access.WRITE_ONLY) + private String pricingCurrency; + + /* + * The date of the purchase of the product, or the start date of the month + * in which usage started. + */ + @JsonProperty(value = "properties.servicePeriodStartDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime servicePeriodStartDate; + + /* + * The end date of the product term, or the end date of the month in which + * usage ended. + */ + @JsonProperty(value = "properties.servicePeriodEndDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime servicePeriodEndDate; + + /* + * The pre-tax charged amount for the transaction. + */ + @JsonProperty(value = "properties.subTotal", access = JsonProperty.Access.WRITE_ONLY) + private Amount subTotal; + + /* + * The tax amount applied to the transaction. + */ + @JsonProperty(value = "properties.tax", access = JsonProperty.Access.WRITE_ONLY) + private Amount tax; + + /* + * The unit of measure used to bill for the product. For example, compute + * services are billed per hour. + */ + @JsonProperty(value = "properties.unitOfMeasure", access = JsonProperty.Access.WRITE_ONLY) + private String unitOfMeasure; + + /* + * The number of units used for a given product. + */ + @JsonProperty(value = "properties.units", access = JsonProperty.Access.WRITE_ONLY) + private Float units; + + /* + * The description for the unit of measure for a given product. + */ + @JsonProperty(value = "properties.unitType", access = JsonProperty.Access.WRITE_ONLY) + private String unitType; + + /** + * Get the kind property: The kind of transaction. Options are all or reservation. + * + * @return the kind value. + */ + public TransactionTypeKind kind() { + return this.kind; + } + + /** + * Set the kind property: The kind of transaction. Options are all or reservation. + * + * @param kind the kind value to set. + * @return the TransactionInner object itself. + */ + public TransactionInner withKind(TransactionTypeKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the date property: The date of transaction. + * + * @return the date value. + */ + public OffsetDateTime date() { + return this.date; + } + + /** + * Get the invoice property: Invoice on which the transaction was billed or 'pending' if the transaction is not + * billed. + * + * @return the invoice value. + */ + public String invoice() { + return this.invoice; + } + + /** + * Get the invoiceId property: The ID of the invoice on which the transaction was billed. This field is only + * applicable for transactions which are billed. + * + * @return the invoiceId value. + */ + public String invoiceId() { + return this.invoiceId; + } + + /** + * Get the orderId property: The order ID of the reservation. The field is only applicable for transaction of kind + * reservation. + * + * @return the orderId value. + */ + public String orderId() { + return this.orderId; + } + + /** + * Get the orderName property: The name of the reservation order. The field is only applicable for transactions of + * kind reservation. + * + * @return the orderName value. + */ + public String orderName() { + return this.orderName; + } + + /** + * Get the productFamily property: The family of the product for which the transaction took place. + * + * @return the productFamily value. + */ + public String productFamily() { + return this.productFamily; + } + + /** + * Get the productTypeId property: The ID of the product type for which the transaction took place. + * + * @return the productTypeId value. + */ + public String productTypeId() { + return this.productTypeId; + } + + /** + * Get the productType property: The type of the product for which the transaction took place. + * + * @return the productType value. + */ + public String productType() { + return this.productType; + } + + /** + * Get the productDescription property: The description of the product for which the transaction took place. + * + * @return the productDescription value. + */ + public String productDescription() { + return this.productDescription; + } + + /** + * Get the transactionType property: The type of transaction. + * + * @return the transactionType value. + */ + public ReservationType transactionType() { + return this.transactionType; + } + + /** + * Set the transactionType property: The type of transaction. + * + * @param transactionType the transactionType value to set. + * @return the TransactionInner object itself. + */ + public TransactionInner withTransactionType(ReservationType transactionType) { + this.transactionType = transactionType; + return this; + } + + /** + * Get the transactionAmount property: The charge associated with the transaction. + * + * @return the transactionAmount value. + */ + public Amount transactionAmount() { + return this.transactionAmount; + } + + /** + * Get the quantity property: The quantity purchased in the transaction. + * + * @return the quantity value. + */ + public Integer quantity() { + return this.quantity; + } + + /** + * Get the invoiceSectionId property: The ID of the invoice section which will be billed for the transaction. + * + * @return the invoiceSectionId value. + */ + public String invoiceSectionId() { + return this.invoiceSectionId; + } + + /** + * Get the invoiceSectionDisplayName property: The name of the invoice section which will be billed for the + * transaction. + * + * @return the invoiceSectionDisplayName value. + */ + public String invoiceSectionDisplayName() { + return this.invoiceSectionDisplayName; + } + + /** + * Get the billingProfileId property: The ID of the billing profile which will be billed for the transaction. + * + * @return the billingProfileId value. + */ + public String billingProfileId() { + return this.billingProfileId; + } + + /** + * Get the billingProfileDisplayName property: The name of the billing profile which will be billed for the + * transaction. + * + * @return the billingProfileDisplayName value. + */ + public String billingProfileDisplayName() { + return this.billingProfileDisplayName; + } + + /** + * Get the customerId property: The ID of the customer for which the transaction took place. The field is applicable + * only for Microsoft Partner Agreement billing account. + * + * @return the customerId value. + */ + public String customerId() { + return this.customerId; + } + + /** + * Get the customerDisplayName property: The name of the customer for which the transaction took place. The field is + * applicable only for Microsoft Partner Agreement billing account. + * + * @return the customerDisplayName value. + */ + public String customerDisplayName() { + return this.customerDisplayName; + } + + /** + * Get the subscriptionId property: The ID of the subscription that was used for the transaction. The field is only + * applicable for transaction of kind reservation. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Get the subscriptionName property: The name of the subscription that was used for the transaction. The field is + * only applicable for transaction of kind reservation. + * + * @return the subscriptionName value. + */ + public String subscriptionName() { + return this.subscriptionName; + } + + /** + * Get the azurePlan property: The type of azure plan of the subscription that was used for the transaction. + * + * @return the azurePlan value. + */ + public String azurePlan() { + return this.azurePlan; + } + + /** + * Get the azureCreditApplied property: The amount of any Azure credits automatically applied to this transaction. + * + * @return the azureCreditApplied value. + */ + public Amount azureCreditApplied() { + return this.azureCreditApplied; + } + + /** + * Get the billingCurrency property: The ISO 4217 code for the currency in which this transaction is billed. + * + * @return the billingCurrency value. + */ + public String billingCurrency() { + return this.billingCurrency; + } + + /** + * Get the discount property: The percentage discount, if any, applied to this transaction. + * + * @return the discount value. + */ + public Float discount() { + return this.discount; + } + + /** + * Get the effectivePrice property: The price of the product after applying any discounts. + * + * @return the effectivePrice value. + */ + public Amount effectivePrice() { + return this.effectivePrice; + } + + /** + * Get the exchangeRate property: The exchange rate used to convert charged amount to billing currency, if + * applicable. + * + * @return the exchangeRate value. + */ + public Float exchangeRate() { + return this.exchangeRate; + } + + /** + * Get the marketPrice property: The retail price of the product. + * + * @return the marketPrice value. + */ + public Amount marketPrice() { + return this.marketPrice; + } + + /** + * Get the pricingCurrency property: The ISO 4217 code for the currency in which the product is priced. + * + * @return the pricingCurrency value. + */ + public String pricingCurrency() { + return this.pricingCurrency; + } + + /** + * Get the servicePeriodStartDate property: The date of the purchase of the product, or the start date of the month + * in which usage started. + * + * @return the servicePeriodStartDate value. + */ + public OffsetDateTime servicePeriodStartDate() { + return this.servicePeriodStartDate; + } + + /** + * Get the servicePeriodEndDate property: The end date of the product term, or the end date of the month in which + * usage ended. + * + * @return the servicePeriodEndDate value. + */ + public OffsetDateTime servicePeriodEndDate() { + return this.servicePeriodEndDate; + } + + /** + * Get the subTotal property: The pre-tax charged amount for the transaction. + * + * @return the subTotal value. + */ + public Amount subTotal() { + return this.subTotal; + } + + /** + * Get the tax property: The tax amount applied to the transaction. + * + * @return the tax value. + */ + public Amount tax() { + return this.tax; + } + + /** + * Get the unitOfMeasure property: The unit of measure used to bill for the product. For example, compute services + * are billed per hour. + * + * @return the unitOfMeasure value. + */ + public String unitOfMeasure() { + return this.unitOfMeasure; + } + + /** + * Get the units property: The number of units used for a given product. + * + * @return the units value. + */ + public Float units() { + return this.units; + } + + /** + * Get the unitType property: The description for the unit of measure for a given product. + * + * @return the unitType value. + */ + public String unitType() { + return this.unitType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (transactionAmount() != null) { + transactionAmount().validate(); + } + if (azureCreditApplied() != null) { + azureCreditApplied().validate(); + } + if (effectivePrice() != null) { + effectivePrice().validate(); + } + if (marketPrice() != null) { + marketPrice().validate(); + } + if (subTotal() != null) { + subTotal().validate(); + } + if (tax() != null) { + tax().validate(); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/ValidateAddressResponseInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/ValidateAddressResponseInner.java new file mode 100644 index 0000000000000..fe5e582d9b456 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/ValidateAddressResponseInner.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.models.AddressDetails; +import com.azure.resourcemanager.billing.models.AddressValidationStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of the address validation. */ +@Fluent +public final class ValidateAddressResponseInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ValidateAddressResponseInner.class); + + /* + * status of the address validation. + */ + @JsonProperty(value = "status") + private AddressValidationStatus status; + + /* + * The list of suggested addresses. + */ + @JsonProperty(value = "suggestedAddresses") + private List suggestedAddresses; + + /* + * Validation error message. + */ + @JsonProperty(value = "validationMessage") + private String validationMessage; + + /** + * Get the status property: status of the address validation. + * + * @return the status value. + */ + public AddressValidationStatus status() { + return this.status; + } + + /** + * Set the status property: status of the address validation. + * + * @param status the status value to set. + * @return the ValidateAddressResponseInner object itself. + */ + public ValidateAddressResponseInner withStatus(AddressValidationStatus status) { + this.status = status; + return this; + } + + /** + * Get the suggestedAddresses property: The list of suggested addresses. + * + * @return the suggestedAddresses value. + */ + public List suggestedAddresses() { + return this.suggestedAddresses; + } + + /** + * Set the suggestedAddresses property: The list of suggested addresses. + * + * @param suggestedAddresses the suggestedAddresses value to set. + * @return the ValidateAddressResponseInner object itself. + */ + public ValidateAddressResponseInner withSuggestedAddresses(List suggestedAddresses) { + this.suggestedAddresses = suggestedAddresses; + return this; + } + + /** + * Get the validationMessage property: Validation error message. + * + * @return the validationMessage value. + */ + public String validationMessage() { + return this.validationMessage; + } + + /** + * Set the validationMessage property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (suggestedAddresses() != null) { + suggestedAddresses().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/ValidateProductTransferEligibilityResultInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/ValidateProductTransferEligibilityResultInner.java new file mode 100644 index 0000000000000..ec3a1192692aa --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/ValidateProductTransferEligibilityResultInner.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.models.ValidateProductTransferEligibilityError; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Result of the product transfer eligibility validation. */ +@Fluent +public final class ValidateProductTransferEligibilityResultInner { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ValidateProductTransferEligibilityResultInner.class); + + /* + * Specifies whether the transfer is eligible or not. + */ + @JsonProperty(value = "isMoveEligible", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isMoveEligible; + + /* + * Validation error details. + */ + @JsonProperty(value = "errorDetails") + private ValidateProductTransferEligibilityError errorDetails; + + /** + * Get the isMoveEligible property: Specifies whether the transfer is eligible or not. + * + * @return the isMoveEligible value. + */ + public Boolean isMoveEligible() { + return this.isMoveEligible; + } + + /** + * Get the errorDetails property: Validation error details. + * + * @return the errorDetails value. + */ + public ValidateProductTransferEligibilityError errorDetails() { + return this.errorDetails; + } + + /** + * Set the errorDetails property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (errorDetails() != null) { + errorDetails().validate(); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/ValidateSubscriptionTransferEligibilityResultInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/ValidateSubscriptionTransferEligibilityResultInner.java new file mode 100644 index 0000000000000..8182afc61f4d1 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/ValidateSubscriptionTransferEligibilityResultInner.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.models.ValidateSubscriptionTransferEligibilityError; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Result of the transfer eligibility validation. */ +@Fluent +public final class ValidateSubscriptionTransferEligibilityResultInner { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ValidateSubscriptionTransferEligibilityResultInner.class); + + /* + * Specifies whether the subscription is eligible to be transferred. + */ + @JsonProperty(value = "isMoveEligible", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isMoveEligible; + + /* + * Validation error details. + */ + @JsonProperty(value = "errorDetails") + private ValidateSubscriptionTransferEligibilityError errorDetails; + + /** + * Get the isMoveEligible property: Specifies whether the subscription is eligible to be transferred. + * + * @return the isMoveEligible value. + */ + public Boolean isMoveEligible() { + return this.isMoveEligible; + } + + /** + * Get the errorDetails property: Validation error details. + * + * @return the errorDetails value. + */ + public ValidateSubscriptionTransferEligibilityError errorDetails() { + return this.errorDetails; + } + + /** + * Set the errorDetails property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (errorDetails() != null) { + errorDetails().validate(); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/package-info.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/package-info.java new file mode 100644 index 0000000000000..21d8afb068dac --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for BillingManagementClient. Billing client provides access to billing + * resources for Azure subscriptions. + */ +package com.azure.resourcemanager.billing.fluent.models; diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/package-info.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/package-info.java new file mode 100644 index 0000000000000..ff6c7f208f6aa --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for BillingManagementClient. Billing client provides access to billing + * resources for Azure subscriptions. + */ +package com.azure.resourcemanager.billing.fluent; diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AddressClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AddressClientImpl.java new file mode 100644 index 0000000000000..1d23f40861990 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AddressClientImpl.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.AddressClient; +import com.azure.resourcemanager.billing.fluent.models.ValidateAddressResponseInner; +import com.azure.resourcemanager.billing.models.AddressDetails; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AddressClient. */ +public final class AddressClientImpl implements AddressClient { + private final ClientLogger logger = new ClientLogger(AddressClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AddressService service; + + /** The service client containing this operation class. */ + private final BillingManagementClientImpl client; + + /** + * Initializes an instance of AddressClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AddressClientImpl(BillingManagementClientImpl client) { + this.service = RestProxy.create(AddressService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BillingManagementClientAddress to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BillingManagementCli") + private interface AddressService { + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.Billing/validateAddress") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> validate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AddressDetails address, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. + * + * @param address Address details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the address validation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> validateWithResponseAsync(AddressDetails address) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (address == null) { + return Mono.error(new IllegalArgumentException("Parameter address is required and cannot be null.")); + } else { + address.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.validate(this.client.getEndpoint(), apiVersion, address, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. + * + * @param address Address details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the address validation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> validateWithResponseAsync( + AddressDetails address, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (address == null) { + return Mono.error(new IllegalArgumentException("Parameter address is required and cannot be null.")); + } else { + address.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.validate(this.client.getEndpoint(), apiVersion, address, accept, context); + } + + /** + * Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. + * + * @param address Address details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the address validation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateAsync(AddressDetails address) { + return validateWithResponseAsync(address) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. + * + * @param address Address details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the address validation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ValidateAddressResponseInner validate(AddressDetails address) { + return validateAsync(address).block(); + } + + /** + * Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. + * + * @param address Address details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the address validation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response validateWithResponse(AddressDetails address, Context context) { + return validateWithResponseAsync(address, context).block(); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AddressImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AddressImpl.java new file mode 100644 index 0000000000000..58f50db82564c --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AddressImpl.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.AddressClient; +import com.azure.resourcemanager.billing.fluent.models.ValidateAddressResponseInner; +import com.azure.resourcemanager.billing.models.Address; +import com.azure.resourcemanager.billing.models.AddressDetails; +import com.azure.resourcemanager.billing.models.ValidateAddressResponse; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AddressImpl implements Address { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AddressImpl.class); + + private final AddressClient innerClient; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + public AddressImpl(AddressClient innerClient, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ValidateAddressResponse validate(AddressDetails address) { + ValidateAddressResponseInner inner = this.serviceClient().validate(address); + if (inner != null) { + return new ValidateAddressResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response validateWithResponse(AddressDetails address, Context context) { + Response inner = this.serviceClient().validateWithResponse(address, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ValidateAddressResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private AddressClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AgreementImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AgreementImpl.java new file mode 100644 index 0000000000000..e0fd035f10861 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AgreementImpl.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.AgreementInner; +import com.azure.resourcemanager.billing.models.AcceptanceMode; +import com.azure.resourcemanager.billing.models.Agreement; +import com.azure.resourcemanager.billing.models.Category; +import com.azure.resourcemanager.billing.models.Participants; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class AgreementImpl implements Agreement { + private AgreementInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + AgreementImpl(AgreementInner innerObject, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String agreementLink() { + return this.innerModel().agreementLink(); + } + + public Category category() { + return this.innerModel().category(); + } + + public AcceptanceMode acceptanceMode() { + return this.innerModel().acceptanceMode(); + } + + public OffsetDateTime effectiveDate() { + return this.innerModel().effectiveDate(); + } + + public OffsetDateTime expirationDate() { + return this.innerModel().expirationDate(); + } + + public List participants() { + List inner = this.innerModel().participants(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String status() { + return this.innerModel().status(); + } + + public AgreementInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AgreementsClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AgreementsClientImpl.java new file mode 100644 index 0000000000000..3b85f5aa2e147 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AgreementsClientImpl.java @@ -0,0 +1,499 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.AgreementsClient; +import com.azure.resourcemanager.billing.fluent.models.AgreementInner; +import com.azure.resourcemanager.billing.models.AgreementListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AgreementsClient. */ +public final class AgreementsClientImpl implements AgreementsClient { + private final ClientLogger logger = new ClientLogger(AgreementsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AgreementsService service; + + /** The service client containing this operation class. */ + private final BillingManagementClientImpl client; + + /** + * Initializes an instance of AgreementsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AgreementsClientImpl(BillingManagementClientImpl client) { + this.service = + RestProxy.create(AgreementsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BillingManagementClientAgreements to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BillingManagementCli") + private interface AgreementsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingAccount( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @QueryParam("$expand") String expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements/{agreementName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("agreementName") String agreementName, + @QueryParam("$expand") String expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingAccountNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the participants. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing agreements. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountSinglePageAsync( + String billingAccountName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBillingAccount( + this.client.getEndpoint(), apiVersion, billingAccountName, expand, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the participants. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing agreements. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountSinglePageAsync( + String billingAccountName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingAccount(this.client.getEndpoint(), apiVersion, billingAccountName, expand, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the participants. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing agreements. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync(String billingAccountName, String expand) { + return new PagedFlux<>( + () -> listByBillingAccountSinglePageAsync(billingAccountName, expand), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing agreements. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync(String billingAccountName) { + final String expand = null; + return new PagedFlux<>( + () -> listByBillingAccountSinglePageAsync(billingAccountName, expand), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the participants. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing agreements. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync( + String billingAccountName, String expand, Context context) { + return new PagedFlux<>( + () -> listByBillingAccountSinglePageAsync(billingAccountName, expand, context), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing agreements. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingAccount(String billingAccountName) { + final String expand = null; + return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, expand)); + } + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the participants. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing agreements. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingAccount( + String billingAccountName, String expand, Context context) { + return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, expand, context)); + } + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @param expand May be used to expand the participants. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an agreement by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String billingAccountName, String agreementName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (agreementName == null) { + return Mono.error(new IllegalArgumentException("Parameter agreementName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + agreementName, + expand, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @param expand May be used to expand the participants. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an agreement by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String billingAccountName, String agreementName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (agreementName == null) { + return Mono.error(new IllegalArgumentException("Parameter agreementName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get(this.client.getEndpoint(), apiVersion, billingAccountName, agreementName, expand, accept, context); + } + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @param expand May be used to expand the participants. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an agreement by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String billingAccountName, String agreementName, String expand) { + return getWithResponseAsync(billingAccountName, agreementName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an agreement by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String billingAccountName, String agreementName) { + final String expand = null; + return getWithResponseAsync(billingAccountName, agreementName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an agreement by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AgreementInner get(String billingAccountName, String agreementName) { + final String expand = null; + return getAsync(billingAccountName, agreementName, expand).block(); + } + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @param expand May be used to expand the participants. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an agreement by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String billingAccountName, String agreementName, String expand, Context context) { + return getWithResponseAsync(billingAccountName, agreementName, expand, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing agreements. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByBillingAccountNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing agreements. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingAccountNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AgreementsImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AgreementsImpl.java new file mode 100644 index 0000000000000..78fc6f2c2d333 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AgreementsImpl.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.AgreementsClient; +import com.azure.resourcemanager.billing.fluent.models.AgreementInner; +import com.azure.resourcemanager.billing.models.Agreement; +import com.azure.resourcemanager.billing.models.Agreements; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AgreementsImpl implements Agreements { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AgreementsImpl.class); + + private final AgreementsClient innerClient; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + public AgreementsImpl( + AgreementsClient innerClient, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByBillingAccount(String billingAccountName) { + PagedIterable inner = this.serviceClient().listByBillingAccount(billingAccountName); + return Utils.mapPage(inner, inner1 -> new AgreementImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingAccount(String billingAccountName, String expand, Context context) { + PagedIterable inner = + this.serviceClient().listByBillingAccount(billingAccountName, expand, context); + return Utils.mapPage(inner, inner1 -> new AgreementImpl(inner1, this.manager())); + } + + public Agreement get(String billingAccountName, String agreementName) { + AgreementInner inner = this.serviceClient().get(billingAccountName, agreementName); + if (inner != null) { + return new AgreementImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String billingAccountName, String agreementName, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(billingAccountName, agreementName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AgreementImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private AgreementsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AvailableBalanceImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AvailableBalanceImpl.java new file mode 100644 index 0000000000000..bc5cb89696126 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AvailableBalanceImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.AvailableBalanceInner; +import com.azure.resourcemanager.billing.models.Amount; +import com.azure.resourcemanager.billing.models.AvailableBalance; + +public final class AvailableBalanceImpl implements AvailableBalance { + private AvailableBalanceInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + AvailableBalanceImpl( + AvailableBalanceInner innerObject, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Amount amount() { + return this.innerModel().amount(); + } + + public AvailableBalanceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AvailableBalancesClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AvailableBalancesClientImpl.java new file mode 100644 index 0000000000000..a0f1bf1d0238c --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AvailableBalancesClientImpl.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.AvailableBalancesClient; +import com.azure.resourcemanager.billing.fluent.models.AvailableBalanceInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AvailableBalancesClient. */ +public final class AvailableBalancesClientImpl implements AvailableBalancesClient { + private final ClientLogger logger = new ClientLogger(AvailableBalancesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AvailableBalancesService service; + + /** The service client containing this operation class. */ + private final BillingManagementClientImpl client; + + /** + * Initializes an instance of AvailableBalancesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AvailableBalancesClientImpl(BillingManagementClientImpl client) { + this.service = + RestProxy.create(AvailableBalancesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BillingManagementClientAvailableBalances to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BillingManagementCli") + private interface AvailableBalancesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/availableBalance/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * The available credit balance for a billing profile. This is the balance that can be used for pay now to settle + * due or past due invoices. The operation is supported only for billing accounts with agreement type Microsoft + * Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the latest Azure credit balance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String billingAccountName, String billingProfileName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + billingAccountName, + billingProfileName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The available credit balance for a billing profile. This is the balance that can be used for pay now to settle + * due or past due invoices. The operation is supported only for billing accounts with agreement type Microsoft + * Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the latest Azure credit balance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String billingAccountName, String billingProfileName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get(this.client.getEndpoint(), billingAccountName, billingProfileName, apiVersion, accept, context); + } + + /** + * The available credit balance for a billing profile. This is the balance that can be used for pay now to settle + * due or past due invoices. The operation is supported only for billing accounts with agreement type Microsoft + * Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the latest Azure credit balance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String billingAccountName, String billingProfileName) { + return getWithResponseAsync(billingAccountName, billingProfileName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The available credit balance for a billing profile. This is the balance that can be used for pay now to settle + * due or past due invoices. The operation is supported only for billing accounts with agreement type Microsoft + * Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the latest Azure credit balance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AvailableBalanceInner get(String billingAccountName, String billingProfileName) { + return getAsync(billingAccountName, billingProfileName).block(); + } + + /** + * The available credit balance for a billing profile. This is the balance that can be used for pay now to settle + * due or past due invoices. The operation is supported only for billing accounts with agreement type Microsoft + * Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the latest Azure credit balance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String billingAccountName, String billingProfileName, Context context) { + return getWithResponseAsync(billingAccountName, billingProfileName, context).block(); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AvailableBalancesImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AvailableBalancesImpl.java new file mode 100644 index 0000000000000..5bf92689d07a7 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AvailableBalancesImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.AvailableBalancesClient; +import com.azure.resourcemanager.billing.fluent.models.AvailableBalanceInner; +import com.azure.resourcemanager.billing.models.AvailableBalance; +import com.azure.resourcemanager.billing.models.AvailableBalances; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AvailableBalancesImpl implements AvailableBalances { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AvailableBalancesImpl.class); + + private final AvailableBalancesClient innerClient; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + public AvailableBalancesImpl( + AvailableBalancesClient innerClient, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public AvailableBalance get(String billingAccountName, String billingProfileName) { + AvailableBalanceInner inner = this.serviceClient().get(billingAccountName, billingProfileName); + if (inner != null) { + return new AvailableBalanceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String billingAccountName, String billingProfileName, Context context) { + Response inner = + this.serviceClient().getWithResponse(billingAccountName, billingProfileName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AvailableBalanceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private AvailableBalancesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingAccountImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingAccountImpl.java new file mode 100644 index 0000000000000..b9580007446b0 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingAccountImpl.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.BillingAccountInner; +import com.azure.resourcemanager.billing.models.AccountStatus; +import com.azure.resourcemanager.billing.models.AccountType; +import com.azure.resourcemanager.billing.models.AddressDetails; +import com.azure.resourcemanager.billing.models.AgreementType; +import com.azure.resourcemanager.billing.models.BillingAccount; +import com.azure.resourcemanager.billing.models.BillingProfilesOnExpand; +import com.azure.resourcemanager.billing.models.Department; +import com.azure.resourcemanager.billing.models.Enrollment; +import com.azure.resourcemanager.billing.models.EnrollmentAccount; +import java.util.Collections; +import java.util.List; + +public final class BillingAccountImpl implements BillingAccount { + private BillingAccountInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + BillingAccountImpl( + BillingAccountInner innerObject, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public AddressDetails soldTo() { + return this.innerModel().soldTo(); + } + + public AgreementType agreementType() { + return this.innerModel().agreementType(); + } + + public AccountType accountType() { + return this.innerModel().accountType(); + } + + public AccountStatus accountStatus() { + return this.innerModel().accountStatus(); + } + + public BillingProfilesOnExpand billingProfiles() { + return this.innerModel().billingProfiles(); + } + + public Enrollment enrollmentDetails() { + return this.innerModel().enrollmentDetails(); + } + + public List departments() { + List inner = this.innerModel().departments(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List enrollmentAccounts() { + List inner = this.innerModel().enrollmentAccounts(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean hasReadAccess() { + return this.innerModel().hasReadAccess(); + } + + public BillingAccountInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingAccountsClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingAccountsClientImpl.java new file mode 100644 index 0000000000000..507bb003dc102 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingAccountsClientImpl.java @@ -0,0 +1,949 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.billing.fluent.BillingAccountsClient; +import com.azure.resourcemanager.billing.fluent.models.BillingAccountInner; +import com.azure.resourcemanager.billing.fluent.models.InvoiceSectionWithCreateSubPermissionInner; +import com.azure.resourcemanager.billing.models.BillingAccountListResult; +import com.azure.resourcemanager.billing.models.BillingAccountUpdateRequest; +import com.azure.resourcemanager.billing.models.InvoiceSectionListWithCreateSubPermissionResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in BillingAccountsClient. */ +public final class BillingAccountsClientImpl implements BillingAccountsClient { + private final ClientLogger logger = new ClientLogger(BillingAccountsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final BillingAccountsService service; + + /** The service client containing this operation class. */ + private final BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingAccountsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BillingAccountsClientImpl(BillingManagementClientImpl client) { + this.service = + RestProxy.create(BillingAccountsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BillingManagementClientBillingAccounts to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BillingManagementCli") + private interface BillingAccountsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/billingAccounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @QueryParam("$expand") String expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @QueryParam("$expand") String expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @BodyParam("application/json") BillingAccountUpdateRequest parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}" + + "/listInvoiceSectionsWithCreateSubscriptionPermission") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> + listInvoiceSectionsByCreateSubscriptionPermission( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> + listInvoiceSectionsByCreateSubscriptionPermissionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the billing accounts that a user has access to. + * + * @param expand May be used to expand the soldTo, invoice sections and billing profiles. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing accounts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, expand, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the billing accounts that a user has access to. + * + * @param expand May be used to expand the soldTo, invoice sections and billing profiles. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing accounts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, expand, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the billing accounts that a user has access to. + * + * @param expand May be used to expand the soldTo, invoice sections and billing profiles. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String expand) { + return new PagedFlux<>(() -> listSinglePageAsync(expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the billing accounts that a user has access to. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String expand = null; + return new PagedFlux<>(() -> listSinglePageAsync(expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the billing accounts that a user has access to. + * + * @param expand May be used to expand the soldTo, invoice sections and billing profiles. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String expand, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(expand, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the billing accounts that a user has access to. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String expand = null; + return new PagedIterable<>(listAsync(expand)); + } + + /** + * Lists the billing accounts that a user has access to. + * + * @param expand May be used to expand the soldTo, invoice sections and billing profiles. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String expand, Context context) { + return new PagedIterable<>(listAsync(expand, context)); + } + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the soldTo, invoice sections and billing profiles. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String billingAccountName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.get(this.client.getEndpoint(), apiVersion, billingAccountName, expand, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the soldTo, invoice sections and billing profiles. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String billingAccountName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, billingAccountName, expand, accept, context); + } + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the soldTo, invoice sections and billing profiles. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String billingAccountName, String expand) { + return getWithResponseAsync(billingAccountName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String billingAccountName) { + final String expand = null; + return getWithResponseAsync(billingAccountName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingAccountInner get(String billingAccountName) { + final String expand = null; + return getAsync(billingAccountName, expand).block(); + } + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the soldTo, invoice sections and billing profiles. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String billingAccountName, String expand, Context context) { + return getWithResponseAsync(billingAccountName, expand, context).block(); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String billingAccountName, BillingAccountUpdateRequest parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update(this.client.getEndpoint(), apiVersion, billingAccountName, parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String billingAccountName, BillingAccountUpdateRequest parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), apiVersion, billingAccountName, parameters, accept, context); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BillingAccountInner> beginUpdateAsync( + String billingAccountName, BillingAccountUpdateRequest parameters) { + Mono>> mono = updateWithResponseAsync(billingAccountName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BillingAccountInner.class, + BillingAccountInner.class, + Context.NONE); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BillingAccountInner> beginUpdateAsync( + String billingAccountName, BillingAccountUpdateRequest parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = updateWithResponseAsync(billingAccountName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), BillingAccountInner.class, BillingAccountInner.class, context); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BillingAccountInner> beginUpdate( + String billingAccountName, BillingAccountUpdateRequest parameters) { + return beginUpdateAsync(billingAccountName, parameters).getSyncPoller(); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BillingAccountInner> beginUpdate( + String billingAccountName, BillingAccountUpdateRequest parameters, Context context) { + return beginUpdateAsync(billingAccountName, parameters, context).getSyncPoller(); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String billingAccountName, BillingAccountUpdateRequest parameters) { + return beginUpdateAsync(billingAccountName, parameters).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String billingAccountName, BillingAccountUpdateRequest parameters, Context context) { + return beginUpdateAsync(billingAccountName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingAccountInner update(String billingAccountName, BillingAccountUpdateRequest parameters) { + return updateAsync(billingAccountName, parameters).block(); + } + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingAccountInner update( + String billingAccountName, BillingAccountUpdateRequest parameters, Context context) { + return updateAsync(billingAccountName, parameters, context).block(); + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice section properties with create subscription permission. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listInvoiceSectionsByCreateSubscriptionPermissionSinglePageAsync(String billingAccountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listInvoiceSectionsByCreateSubscriptionPermission( + this.client.getEndpoint(), apiVersion, billingAccountName, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice section properties with create subscription permission. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listInvoiceSectionsByCreateSubscriptionPermissionSinglePageAsync(String billingAccountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listInvoiceSectionsByCreateSubscriptionPermission( + this.client.getEndpoint(), apiVersion, billingAccountName, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice section properties with create subscription permission. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux + listInvoiceSectionsByCreateSubscriptionPermissionAsync(String billingAccountName) { + return new PagedFlux<>( + () -> listInvoiceSectionsByCreateSubscriptionPermissionSinglePageAsync(billingAccountName), + nextLink -> listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePageAsync(nextLink)); + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice section properties with create subscription permission. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux + listInvoiceSectionsByCreateSubscriptionPermissionAsync(String billingAccountName, Context context) { + return new PagedFlux<>( + () -> listInvoiceSectionsByCreateSubscriptionPermissionSinglePageAsync(billingAccountName, context), + nextLink -> listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice section properties with create subscription permission. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listInvoiceSectionsByCreateSubscriptionPermission( + String billingAccountName) { + return new PagedIterable<>(listInvoiceSectionsByCreateSubscriptionPermissionAsync(billingAccountName)); + } + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice section properties with create subscription permission. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listInvoiceSectionsByCreateSubscriptionPermission( + String billingAccountName, Context context) { + return new PagedIterable<>(listInvoiceSectionsByCreateSubscriptionPermissionAsync(billingAccountName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing accounts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing accounts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice section properties with create subscription permission. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listInvoiceSectionsByCreateSubscriptionPermissionNext( + nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice section properties with create subscription permission. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listInvoiceSectionsByCreateSubscriptionPermissionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingAccountsImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingAccountsImpl.java new file mode 100644 index 0000000000000..399440dc5eadd --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingAccountsImpl.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.BillingAccountsClient; +import com.azure.resourcemanager.billing.fluent.models.BillingAccountInner; +import com.azure.resourcemanager.billing.fluent.models.InvoiceSectionWithCreateSubPermissionInner; +import com.azure.resourcemanager.billing.models.BillingAccount; +import com.azure.resourcemanager.billing.models.BillingAccountUpdateRequest; +import com.azure.resourcemanager.billing.models.BillingAccounts; +import com.azure.resourcemanager.billing.models.InvoiceSectionWithCreateSubPermission; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class BillingAccountsImpl implements BillingAccounts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingAccountsImpl.class); + + private final BillingAccountsClient innerClient; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + public BillingAccountsImpl( + BillingAccountsClient innerClient, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new BillingAccountImpl(inner1, this.manager())); + } + + public PagedIterable list(String expand, Context context) { + PagedIterable inner = this.serviceClient().list(expand, context); + return Utils.mapPage(inner, inner1 -> new BillingAccountImpl(inner1, this.manager())); + } + + public BillingAccount get(String billingAccountName) { + BillingAccountInner inner = this.serviceClient().get(billingAccountName); + if (inner != null) { + return new BillingAccountImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String billingAccountName, String expand, Context context) { + Response inner = this.serviceClient().getWithResponse(billingAccountName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BillingAccountImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BillingAccount update(String billingAccountName, BillingAccountUpdateRequest parameters) { + BillingAccountInner inner = this.serviceClient().update(billingAccountName, parameters); + if (inner != null) { + return new BillingAccountImpl(inner, this.manager()); + } else { + return null; + } + } + + public BillingAccount update(String billingAccountName, BillingAccountUpdateRequest parameters, Context context) { + BillingAccountInner inner = this.serviceClient().update(billingAccountName, parameters, context); + if (inner != null) { + return new BillingAccountImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listInvoiceSectionsByCreateSubscriptionPermission( + String billingAccountName) { + PagedIterable inner = + this.serviceClient().listInvoiceSectionsByCreateSubscriptionPermission(billingAccountName); + return Utils.mapPage(inner, inner1 -> new InvoiceSectionWithCreateSubPermissionImpl(inner1, this.manager())); + } + + public PagedIterable listInvoiceSectionsByCreateSubscriptionPermission( + String billingAccountName, Context context) { + PagedIterable inner = + this.serviceClient().listInvoiceSectionsByCreateSubscriptionPermission(billingAccountName, context); + return Utils.mapPage(inner, inner1 -> new InvoiceSectionWithCreateSubPermissionImpl(inner1, this.manager())); + } + + private BillingAccountsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingManagementClientBuilder.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingManagementClientBuilder.java new file mode 100644 index 0000000000000..7beeb4a93f47f --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingManagementClientBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the BillingManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {BillingManagementClientImpl.class}) +public final class BillingManagementClientBuilder { + /* + * The ID that uniquely identifies an Azure subscription. + */ + private String subscriptionId; + + /** + * Sets The ID that uniquely identifies an Azure subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the BillingManagementClientBuilder. + */ + public BillingManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the BillingManagementClientBuilder. + */ + public BillingManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the BillingManagementClientBuilder. + */ + public BillingManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the BillingManagementClientBuilder. + */ + public BillingManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the BillingManagementClientBuilder. + */ + public BillingManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the BillingManagementClientBuilder. + */ + public BillingManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of BillingManagementClientImpl with the provided parameters. + * + * @return an instance of BillingManagementClientImpl. + */ + public BillingManagementClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + BillingManagementClientImpl client = + new BillingManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingManagementClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingManagementClientImpl.java new file mode 100644 index 0000000000000..862b1b9808527 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingManagementClientImpl.java @@ -0,0 +1,560 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.billing.fluent.AddressClient; +import com.azure.resourcemanager.billing.fluent.AgreementsClient; +import com.azure.resourcemanager.billing.fluent.AvailableBalancesClient; +import com.azure.resourcemanager.billing.fluent.BillingAccountsClient; +import com.azure.resourcemanager.billing.fluent.BillingManagementClient; +import com.azure.resourcemanager.billing.fluent.BillingPeriodsClient; +import com.azure.resourcemanager.billing.fluent.BillingPermissionsClient; +import com.azure.resourcemanager.billing.fluent.BillingProfilesClient; +import com.azure.resourcemanager.billing.fluent.BillingPropertiesClient; +import com.azure.resourcemanager.billing.fluent.BillingRoleAssignmentsClient; +import com.azure.resourcemanager.billing.fluent.BillingRoleDefinitionsClient; +import com.azure.resourcemanager.billing.fluent.BillingSubscriptionsClient; +import com.azure.resourcemanager.billing.fluent.CustomersClient; +import com.azure.resourcemanager.billing.fluent.EnrollmentAccountsClient; +import com.azure.resourcemanager.billing.fluent.InstructionsClient; +import com.azure.resourcemanager.billing.fluent.InvoiceSectionsClient; +import com.azure.resourcemanager.billing.fluent.InvoicesClient; +import com.azure.resourcemanager.billing.fluent.OperationsClient; +import com.azure.resourcemanager.billing.fluent.PoliciesClient; +import com.azure.resourcemanager.billing.fluent.ProductsClient; +import com.azure.resourcemanager.billing.fluent.ReservationsClient; +import com.azure.resourcemanager.billing.fluent.TransactionsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the BillingManagementClientImpl type. */ +@ServiceClient(builder = BillingManagementClientBuilder.class) +public final class BillingManagementClientImpl implements BillingManagementClient { + private final ClientLogger logger = new ClientLogger(BillingManagementClientImpl.class); + + /** The ID that uniquely identifies an Azure subscription. */ + private final String subscriptionId; + + /** + * Gets The ID that uniquely identifies an Azure subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The BillingAccountsClient object to access its operations. */ + private final BillingAccountsClient billingAccounts; + + /** + * Gets the BillingAccountsClient object to access its operations. + * + * @return the BillingAccountsClient object. + */ + public BillingAccountsClient getBillingAccounts() { + return this.billingAccounts; + } + + /** The AddressClient object to access its operations. */ + private final AddressClient address; + + /** + * Gets the AddressClient object to access its operations. + * + * @return the AddressClient object. + */ + public AddressClient getAddress() { + return this.address; + } + + /** The AvailableBalancesClient object to access its operations. */ + private final AvailableBalancesClient availableBalances; + + /** + * Gets the AvailableBalancesClient object to access its operations. + * + * @return the AvailableBalancesClient object. + */ + public AvailableBalancesClient getAvailableBalances() { + return this.availableBalances; + } + + /** The InstructionsClient object to access its operations. */ + private final InstructionsClient instructions; + + /** + * Gets the InstructionsClient object to access its operations. + * + * @return the InstructionsClient object. + */ + public InstructionsClient getInstructions() { + return this.instructions; + } + + /** The BillingProfilesClient object to access its operations. */ + private final BillingProfilesClient billingProfiles; + + /** + * Gets the BillingProfilesClient object to access its operations. + * + * @return the BillingProfilesClient object. + */ + public BillingProfilesClient getBillingProfiles() { + return this.billingProfiles; + } + + /** The CustomersClient object to access its operations. */ + private final CustomersClient customers; + + /** + * Gets the CustomersClient object to access its operations. + * + * @return the CustomersClient object. + */ + public CustomersClient getCustomers() { + return this.customers; + } + + /** The InvoiceSectionsClient object to access its operations. */ + private final InvoiceSectionsClient invoiceSections; + + /** + * Gets the InvoiceSectionsClient object to access its operations. + * + * @return the InvoiceSectionsClient object. + */ + public InvoiceSectionsClient getInvoiceSections() { + return this.invoiceSections; + } + + /** The BillingPermissionsClient object to access its operations. */ + private final BillingPermissionsClient billingPermissions; + + /** + * Gets the BillingPermissionsClient object to access its operations. + * + * @return the BillingPermissionsClient object. + */ + public BillingPermissionsClient getBillingPermissions() { + return this.billingPermissions; + } + + /** The BillingSubscriptionsClient object to access its operations. */ + private final BillingSubscriptionsClient billingSubscriptions; + + /** + * Gets the BillingSubscriptionsClient object to access its operations. + * + * @return the BillingSubscriptionsClient object. + */ + public BillingSubscriptionsClient getBillingSubscriptions() { + return this.billingSubscriptions; + } + + /** The ProductsClient object to access its operations. */ + private final ProductsClient products; + + /** + * Gets the ProductsClient object to access its operations. + * + * @return the ProductsClient object. + */ + public ProductsClient getProducts() { + return this.products; + } + + /** The InvoicesClient object to access its operations. */ + private final InvoicesClient invoices; + + /** + * Gets the InvoicesClient object to access its operations. + * + * @return the InvoicesClient object. + */ + public InvoicesClient getInvoices() { + return this.invoices; + } + + /** The TransactionsClient object to access its operations. */ + private final TransactionsClient transactions; + + /** + * Gets the TransactionsClient object to access its operations. + * + * @return the TransactionsClient object. + */ + public TransactionsClient getTransactions() { + return this.transactions; + } + + /** The PoliciesClient object to access its operations. */ + private final PoliciesClient policies; + + /** + * Gets the PoliciesClient object to access its operations. + * + * @return the PoliciesClient object. + */ + public PoliciesClient getPolicies() { + return this.policies; + } + + /** The BillingPropertiesClient object to access its operations. */ + private final BillingPropertiesClient billingProperties; + + /** + * Gets the BillingPropertiesClient object to access its operations. + * + * @return the BillingPropertiesClient object. + */ + public BillingPropertiesClient getBillingProperties() { + return this.billingProperties; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The BillingRoleDefinitionsClient object to access its operations. */ + private final BillingRoleDefinitionsClient billingRoleDefinitions; + + /** + * Gets the BillingRoleDefinitionsClient object to access its operations. + * + * @return the BillingRoleDefinitionsClient object. + */ + public BillingRoleDefinitionsClient getBillingRoleDefinitions() { + return this.billingRoleDefinitions; + } + + /** The BillingRoleAssignmentsClient object to access its operations. */ + private final BillingRoleAssignmentsClient billingRoleAssignments; + + /** + * Gets the BillingRoleAssignmentsClient object to access its operations. + * + * @return the BillingRoleAssignmentsClient object. + */ + public BillingRoleAssignmentsClient getBillingRoleAssignments() { + return this.billingRoleAssignments; + } + + /** The AgreementsClient object to access its operations. */ + private final AgreementsClient agreements; + + /** + * Gets the AgreementsClient object to access its operations. + * + * @return the AgreementsClient object. + */ + public AgreementsClient getAgreements() { + return this.agreements; + } + + /** The ReservationsClient object to access its operations. */ + private final ReservationsClient reservations; + + /** + * Gets the ReservationsClient object to access its operations. + * + * @return the ReservationsClient object. + */ + public ReservationsClient getReservations() { + return this.reservations; + } + + /** The EnrollmentAccountsClient object to access its operations. */ + private final EnrollmentAccountsClient enrollmentAccounts; + + /** + * Gets the EnrollmentAccountsClient object to access its operations. + * + * @return the EnrollmentAccountsClient object. + */ + public EnrollmentAccountsClient getEnrollmentAccounts() { + return this.enrollmentAccounts; + } + + /** The BillingPeriodsClient object to access its operations. */ + private final BillingPeriodsClient billingPeriods; + + /** + * Gets the BillingPeriodsClient object to access its operations. + * + * @return the BillingPeriodsClient object. + */ + public BillingPeriodsClient getBillingPeriods() { + return this.billingPeriods; + } + + /** + * Initializes an instance of BillingManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID that uniquely identifies an Azure subscription. + * @param endpoint server parameter. + */ + BillingManagementClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.billingAccounts = new BillingAccountsClientImpl(this); + this.address = new AddressClientImpl(this); + this.availableBalances = new AvailableBalancesClientImpl(this); + this.instructions = new InstructionsClientImpl(this); + this.billingProfiles = new BillingProfilesClientImpl(this); + this.customers = new CustomersClientImpl(this); + this.invoiceSections = new InvoiceSectionsClientImpl(this); + this.billingPermissions = new BillingPermissionsClientImpl(this); + this.billingSubscriptions = new BillingSubscriptionsClientImpl(this); + this.products = new ProductsClientImpl(this); + this.invoices = new InvoicesClientImpl(this); + this.transactions = new TransactionsClientImpl(this); + this.policies = new PoliciesClientImpl(this); + this.billingProperties = new BillingPropertiesClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.billingRoleDefinitions = new BillingRoleDefinitionsClientImpl(this); + this.billingRoleAssignments = new BillingRoleAssignmentsClientImpl(this); + this.agreements = new AgreementsClientImpl(this); + this.reservations = new ReservationsClientImpl(this); + this.enrollmentAccounts = new EnrollmentAccountsClientImpl(this); + this.billingPeriods = new BillingPeriodsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPeriodImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPeriodImpl.java new file mode 100644 index 0000000000000..73818c947611b --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPeriodImpl.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.BillingPeriodInner; +import com.azure.resourcemanager.billing.models.BillingPeriod; +import java.time.LocalDate; +import java.util.Collections; +import java.util.List; + +public final class BillingPeriodImpl implements BillingPeriod { + private BillingPeriodInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + BillingPeriodImpl(BillingPeriodInner innerObject, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public LocalDate billingPeriodStartDate() { + return this.innerModel().billingPeriodStartDate(); + } + + public LocalDate billingPeriodEndDate() { + return this.innerModel().billingPeriodEndDate(); + } + + public List invoiceIds() { + List inner = this.innerModel().invoiceIds(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public BillingPeriodInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPeriodsClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPeriodsClientImpl.java new file mode 100644 index 0000000000000..41908fdc5d505 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPeriodsClientImpl.java @@ -0,0 +1,525 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.BillingPeriodsClient; +import com.azure.resourcemanager.billing.fluent.models.BillingPeriodInner; +import com.azure.resourcemanager.billing.models.BillingPeriodsListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in BillingPeriodsClient. */ +public final class BillingPeriodsClientImpl implements BillingPeriodsClient { + private final ClientLogger logger = new ClientLogger(BillingPeriodsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final BillingPeriodsService service; + + /** The service client containing this operation class. */ + private final BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingPeriodsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BillingPeriodsClientImpl(BillingManagementClientImpl client) { + this.service = + RestProxy.create(BillingPeriodsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BillingManagementClientBillingPeriods to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BillingManagementCli") + private interface BillingPeriodsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @QueryParam("$skiptoken") String skiptoken, + @QueryParam("$top") Integer top, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingPeriods/{billingPeriodName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("billingPeriodName") String billingPeriodName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for + * Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web + * portal are not supported through this preview API. + * + * @param filter May be used to filter billing periods by billingPeriodEndDate. The filter supports 'eq', 'lt', + * 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @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 top May be used to limit the number of results to the most recent N billing periods. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing billing periods. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, String skiptoken, Integer top) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + apiVersion, + filter, + skiptoken, + top, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for + * Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web + * portal are not supported through this preview API. + * + * @param filter May be used to filter billing periods by billingPeriodEndDate. The filter supports 'eq', 'lt', + * 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @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 top May be used to limit the number of results to the most recent N billing periods. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing billing periods. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String filter, String skiptoken, Integer top, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + apiVersion, + filter, + skiptoken, + top, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for + * Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web + * portal are not supported through this preview API. + * + * @param filter May be used to filter billing periods by billingPeriodEndDate. The filter supports 'eq', 'lt', + * 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @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 top May be used to limit the number of results to the most recent N billing periods. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing billing periods. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, String skiptoken, Integer top) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, skiptoken, top), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for + * Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web + * portal are not supported through this preview API. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing billing periods. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String filter = null; + final String skiptoken = null; + final Integer top = null; + return new PagedFlux<>( + () -> listSinglePageAsync(filter, skiptoken, top), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for + * Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web + * portal are not supported through this preview API. + * + * @param filter May be used to filter billing periods by billingPeriodEndDate. The filter supports 'eq', 'lt', + * 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @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 top May be used to limit the number of results to the most recent N billing periods. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing billing periods. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, String skiptoken, Integer top, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, skiptoken, top, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for + * Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web + * portal are not supported through this preview API. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing billing periods. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String filter = null; + final String skiptoken = null; + final Integer top = null; + return new PagedIterable<>(listAsync(filter, skiptoken, top)); + } + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for + * Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web + * portal are not supported through this preview API. + * + * @param filter May be used to filter billing periods by billingPeriodEndDate. The filter supports 'eq', 'lt', + * 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @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 top May be used to limit the number of results to the most recent N billing periods. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing billing periods. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, String skiptoken, Integer top, Context context) { + return new PagedIterable<>(listAsync(filter, skiptoken, top, context)); + } + + /** + * Gets a named billing period. This is only supported for Azure Web-Direct subscriptions. Other subscription types + * which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @param billingPeriodName The name of a BillingPeriod resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a named billing period. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String billingPeriodName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (billingPeriodName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingPeriodName is required and cannot be null.")); + } + final String apiVersion = "2018-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + apiVersion, + billingPeriodName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a named billing period. This is only supported for Azure Web-Direct subscriptions. Other subscription types + * which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @param billingPeriodName The name of a BillingPeriod resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a named billing period. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String billingPeriodName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (billingPeriodName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingPeriodName is required and cannot be null.")); + } + final String apiVersion = "2018-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + apiVersion, + billingPeriodName, + accept, + context); + } + + /** + * Gets a named billing period. This is only supported for Azure Web-Direct subscriptions. Other subscription types + * which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @param billingPeriodName The name of a BillingPeriod resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a named billing period. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String billingPeriodName) { + return getWithResponseAsync(billingPeriodName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a named billing period. This is only supported for Azure Web-Direct subscriptions. Other subscription types + * which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @param billingPeriodName The name of a BillingPeriod resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a named billing period. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingPeriodInner get(String billingPeriodName) { + return getAsync(billingPeriodName).block(); + } + + /** + * Gets a named billing period. This is only supported for Azure Web-Direct subscriptions. Other subscription types + * which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @param billingPeriodName The name of a BillingPeriod resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a named billing period. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String billingPeriodName, Context context) { + return getWithResponseAsync(billingPeriodName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing billing periods. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing billing periods. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPeriodsImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPeriodsImpl.java new file mode 100644 index 0000000000000..dce7606151b3f --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPeriodsImpl.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.BillingPeriodsClient; +import com.azure.resourcemanager.billing.fluent.models.BillingPeriodInner; +import com.azure.resourcemanager.billing.models.BillingPeriod; +import com.azure.resourcemanager.billing.models.BillingPeriods; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class BillingPeriodsImpl implements BillingPeriods { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingPeriodsImpl.class); + + private final BillingPeriodsClient innerClient; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + public BillingPeriodsImpl( + BillingPeriodsClient innerClient, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new BillingPeriodImpl(inner1, this.manager())); + } + + public PagedIterable list(String filter, String skiptoken, Integer top, Context context) { + PagedIterable inner = this.serviceClient().list(filter, skiptoken, top, context); + return Utils.mapPage(inner, inner1 -> new BillingPeriodImpl(inner1, this.manager())); + } + + public BillingPeriod get(String billingPeriodName) { + BillingPeriodInner inner = this.serviceClient().get(billingPeriodName); + if (inner != null) { + return new BillingPeriodImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String billingPeriodName, Context context) { + Response inner = this.serviceClient().getWithResponse(billingPeriodName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BillingPeriodImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private BillingPeriodsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPermissionsClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPermissionsClientImpl.java new file mode 100644 index 0000000000000..923d31f7d070d --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPermissionsClientImpl.java @@ -0,0 +1,1113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.BillingPermissionsClient; +import com.azure.resourcemanager.billing.fluent.models.BillingPermissionsPropertiesInner; +import com.azure.resourcemanager.billing.models.BillingPermissionsListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in BillingPermissionsClient. */ +public final class BillingPermissionsClientImpl implements BillingPermissionsClient { + private final ClientLogger logger = new ClientLogger(BillingPermissionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final BillingPermissionsService service; + + /** The service client containing this operation class. */ + private final BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingPermissionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BillingPermissionsClientImpl(BillingManagementClientImpl client) { + this.service = + RestProxy.create(BillingPermissionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BillingManagementClientBillingPermissions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BillingManagementCli") + private interface BillingPermissionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}" + + "/billingPermissions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCustomer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("customerName") String customerName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingPermissions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingAccount( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/invoiceSections/{invoiceSectionName}/billingPermissions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInvoiceSections( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("invoiceSectionName") String invoiceSectionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/billingPermissions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingProfile( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCustomerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingAccountNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInvoiceSectionsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingProfileNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the billing permissions the caller has for a customer. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCustomerSinglePageAsync( + String billingAccountName, String customerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (customerName == null) { + return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByCustomer( + this.client.getEndpoint(), apiVersion, billingAccountName, customerName, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the billing permissions the caller has for a customer. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCustomerSinglePageAsync( + String billingAccountName, String customerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (customerName == null) { + return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCustomer(this.client.getEndpoint(), apiVersion, billingAccountName, customerName, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the billing permissions the caller has for a customer. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCustomerAsync( + String billingAccountName, String customerName) { + return new PagedFlux<>( + () -> listByCustomerSinglePageAsync(billingAccountName, customerName), + nextLink -> listByCustomerNextSinglePageAsync(nextLink)); + } + + /** + * Lists the billing permissions the caller has for a customer. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCustomerAsync( + String billingAccountName, String customerName, Context context) { + return new PagedFlux<>( + () -> listByCustomerSinglePageAsync(billingAccountName, customerName, context), + nextLink -> listByCustomerNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the billing permissions the caller has for a customer. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCustomer( + String billingAccountName, String customerName) { + return new PagedIterable<>(listByCustomerAsync(billingAccountName, customerName)); + } + + /** + * Lists the billing permissions the caller has for a customer. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCustomer( + String billingAccountName, String customerName, Context context) { + return new PagedIterable<>(listByCustomerAsync(billingAccountName, customerName, context)); + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountSinglePageAsync( + String billingAccountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBillingAccount( + this.client.getEndpoint(), apiVersion, billingAccountName, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountSinglePageAsync( + String billingAccountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingAccount(this.client.getEndpoint(), apiVersion, billingAccountName, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync(String billingAccountName) { + return new PagedFlux<>( + () -> listByBillingAccountSinglePageAsync(billingAccountName), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync( + String billingAccountName, Context context) { + return new PagedFlux<>( + () -> listByBillingAccountSinglePageAsync(billingAccountName, context), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingAccount(String billingAccountName) { + return new PagedIterable<>(listByBillingAccountAsync(billingAccountName)); + } + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingAccount( + String billingAccountName, Context context) { + return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, context)); + } + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceSectionsSinglePageAsync( + String billingAccountName, String billingProfileName, String invoiceSectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInvoiceSections( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + invoiceSectionName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceSectionsSinglePageAsync( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInvoiceSections( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + invoiceSectionName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInvoiceSectionsAsync( + String billingAccountName, String billingProfileName, String invoiceSectionName) { + return new PagedFlux<>( + () -> listByInvoiceSectionsSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName), + nextLink -> listByInvoiceSectionsNextSinglePageAsync(nextLink)); + } + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInvoiceSectionsAsync( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { + return new PagedFlux<>( + () -> + listByInvoiceSectionsSinglePageAsync( + billingAccountName, billingProfileName, invoiceSectionName, context), + nextLink -> listByInvoiceSectionsNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInvoiceSections( + String billingAccountName, String billingProfileName, String invoiceSectionName) { + return new PagedIterable<>( + listByInvoiceSectionsAsync(billingAccountName, billingProfileName, invoiceSectionName)); + } + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInvoiceSections( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { + return new PagedIterable<>( + listByInvoiceSectionsAsync(billingAccountName, billingProfileName, invoiceSectionName, context)); + } + + /** + * Lists the billing permissions the caller has on a billing profile. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileSinglePageAsync( + String billingAccountName, String billingProfileName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBillingProfile( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the billing permissions the caller has on a billing profile. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileSinglePageAsync( + String billingAccountName, String billingProfileName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingProfile( + this.client.getEndpoint(), apiVersion, billingAccountName, billingProfileName, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the billing permissions the caller has on a billing profile. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountName, String billingProfileName) { + return new PagedFlux<>( + () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); + } + + /** + * Lists the billing permissions the caller has on a billing profile. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountName, String billingProfileName, Context context) { + return new PagedFlux<>( + () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, context), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the billing permissions the caller has on a billing profile. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName) { + return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName)); + } + + /** + * Lists the billing permissions the caller has on a billing profile. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context) { + return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCustomerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByCustomerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCustomerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCustomerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByBillingAccountNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingAccountNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceSectionsNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByInvoiceSectionsNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceSectionsNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInvoiceSectionsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByBillingProfileNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingProfileNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPermissionsImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPermissionsImpl.java new file mode 100644 index 0000000000000..513d3ff4b7fcb --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPermissionsImpl.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.BillingPermissionsClient; +import com.azure.resourcemanager.billing.fluent.models.BillingPermissionsPropertiesInner; +import com.azure.resourcemanager.billing.models.BillingPermissions; +import com.azure.resourcemanager.billing.models.BillingPermissionsProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class BillingPermissionsImpl implements BillingPermissions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingPermissionsImpl.class); + + private final BillingPermissionsClient innerClient; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + public BillingPermissionsImpl( + BillingPermissionsClient innerClient, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByCustomer(String billingAccountName, String customerName) { + PagedIterable inner = + this.serviceClient().listByCustomer(billingAccountName, customerName); + return Utils.mapPage(inner, inner1 -> new BillingPermissionsPropertiesImpl(inner1, this.manager())); + } + + public PagedIterable listByCustomer( + String billingAccountName, String customerName, Context context) { + PagedIterable inner = + this.serviceClient().listByCustomer(billingAccountName, customerName, context); + return Utils.mapPage(inner, inner1 -> new BillingPermissionsPropertiesImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingAccount(String billingAccountName) { + PagedIterable inner = + this.serviceClient().listByBillingAccount(billingAccountName); + return Utils.mapPage(inner, inner1 -> new BillingPermissionsPropertiesImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingAccount( + String billingAccountName, Context context) { + PagedIterable inner = + this.serviceClient().listByBillingAccount(billingAccountName, context); + return Utils.mapPage(inner, inner1 -> new BillingPermissionsPropertiesImpl(inner1, this.manager())); + } + + public PagedIterable listByInvoiceSections( + String billingAccountName, String billingProfileName, String invoiceSectionName) { + PagedIterable inner = + this.serviceClient().listByInvoiceSections(billingAccountName, billingProfileName, invoiceSectionName); + return Utils.mapPage(inner, inner1 -> new BillingPermissionsPropertiesImpl(inner1, this.manager())); + } + + public PagedIterable listByInvoiceSections( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { + PagedIterable inner = + this + .serviceClient() + .listByInvoiceSections(billingAccountName, billingProfileName, invoiceSectionName, context); + return Utils.mapPage(inner, inner1 -> new BillingPermissionsPropertiesImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName) { + PagedIterable inner = + this.serviceClient().listByBillingProfile(billingAccountName, billingProfileName); + return Utils.mapPage(inner, inner1 -> new BillingPermissionsPropertiesImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context) { + PagedIterable inner = + this.serviceClient().listByBillingProfile(billingAccountName, billingProfileName, context); + return Utils.mapPage(inner, inner1 -> new BillingPermissionsPropertiesImpl(inner1, this.manager())); + } + + private BillingPermissionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPermissionsPropertiesImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPermissionsPropertiesImpl.java new file mode 100644 index 0000000000000..3ee1fa7e3ad1e --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPermissionsPropertiesImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.BillingPermissionsPropertiesInner; +import com.azure.resourcemanager.billing.models.BillingPermissionsProperties; +import java.util.Collections; +import java.util.List; + +public final class BillingPermissionsPropertiesImpl implements BillingPermissionsProperties { + private BillingPermissionsPropertiesInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + BillingPermissionsPropertiesImpl( + BillingPermissionsPropertiesInner innerObject, + com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List actions() { + List inner = this.innerModel().actions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List notActions() { + List inner = this.innerModel().notActions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public BillingPermissionsPropertiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingProfileImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingProfileImpl.java new file mode 100644 index 0000000000000..e4d3da65f40d8 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingProfileImpl.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.BillingProfileInner; +import com.azure.resourcemanager.billing.models.AddressDetails; +import com.azure.resourcemanager.billing.models.AzurePlan; +import com.azure.resourcemanager.billing.models.BillingProfile; +import com.azure.resourcemanager.billing.models.BillingProfileStatus; +import com.azure.resourcemanager.billing.models.BillingRelationshipType; +import com.azure.resourcemanager.billing.models.IndirectRelationshipInfo; +import com.azure.resourcemanager.billing.models.InvoiceSectionsOnExpand; +import com.azure.resourcemanager.billing.models.SpendingLimit; +import com.azure.resourcemanager.billing.models.StatusReasonCode; +import com.azure.resourcemanager.billing.models.TargetCloud; +import java.util.Collections; +import java.util.List; + +public final class BillingProfileImpl implements BillingProfile { + private BillingProfileInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + BillingProfileImpl( + BillingProfileInner innerObject, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String poNumber() { + return this.innerModel().poNumber(); + } + + public BillingRelationshipType billingRelationshipType() { + return this.innerModel().billingRelationshipType(); + } + + public AddressDetails billTo() { + return this.innerModel().billTo(); + } + + public IndirectRelationshipInfo indirectRelationshipInfo() { + return this.innerModel().indirectRelationshipInfo(); + } + + public Boolean invoiceEmailOptIn() { + return this.innerModel().invoiceEmailOptIn(); + } + + public Integer invoiceDay() { + return this.innerModel().invoiceDay(); + } + + public String currency() { + return this.innerModel().currency(); + } + + public List enabledAzurePlans() { + List inner = this.innerModel().enabledAzurePlans(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public InvoiceSectionsOnExpand invoiceSections() { + return this.innerModel().invoiceSections(); + } + + public Boolean hasReadAccess() { + return this.innerModel().hasReadAccess(); + } + + public String systemId() { + return this.innerModel().systemId(); + } + + public BillingProfileStatus status() { + return this.innerModel().status(); + } + + public StatusReasonCode statusReasonCode() { + return this.innerModel().statusReasonCode(); + } + + public SpendingLimit spendingLimit() { + return this.innerModel().spendingLimit(); + } + + public List targetClouds() { + List inner = this.innerModel().targetClouds(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public BillingProfileInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingProfilesClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingProfilesClientImpl.java new file mode 100644 index 0000000000000..1b33d409216fc --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingProfilesClientImpl.java @@ -0,0 +1,802 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.billing.fluent.BillingProfilesClient; +import com.azure.resourcemanager.billing.fluent.models.BillingProfileInner; +import com.azure.resourcemanager.billing.models.BillingProfileListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in BillingProfilesClient. */ +public final class BillingProfilesClientImpl implements BillingProfilesClient { + private final ClientLogger logger = new ClientLogger(BillingProfilesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final BillingProfilesService service; + + /** The service client containing this operation class. */ + private final BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingProfilesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BillingProfilesClientImpl(BillingManagementClientImpl client) { + this.service = + RestProxy.create(BillingProfilesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BillingManagementClientBillingProfiles to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BillingManagementCli") + private interface BillingProfilesService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingAccount( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @QueryParam("$expand") String expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @QueryParam("$expand") String expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @BodyParam("application/json") BillingProfileInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingAccountNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with + * agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the invoice sections. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing profiles. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountSinglePageAsync( + String billingAccountName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBillingAccount( + this.client.getEndpoint(), apiVersion, billingAccountName, expand, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with + * agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the invoice sections. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing profiles. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountSinglePageAsync( + String billingAccountName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingAccount(this.client.getEndpoint(), apiVersion, billingAccountName, expand, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with + * agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the invoice sections. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing profiles. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync(String billingAccountName, String expand) { + return new PagedFlux<>( + () -> listByBillingAccountSinglePageAsync(billingAccountName, expand), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with + * agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing profiles. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync(String billingAccountName) { + final String expand = null; + return new PagedFlux<>( + () -> listByBillingAccountSinglePageAsync(billingAccountName, expand), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with + * agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the invoice sections. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing profiles. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync( + String billingAccountName, String expand, Context context) { + return new PagedFlux<>( + () -> listByBillingAccountSinglePageAsync(billingAccountName, expand, context), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with + * agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing profiles. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingAccount(String billingAccountName) { + final String expand = null; + return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, expand)); + } + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with + * agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the invoice sections. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing profiles. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingAccount( + String billingAccountName, String expand, Context context) { + return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, expand, context)); + } + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft + * Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param expand May be used to expand the invoice sections. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String billingAccountName, String billingProfileName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + expand, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft + * Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param expand May be used to expand the invoice sections. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String billingAccountName, String billingProfileName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), apiVersion, billingAccountName, billingProfileName, expand, accept, context); + } + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft + * Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param expand May be used to expand the invoice sections. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String billingAccountName, String billingProfileName, String expand) { + return getWithResponseAsync(billingAccountName, billingProfileName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft + * Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String billingAccountName, String billingProfileName) { + final String expand = null; + return getWithResponseAsync(billingAccountName, billingProfileName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft + * Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingProfileInner get(String billingAccountName, String billingProfileName) { + final String expand = null; + return getAsync(billingAccountName, billingProfileName, expand).block(); + } + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft + * Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param expand May be used to expand the invoice sections. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String billingAccountName, String billingProfileName, String expand, Context context) { + return getWithResponseAsync(billingAccountName, billingProfileName, expand, context).block(); + } + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String billingAccountName, String billingProfileName, BillingProfileInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String billingAccountName, String billingProfileName, BillingProfileInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + parameters, + accept, + context); + } + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BillingProfileInner> beginCreateOrUpdateAsync( + String billingAccountName, String billingProfileName, BillingProfileInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(billingAccountName, billingProfileName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BillingProfileInner.class, + BillingProfileInner.class, + Context.NONE); + } + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BillingProfileInner> beginCreateOrUpdateAsync( + String billingAccountName, String billingProfileName, BillingProfileInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(billingAccountName, billingProfileName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), BillingProfileInner.class, BillingProfileInner.class, context); + } + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BillingProfileInner> beginCreateOrUpdate( + String billingAccountName, String billingProfileName, BillingProfileInner parameters) { + return beginCreateOrUpdateAsync(billingAccountName, billingProfileName, parameters).getSyncPoller(); + } + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BillingProfileInner> beginCreateOrUpdate( + String billingAccountName, String billingProfileName, BillingProfileInner parameters, Context context) { + return beginCreateOrUpdateAsync(billingAccountName, billingProfileName, parameters, context).getSyncPoller(); + } + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String billingAccountName, String billingProfileName, BillingProfileInner parameters) { + return beginCreateOrUpdateAsync(billingAccountName, billingProfileName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String billingAccountName, String billingProfileName, BillingProfileInner parameters, Context context) { + return beginCreateOrUpdateAsync(billingAccountName, billingProfileName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingProfileInner createOrUpdate( + String billingAccountName, String billingProfileName, BillingProfileInner parameters) { + return createOrUpdateAsync(billingAccountName, billingProfileName, parameters).block(); + } + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingProfileInner createOrUpdate( + String billingAccountName, String billingProfileName, BillingProfileInner parameters, Context context) { + return createOrUpdateAsync(billingAccountName, billingProfileName, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing profiles. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByBillingAccountNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing profiles. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingAccountNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingProfilesImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingProfilesImpl.java new file mode 100644 index 0000000000000..dce0bde2fb4cc --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingProfilesImpl.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.BillingProfilesClient; +import com.azure.resourcemanager.billing.fluent.models.BillingProfileInner; +import com.azure.resourcemanager.billing.models.BillingProfile; +import com.azure.resourcemanager.billing.models.BillingProfiles; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class BillingProfilesImpl implements BillingProfiles { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingProfilesImpl.class); + + private final BillingProfilesClient innerClient; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + public BillingProfilesImpl( + BillingProfilesClient innerClient, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByBillingAccount(String billingAccountName) { + PagedIterable inner = this.serviceClient().listByBillingAccount(billingAccountName); + return Utils.mapPage(inner, inner1 -> new BillingProfileImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingAccount( + String billingAccountName, String expand, Context context) { + PagedIterable inner = + this.serviceClient().listByBillingAccount(billingAccountName, expand, context); + return Utils.mapPage(inner, inner1 -> new BillingProfileImpl(inner1, this.manager())); + } + + public BillingProfile get(String billingAccountName, String billingProfileName) { + BillingProfileInner inner = this.serviceClient().get(billingAccountName, billingProfileName); + if (inner != null) { + return new BillingProfileImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String billingAccountName, String billingProfileName, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(billingAccountName, billingProfileName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BillingProfileImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BillingProfile createOrUpdate( + String billingAccountName, String billingProfileName, BillingProfileInner parameters) { + BillingProfileInner inner = + this.serviceClient().createOrUpdate(billingAccountName, billingProfileName, parameters); + if (inner != null) { + return new BillingProfileImpl(inner, this.manager()); + } else { + return null; + } + } + + public BillingProfile createOrUpdate( + String billingAccountName, String billingProfileName, BillingProfileInner parameters, Context context) { + BillingProfileInner inner = + this.serviceClient().createOrUpdate(billingAccountName, billingProfileName, parameters, context); + if (inner != null) { + return new BillingProfileImpl(inner, this.manager()); + } else { + return null; + } + } + + private BillingProfilesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPropertiesClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPropertiesClientImpl.java new file mode 100644 index 0000000000000..ad67ab0e5b5b2 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPropertiesClientImpl.java @@ -0,0 +1,331 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.BillingPropertiesClient; +import com.azure.resourcemanager.billing.fluent.models.BillingPropertyInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in BillingPropertiesClient. */ +public final class BillingPropertiesClientImpl implements BillingPropertiesClient { + private final ClientLogger logger = new ClientLogger(BillingPropertiesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final BillingPropertiesService service; + + /** The service client containing this operation class. */ + private final BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingPropertiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BillingPropertiesClientImpl(BillingManagementClientImpl client) { + this.service = + RestProxy.create(BillingPropertiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BillingManagementClientBillingProperties to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BillingManagementCli") + private interface BillingPropertiesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch("/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BillingPropertyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get the billing properties for a subscription. This operation is not supported for billing accounts with + * agreement type Enterprise Agreement. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the billing properties for a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the billing properties for a subscription. This operation is not supported for billing accounts with + * agreement type Enterprise Agreement. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the billing properties for a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context); + } + + /** + * Get the billing properties for a subscription. This operation is not supported for billing accounts with + * agreement type Enterprise Agreement. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the billing properties for a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync() { + return getWithResponseAsync() + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the billing properties for a subscription. This operation is not supported for billing accounts with + * agreement type Enterprise Agreement. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the billing properties for a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingPropertyInner get() { + return getAsync().block(); + } + + /** + * Get the billing properties for a subscription. This operation is not supported for billing accounts with + * agreement type Enterprise Agreement. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the billing properties for a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(Context context) { + return getWithResponseAsync(context).block(); + } + + /** + * Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported + * only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param parameters Request parameters that are provided to the update billing property operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(BillingPropertyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported + * only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param parameters Request parameters that are provided to the update billing property operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + BillingPropertyInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, parameters, accept, context); + } + + /** + * Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported + * only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param parameters Request parameters that are provided to the update billing property operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(BillingPropertyInner parameters) { + return updateWithResponseAsync(parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported + * only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param parameters Request parameters that are provided to the update billing property operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingPropertyInner update(BillingPropertyInner parameters) { + return updateAsync(parameters).block(); + } + + /** + * Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported + * only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param parameters Request parameters that are provided to the update billing property operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing property. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(BillingPropertyInner parameters, Context context) { + return updateWithResponseAsync(parameters, context).block(); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPropertiesImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPropertiesImpl.java new file mode 100644 index 0000000000000..b60d1b534773b --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPropertiesImpl.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.BillingPropertiesClient; +import com.azure.resourcemanager.billing.fluent.models.BillingPropertyInner; +import com.azure.resourcemanager.billing.models.BillingProperties; +import com.azure.resourcemanager.billing.models.BillingProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class BillingPropertiesImpl implements BillingProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingPropertiesImpl.class); + + private final BillingPropertiesClient innerClient; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + public BillingPropertiesImpl( + BillingPropertiesClient innerClient, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public BillingProperty get() { + BillingPropertyInner inner = this.serviceClient().get(); + if (inner != null) { + return new BillingPropertyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(Context context) { + Response inner = this.serviceClient().getWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BillingPropertyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BillingProperty update(BillingPropertyInner parameters) { + BillingPropertyInner inner = this.serviceClient().update(parameters); + if (inner != null) { + return new BillingPropertyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse(BillingPropertyInner parameters, Context context) { + Response inner = this.serviceClient().updateWithResponse(parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BillingPropertyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private BillingPropertiesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPropertyImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPropertyImpl.java new file mode 100644 index 0000000000000..2b7e9f77c294f --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingPropertyImpl.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.BillingPropertyInner; +import com.azure.resourcemanager.billing.models.BillingProfileSpendingLimit; +import com.azure.resourcemanager.billing.models.BillingProfileStatus; +import com.azure.resourcemanager.billing.models.BillingProfileStatusReasonCode; +import com.azure.resourcemanager.billing.models.BillingProperty; + +public final class BillingPropertyImpl implements BillingProperty { + private BillingPropertyInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + BillingPropertyImpl( + BillingPropertyInner innerObject, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String accountAdminNotificationEmailAddress() { + return this.innerModel().accountAdminNotificationEmailAddress(); + } + + public String billingTenantId() { + return this.innerModel().billingTenantId(); + } + + public String billingAccountId() { + return this.innerModel().billingAccountId(); + } + + public String billingAccountDisplayName() { + return this.innerModel().billingAccountDisplayName(); + } + + public String billingProfileId() { + return this.innerModel().billingProfileId(); + } + + public String billingProfileDisplayName() { + return this.innerModel().billingProfileDisplayName(); + } + + public BillingProfileStatus billingProfileStatus() { + return this.innerModel().billingProfileStatus(); + } + + public BillingProfileStatusReasonCode billingProfileStatusReasonCode() { + return this.innerModel().billingProfileStatusReasonCode(); + } + + public BillingProfileSpendingLimit billingProfileSpendingLimit() { + return this.innerModel().billingProfileSpendingLimit(); + } + + public String costCenter() { + return this.innerModel().costCenter(); + } + + public String invoiceSectionId() { + return this.innerModel().invoiceSectionId(); + } + + public String invoiceSectionDisplayName() { + return this.innerModel().invoiceSectionDisplayName(); + } + + public Boolean isAccountAdmin() { + return this.innerModel().isAccountAdmin(); + } + + public String productId() { + return this.innerModel().productId(); + } + + public String productName() { + return this.innerModel().productName(); + } + + public String skuId() { + return this.innerModel().skuId(); + } + + public String skuDescription() { + return this.innerModel().skuDescription(); + } + + public BillingPropertyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleAssignmentImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleAssignmentImpl.java new file mode 100644 index 0000000000000..ad7683a97484e --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleAssignmentImpl.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.BillingRoleAssignmentInner; +import com.azure.resourcemanager.billing.models.BillingRoleAssignment; + +public final class BillingRoleAssignmentImpl implements BillingRoleAssignment { + private BillingRoleAssignmentInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + BillingRoleAssignmentImpl( + BillingRoleAssignmentInner innerObject, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String createdOn() { + return this.innerModel().createdOn(); + } + + public String createdByPrincipalTenantId() { + return this.innerModel().createdByPrincipalTenantId(); + } + + public String createdByPrincipalId() { + return this.innerModel().createdByPrincipalId(); + } + + public String createdByUserEmailAddress() { + return this.innerModel().createdByUserEmailAddress(); + } + + public String principalId() { + return this.innerModel().principalId(); + } + + public String principalTenantId() { + return this.innerModel().principalTenantId(); + } + + public String roleDefinitionId() { + return this.innerModel().roleDefinitionId(); + } + + public String scope() { + return this.innerModel().scope(); + } + + public String userAuthenticationType() { + return this.innerModel().userAuthenticationType(); + } + + public String userEmailAddress() { + return this.innerModel().userEmailAddress(); + } + + public BillingRoleAssignmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleAssignmentsClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleAssignmentsClientImpl.java new file mode 100644 index 0000000000000..9940fb97457e2 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleAssignmentsClientImpl.java @@ -0,0 +1,1992 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.BillingRoleAssignmentsClient; +import com.azure.resourcemanager.billing.fluent.models.BillingRoleAssignmentInner; +import com.azure.resourcemanager.billing.models.BillingRoleAssignmentListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in BillingRoleAssignmentsClient. */ +public final class BillingRoleAssignmentsClientImpl implements BillingRoleAssignmentsClient { + private final ClientLogger logger = new ClientLogger(BillingRoleAssignmentsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final BillingRoleAssignmentsService service; + + /** The service client containing this operation class. */ + private final BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingRoleAssignmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BillingRoleAssignmentsClientImpl(BillingManagementClientImpl client) { + this.service = + RestProxy + .create(BillingRoleAssignmentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BillingManagementClientBillingRoleAssignments to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BillingManagementCli") + private interface BillingRoleAssignmentsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments" + + "/{billingRoleAssignmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByBillingAccount( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments" + + "/{billingRoleAssignmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> deleteByBillingAccount( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByInvoiceSection( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("invoiceSectionName") String invoiceSectionName, + @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/invoiceSections/{invoiceSectionName}/billingRoleAssignments/{billingRoleAssignmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> deleteByInvoiceSection( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("invoiceSectionName") String invoiceSectionName, + @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/billingRoleAssignments/{billingRoleAssignmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByBillingProfile( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/billingRoleAssignments/{billingRoleAssignmentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> deleteByBillingProfile( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingAccount( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/invoiceSections/{invoiceSectionName}/billingRoleAssignments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInvoiceSection( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("invoiceSectionName") String invoiceSectionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/billingRoleAssignments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingProfile( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingAccountNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInvoiceSectionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingProfileNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByBillingAccountWithResponseAsync( + String billingAccountName, String billingRoleAssignmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByBillingAccount( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingRoleAssignmentName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByBillingAccountWithResponseAsync( + String billingAccountName, String billingRoleAssignmentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByBillingAccount( + this.client.getEndpoint(), apiVersion, billingAccountName, billingRoleAssignmentName, accept, context); + } + + /** + * Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByBillingAccountAsync( + String billingAccountName, String billingRoleAssignmentName) { + return getByBillingAccountWithResponseAsync(billingAccountName, billingRoleAssignmentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingRoleAssignmentInner getByBillingAccount(String billingAccountName, String billingRoleAssignmentName) { + return getByBillingAccountAsync(billingAccountName, billingRoleAssignmentName).block(); + } + + /** + * Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByBillingAccountWithResponse( + String billingAccountName, String billingRoleAssignmentName, Context context) { + return getByBillingAccountWithResponseAsync(billingAccountName, billingRoleAssignmentName, context).block(); + } + + /** + * Deletes a role assignment for the caller on a billing account. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteByBillingAccountWithResponseAsync( + String billingAccountName, String billingRoleAssignmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deleteByBillingAccount( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingRoleAssignmentName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a role assignment for the caller on a billing account. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteByBillingAccountWithResponseAsync( + String billingAccountName, String billingRoleAssignmentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deleteByBillingAccount( + this.client.getEndpoint(), apiVersion, billingAccountName, billingRoleAssignmentName, accept, context); + } + + /** + * Deletes a role assignment for the caller on a billing account. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteByBillingAccountAsync( + String billingAccountName, String billingRoleAssignmentName) { + return deleteByBillingAccountWithResponseAsync(billingAccountName, billingRoleAssignmentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Deletes a role assignment for the caller on a billing account. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingRoleAssignmentInner deleteByBillingAccount( + String billingAccountName, String billingRoleAssignmentName) { + return deleteByBillingAccountAsync(billingAccountName, billingRoleAssignmentName).block(); + } + + /** + * Deletes a role assignment for the caller on a billing account. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteByBillingAccountWithResponse( + String billingAccountName, String billingRoleAssignmentName, Context context) { + return deleteByBillingAccountWithResponseAsync(billingAccountName, billingRoleAssignmentName, context).block(); + } + + /** + * Gets a role assignment for the caller on an invoice section. The operation is supported for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByInvoiceSectionWithResponseAsync( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleAssignmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByInvoiceSection( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + invoiceSectionName, + billingRoleAssignmentName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a role assignment for the caller on an invoice section. The operation is supported for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByInvoiceSectionWithResponseAsync( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleAssignmentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByInvoiceSection( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + invoiceSectionName, + billingRoleAssignmentName, + accept, + context); + } + + /** + * Gets a role assignment for the caller on an invoice section. The operation is supported for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByInvoiceSectionAsync( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleAssignmentName) { + return getByInvoiceSectionWithResponseAsync( + billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a role assignment for the caller on an invoice section. The operation is supported for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingRoleAssignmentInner getByInvoiceSection( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleAssignmentName) { + return getByInvoiceSectionAsync( + billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName) + .block(); + } + + /** + * Gets a role assignment for the caller on an invoice section. The operation is supported for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByInvoiceSectionWithResponse( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleAssignmentName, + Context context) { + return getByInvoiceSectionWithResponseAsync( + billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, context) + .block(); + } + + /** + * Deletes a role assignment for the caller on an invoice section. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteByInvoiceSectionWithResponseAsync( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleAssignmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deleteByInvoiceSection( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + invoiceSectionName, + billingRoleAssignmentName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a role assignment for the caller on an invoice section. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteByInvoiceSectionWithResponseAsync( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleAssignmentName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deleteByInvoiceSection( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + invoiceSectionName, + billingRoleAssignmentName, + accept, + context); + } + + /** + * Deletes a role assignment for the caller on an invoice section. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteByInvoiceSectionAsync( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleAssignmentName) { + return deleteByInvoiceSectionWithResponseAsync( + billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Deletes a role assignment for the caller on an invoice section. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingRoleAssignmentInner deleteByInvoiceSection( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleAssignmentName) { + return deleteByInvoiceSectionAsync( + billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName) + .block(); + } + + /** + * Deletes a role assignment for the caller on an invoice section. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteByInvoiceSectionWithResponse( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleAssignmentName, + Context context) { + return deleteByInvoiceSectionWithResponseAsync( + billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, context) + .block(); + } + + /** + * Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByBillingProfileWithResponseAsync( + String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByBillingProfile( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + billingRoleAssignmentName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByBillingProfileWithResponseAsync( + String billingAccountName, String billingProfileName, String billingRoleAssignmentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByBillingProfile( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + billingRoleAssignmentName, + accept, + context); + } + + /** + * Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByBillingProfileAsync( + String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + return getByBillingProfileWithResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingRoleAssignmentInner getByBillingProfile( + String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + return getByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).block(); + } + + /** + * Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByBillingProfileWithResponse( + String billingAccountName, String billingProfileName, String billingRoleAssignmentName, Context context) { + return getByBillingProfileWithResponseAsync( + billingAccountName, billingProfileName, billingRoleAssignmentName, context) + .block(); + } + + /** + * Deletes a role assignment for the caller on a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteByBillingProfileWithResponseAsync( + String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .deleteByBillingProfile( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + billingRoleAssignmentName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a role assignment for the caller on a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteByBillingProfileWithResponseAsync( + String billingAccountName, String billingProfileName, String billingRoleAssignmentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .deleteByBillingProfile( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + billingRoleAssignmentName, + accept, + context); + } + + /** + * Deletes a role assignment for the caller on a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteByBillingProfileAsync( + String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + return deleteByBillingProfileWithResponseAsync( + billingAccountName, billingProfileName, billingRoleAssignmentName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Deletes a role assignment for the caller on a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingRoleAssignmentInner deleteByBillingProfile( + String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + return deleteByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleAssignmentName).block(); + } + + /** + * Deletes a role assignment for the caller on a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteByBillingProfileWithResponse( + String billingAccountName, String billingProfileName, String billingRoleAssignmentName, Context context) { + return deleteByBillingProfileWithResponseAsync( + billingAccountName, billingProfileName, billingRoleAssignmentName, context) + .block(); + } + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountSinglePageAsync( + String billingAccountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBillingAccount( + this.client.getEndpoint(), apiVersion, billingAccountName, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountSinglePageAsync( + String billingAccountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingAccount(this.client.getEndpoint(), apiVersion, billingAccountName, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync(String billingAccountName) { + return new PagedFlux<>( + () -> listByBillingAccountSinglePageAsync(billingAccountName), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync( + String billingAccountName, Context context) { + return new PagedFlux<>( + () -> listByBillingAccountSinglePageAsync(billingAccountName, context), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingAccount(String billingAccountName) { + return new PagedIterable<>(listByBillingAccountAsync(billingAccountName)); + } + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingAccount(String billingAccountName, Context context) { + return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, context)); + } + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceSectionSinglePageAsync( + String billingAccountName, String billingProfileName, String invoiceSectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInvoiceSection( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + invoiceSectionName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceSectionSinglePageAsync( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInvoiceSection( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + invoiceSectionName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInvoiceSectionAsync( + String billingAccountName, String billingProfileName, String invoiceSectionName) { + return new PagedFlux<>( + () -> listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName), + nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink)); + } + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInvoiceSectionAsync( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { + return new PagedFlux<>( + () -> + listByInvoiceSectionSinglePageAsync( + billingAccountName, billingProfileName, invoiceSectionName, context), + nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName) { + return new PagedIterable<>( + listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName)); + } + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { + return new PagedIterable<>( + listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, context)); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileSinglePageAsync( + String billingAccountName, String billingProfileName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBillingProfile( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileSinglePageAsync( + String billingAccountName, String billingProfileName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingProfile( + this.client.getEndpoint(), apiVersion, billingAccountName, billingProfileName, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountName, String billingProfileName) { + return new PagedFlux<>( + () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountName, String billingProfileName, Context context) { + return new PagedFlux<>( + () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, context), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName) { + return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName)); + } + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context) { + return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByBillingAccountNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingAccountNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceSectionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByInvoiceSectionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceSectionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInvoiceSectionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByBillingProfileNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingProfileNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleAssignmentsImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleAssignmentsImpl.java new file mode 100644 index 0000000000000..58062de8c9a43 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleAssignmentsImpl.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.BillingRoleAssignmentsClient; +import com.azure.resourcemanager.billing.fluent.models.BillingRoleAssignmentInner; +import com.azure.resourcemanager.billing.models.BillingRoleAssignment; +import com.azure.resourcemanager.billing.models.BillingRoleAssignments; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class BillingRoleAssignmentsImpl implements BillingRoleAssignments { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingRoleAssignmentsImpl.class); + + private final BillingRoleAssignmentsClient innerClient; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + public BillingRoleAssignmentsImpl( + BillingRoleAssignmentsClient innerClient, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public BillingRoleAssignment getByBillingAccount(String billingAccountName, String billingRoleAssignmentName) { + BillingRoleAssignmentInner inner = + this.serviceClient().getByBillingAccount(billingAccountName, billingRoleAssignmentName); + if (inner != null) { + return new BillingRoleAssignmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByBillingAccountWithResponse( + String billingAccountName, String billingRoleAssignmentName, Context context) { + Response inner = + this + .serviceClient() + .getByBillingAccountWithResponse(billingAccountName, billingRoleAssignmentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BillingRoleAssignmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BillingRoleAssignment deleteByBillingAccount(String billingAccountName, String billingRoleAssignmentName) { + BillingRoleAssignmentInner inner = + this.serviceClient().deleteByBillingAccount(billingAccountName, billingRoleAssignmentName); + if (inner != null) { + return new BillingRoleAssignmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByBillingAccountWithResponse( + String billingAccountName, String billingRoleAssignmentName, Context context) { + Response inner = + this + .serviceClient() + .deleteByBillingAccountWithResponse(billingAccountName, billingRoleAssignmentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BillingRoleAssignmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BillingRoleAssignment getByInvoiceSection( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleAssignmentName) { + BillingRoleAssignmentInner inner = + this + .serviceClient() + .getByInvoiceSection( + billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName); + if (inner != null) { + return new BillingRoleAssignmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByInvoiceSectionWithResponse( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleAssignmentName, + Context context) { + Response inner = + this + .serviceClient() + .getByInvoiceSectionWithResponse( + billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BillingRoleAssignmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BillingRoleAssignment deleteByInvoiceSection( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleAssignmentName) { + BillingRoleAssignmentInner inner = + this + .serviceClient() + .deleteByInvoiceSection( + billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName); + if (inner != null) { + return new BillingRoleAssignmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByInvoiceSectionWithResponse( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleAssignmentName, + Context context) { + Response inner = + this + .serviceClient() + .deleteByInvoiceSectionWithResponse( + billingAccountName, billingProfileName, invoiceSectionName, billingRoleAssignmentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BillingRoleAssignmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BillingRoleAssignment getByBillingProfile( + String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + BillingRoleAssignmentInner inner = + this.serviceClient().getByBillingProfile(billingAccountName, billingProfileName, billingRoleAssignmentName); + if (inner != null) { + return new BillingRoleAssignmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByBillingProfileWithResponse( + String billingAccountName, String billingProfileName, String billingRoleAssignmentName, Context context) { + Response inner = + this + .serviceClient() + .getByBillingProfileWithResponse( + billingAccountName, billingProfileName, billingRoleAssignmentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BillingRoleAssignmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BillingRoleAssignment deleteByBillingProfile( + String billingAccountName, String billingProfileName, String billingRoleAssignmentName) { + BillingRoleAssignmentInner inner = + this + .serviceClient() + .deleteByBillingProfile(billingAccountName, billingProfileName, billingRoleAssignmentName); + if (inner != null) { + return new BillingRoleAssignmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByBillingProfileWithResponse( + String billingAccountName, String billingProfileName, String billingRoleAssignmentName, Context context) { + Response inner = + this + .serviceClient() + .deleteByBillingProfileWithResponse( + billingAccountName, billingProfileName, billingRoleAssignmentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BillingRoleAssignmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByBillingAccount(String billingAccountName) { + PagedIterable inner = this.serviceClient().listByBillingAccount(billingAccountName); + return Utils.mapPage(inner, inner1 -> new BillingRoleAssignmentImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingAccount(String billingAccountName, Context context) { + PagedIterable inner = + this.serviceClient().listByBillingAccount(billingAccountName, context); + return Utils.mapPage(inner, inner1 -> new BillingRoleAssignmentImpl(inner1, this.manager())); + } + + public PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName) { + PagedIterable inner = + this.serviceClient().listByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName); + return Utils.mapPage(inner, inner1 -> new BillingRoleAssignmentImpl(inner1, this.manager())); + } + + public PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { + PagedIterable inner = + this + .serviceClient() + .listByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, context); + return Utils.mapPage(inner, inner1 -> new BillingRoleAssignmentImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName) { + PagedIterable inner = + this.serviceClient().listByBillingProfile(billingAccountName, billingProfileName); + return Utils.mapPage(inner, inner1 -> new BillingRoleAssignmentImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context) { + PagedIterable inner = + this.serviceClient().listByBillingProfile(billingAccountName, billingProfileName, context); + return Utils.mapPage(inner, inner1 -> new BillingRoleAssignmentImpl(inner1, this.manager())); + } + + private BillingRoleAssignmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleDefinitionImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleDefinitionImpl.java new file mode 100644 index 0000000000000..76faed4c2ee18 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleDefinitionImpl.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.BillingPermissionsPropertiesInner; +import com.azure.resourcemanager.billing.fluent.models.BillingRoleDefinitionInner; +import com.azure.resourcemanager.billing.models.BillingPermissionsProperties; +import com.azure.resourcemanager.billing.models.BillingRoleDefinition; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class BillingRoleDefinitionImpl implements BillingRoleDefinition { + private BillingRoleDefinitionInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + BillingRoleDefinitionImpl( + BillingRoleDefinitionInner innerObject, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String description() { + return this.innerModel().description(); + } + + public List permissions() { + List inner = this.innerModel().permissions(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new BillingPermissionsPropertiesImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public String roleName() { + return this.innerModel().roleName(); + } + + public BillingRoleDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleDefinitionsClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleDefinitionsClientImpl.java new file mode 100644 index 0000000000000..52d2e1f966c9b --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleDefinitionsClientImpl.java @@ -0,0 +1,1431 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.BillingRoleDefinitionsClient; +import com.azure.resourcemanager.billing.fluent.models.BillingRoleDefinitionInner; +import com.azure.resourcemanager.billing.models.BillingRoleDefinitionListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in BillingRoleDefinitionsClient. */ +public final class BillingRoleDefinitionsClientImpl implements BillingRoleDefinitionsClient { + private final ClientLogger logger = new ClientLogger(BillingRoleDefinitionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final BillingRoleDefinitionsService service; + + /** The service client containing this operation class. */ + private final BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingRoleDefinitionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BillingRoleDefinitionsClientImpl(BillingManagementClientImpl client) { + this.service = + RestProxy + .create(BillingRoleDefinitionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BillingManagementClientBillingRoleDefinitions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BillingManagementCli") + private interface BillingRoleDefinitionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions" + + "/{billingRoleDefinitionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByBillingAccount( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingRoleDefinitionName") String billingRoleDefinitionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/invoiceSections/{invoiceSectionName}/billingRoleDefinitions/{billingRoleDefinitionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByInvoiceSection( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("invoiceSectionName") String invoiceSectionName, + @PathParam("billingRoleDefinitionName") String billingRoleDefinitionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/billingRoleDefinitions/{billingRoleDefinitionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByBillingProfile( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("billingRoleDefinitionName") String billingRoleDefinitionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingAccount( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/invoiceSections/{invoiceSectionName}/billingRoleDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInvoiceSection( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("invoiceSectionName") String invoiceSectionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/billingRoleDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingProfile( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingAccountNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInvoiceSectionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingProfileNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the definition for a role on a billing account. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByBillingAccountWithResponseAsync( + String billingAccountName, String billingRoleDefinitionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingRoleDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter billingRoleDefinitionName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByBillingAccount( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingRoleDefinitionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the definition for a role on a billing account. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByBillingAccountWithResponseAsync( + String billingAccountName, String billingRoleDefinitionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingRoleDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter billingRoleDefinitionName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByBillingAccount( + this.client.getEndpoint(), apiVersion, billingAccountName, billingRoleDefinitionName, accept, context); + } + + /** + * Gets the definition for a role on a billing account. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByBillingAccountAsync( + String billingAccountName, String billingRoleDefinitionName) { + return getByBillingAccountWithResponseAsync(billingAccountName, billingRoleDefinitionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the definition for a role on a billing account. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingRoleDefinitionInner getByBillingAccount(String billingAccountName, String billingRoleDefinitionName) { + return getByBillingAccountAsync(billingAccountName, billingRoleDefinitionName).block(); + } + + /** + * Gets the definition for a role on a billing account. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on a billing account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByBillingAccountWithResponse( + String billingAccountName, String billingRoleDefinitionName, Context context) { + return getByBillingAccountWithResponseAsync(billingAccountName, billingRoleDefinitionName, context).block(); + } + + /** + * Gets the definition for a role on an invoice section. The operation is supported only for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByInvoiceSectionWithResponseAsync( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleDefinitionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + if (billingRoleDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter billingRoleDefinitionName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByInvoiceSection( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + invoiceSectionName, + billingRoleDefinitionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the definition for a role on an invoice section. The operation is supported only for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByInvoiceSectionWithResponseAsync( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleDefinitionName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + if (billingRoleDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter billingRoleDefinitionName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByInvoiceSection( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + invoiceSectionName, + billingRoleDefinitionName, + accept, + context); + } + + /** + * Gets the definition for a role on an invoice section. The operation is supported only for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByInvoiceSectionAsync( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleDefinitionName) { + return getByInvoiceSectionWithResponseAsync( + billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the definition for a role on an invoice section. The operation is supported only for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingRoleDefinitionInner getByInvoiceSection( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleDefinitionName) { + return getByInvoiceSectionAsync( + billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName) + .block(); + } + + /** + * Gets the definition for a role on an invoice section. The operation is supported only for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByInvoiceSectionWithResponse( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleDefinitionName, + Context context) { + return getByInvoiceSectionWithResponseAsync( + billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName, context) + .block(); + } + + /** + * Gets the definition for a role on a billing profile. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByBillingProfileWithResponseAsync( + String billingAccountName, String billingProfileName, String billingRoleDefinitionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (billingRoleDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter billingRoleDefinitionName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByBillingProfile( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + billingRoleDefinitionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the definition for a role on a billing profile. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByBillingProfileWithResponseAsync( + String billingAccountName, String billingProfileName, String billingRoleDefinitionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (billingRoleDefinitionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter billingRoleDefinitionName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByBillingProfile( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + billingRoleDefinitionName, + accept, + context); + } + + /** + * Gets the definition for a role on a billing profile. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByBillingProfileAsync( + String billingAccountName, String billingProfileName, String billingRoleDefinitionName) { + return getByBillingProfileWithResponseAsync(billingAccountName, billingProfileName, billingRoleDefinitionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the definition for a role on a billing profile. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingRoleDefinitionInner getByBillingProfile( + String billingAccountName, String billingProfileName, String billingRoleDefinitionName) { + return getByBillingProfileAsync(billingAccountName, billingProfileName, billingRoleDefinitionName).block(); + } + + /** + * Gets the definition for a role on a billing profile. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on a billing profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByBillingProfileWithResponse( + String billingAccountName, String billingProfileName, String billingRoleDefinitionName, Context context) { + return getByBillingProfileWithResponseAsync( + billingAccountName, billingProfileName, billingRoleDefinitionName, context) + .block(); + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountSinglePageAsync( + String billingAccountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBillingAccount( + this.client.getEndpoint(), apiVersion, billingAccountName, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountSinglePageAsync( + String billingAccountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingAccount(this.client.getEndpoint(), apiVersion, billingAccountName, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync(String billingAccountName) { + return new PagedFlux<>( + () -> listByBillingAccountSinglePageAsync(billingAccountName), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync( + String billingAccountName, Context context) { + return new PagedFlux<>( + () -> listByBillingAccountSinglePageAsync(billingAccountName, context), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingAccount(String billingAccountName) { + return new PagedIterable<>(listByBillingAccountAsync(billingAccountName)); + } + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingAccount(String billingAccountName, Context context) { + return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, context)); + } + + /** + * Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceSectionSinglePageAsync( + String billingAccountName, String billingProfileName, String invoiceSectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInvoiceSection( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + invoiceSectionName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceSectionSinglePageAsync( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInvoiceSection( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + invoiceSectionName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInvoiceSectionAsync( + String billingAccountName, String billingProfileName, String invoiceSectionName) { + return new PagedFlux<>( + () -> listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName), + nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink)); + } + + /** + * Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInvoiceSectionAsync( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { + return new PagedFlux<>( + () -> + listByInvoiceSectionSinglePageAsync( + billingAccountName, billingProfileName, invoiceSectionName, context), + nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName) { + return new PagedIterable<>( + listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName)); + } + + /** + * Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { + return new PagedIterable<>( + listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, context)); + } + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileSinglePageAsync( + String billingAccountName, String billingProfileName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBillingProfile( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileSinglePageAsync( + String billingAccountName, String billingProfileName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingProfile( + this.client.getEndpoint(), apiVersion, billingAccountName, billingProfileName, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountName, String billingProfileName) { + return new PagedFlux<>( + () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); + } + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountName, String billingProfileName, Context context) { + return new PagedFlux<>( + () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, context), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName) { + return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName)); + } + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context) { + return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByBillingAccountNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingAccountNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceSectionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByInvoiceSectionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceSectionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInvoiceSectionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByBillingProfileNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingProfileNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleDefinitionsImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleDefinitionsImpl.java new file mode 100644 index 0000000000000..04e129c7d9b69 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRoleDefinitionsImpl.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.BillingRoleDefinitionsClient; +import com.azure.resourcemanager.billing.fluent.models.BillingRoleDefinitionInner; +import com.azure.resourcemanager.billing.models.BillingRoleDefinition; +import com.azure.resourcemanager.billing.models.BillingRoleDefinitions; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class BillingRoleDefinitionsImpl implements BillingRoleDefinitions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingRoleDefinitionsImpl.class); + + private final BillingRoleDefinitionsClient innerClient; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + public BillingRoleDefinitionsImpl( + BillingRoleDefinitionsClient innerClient, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public BillingRoleDefinition getByBillingAccount(String billingAccountName, String billingRoleDefinitionName) { + BillingRoleDefinitionInner inner = + this.serviceClient().getByBillingAccount(billingAccountName, billingRoleDefinitionName); + if (inner != null) { + return new BillingRoleDefinitionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByBillingAccountWithResponse( + String billingAccountName, String billingRoleDefinitionName, Context context) { + Response inner = + this + .serviceClient() + .getByBillingAccountWithResponse(billingAccountName, billingRoleDefinitionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BillingRoleDefinitionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BillingRoleDefinition getByInvoiceSection( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleDefinitionName) { + BillingRoleDefinitionInner inner = + this + .serviceClient() + .getByInvoiceSection( + billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName); + if (inner != null) { + return new BillingRoleDefinitionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByInvoiceSectionWithResponse( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleDefinitionName, + Context context) { + Response inner = + this + .serviceClient() + .getByInvoiceSectionWithResponse( + billingAccountName, billingProfileName, invoiceSectionName, billingRoleDefinitionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BillingRoleDefinitionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BillingRoleDefinition getByBillingProfile( + String billingAccountName, String billingProfileName, String billingRoleDefinitionName) { + BillingRoleDefinitionInner inner = + this.serviceClient().getByBillingProfile(billingAccountName, billingProfileName, billingRoleDefinitionName); + if (inner != null) { + return new BillingRoleDefinitionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByBillingProfileWithResponse( + String billingAccountName, String billingProfileName, String billingRoleDefinitionName, Context context) { + Response inner = + this + .serviceClient() + .getByBillingProfileWithResponse( + billingAccountName, billingProfileName, billingRoleDefinitionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BillingRoleDefinitionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByBillingAccount(String billingAccountName) { + PagedIterable inner = this.serviceClient().listByBillingAccount(billingAccountName); + return Utils.mapPage(inner, inner1 -> new BillingRoleDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingAccount(String billingAccountName, Context context) { + PagedIterable inner = + this.serviceClient().listByBillingAccount(billingAccountName, context); + return Utils.mapPage(inner, inner1 -> new BillingRoleDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName) { + PagedIterable inner = + this.serviceClient().listByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName); + return Utils.mapPage(inner, inner1 -> new BillingRoleDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { + PagedIterable inner = + this + .serviceClient() + .listByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, context); + return Utils.mapPage(inner, inner1 -> new BillingRoleDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName) { + PagedIterable inner = + this.serviceClient().listByBillingProfile(billingAccountName, billingProfileName); + return Utils.mapPage(inner, inner1 -> new BillingRoleDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context) { + PagedIterable inner = + this.serviceClient().listByBillingProfile(billingAccountName, billingProfileName, context); + return Utils.mapPage(inner, inner1 -> new BillingRoleDefinitionImpl(inner1, this.manager())); + } + + private BillingRoleDefinitionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingSubscriptionImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingSubscriptionImpl.java new file mode 100644 index 0000000000000..1cf7d5e610d10 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingSubscriptionImpl.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.BillingSubscriptionInner; +import com.azure.resourcemanager.billing.models.Amount; +import com.azure.resourcemanager.billing.models.BillingSubscription; +import com.azure.resourcemanager.billing.models.BillingSubscriptionStatusType; +import com.azure.resourcemanager.billing.models.Reseller; +import java.util.UUID; + +public final class BillingSubscriptionImpl implements BillingSubscription { + private BillingSubscriptionInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + BillingSubscriptionImpl( + BillingSubscriptionInner innerObject, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public UUID subscriptionId() { + return this.innerModel().subscriptionId(); + } + + public BillingSubscriptionStatusType subscriptionBillingStatus() { + return this.innerModel().subscriptionBillingStatus(); + } + + public Amount lastMonthCharges() { + return this.innerModel().lastMonthCharges(); + } + + public Amount monthToDateCharges() { + return this.innerModel().monthToDateCharges(); + } + + public String billingProfileId() { + return this.innerModel().billingProfileId(); + } + + public String billingProfileDisplayName() { + return this.innerModel().billingProfileDisplayName(); + } + + public String costCenter() { + return this.innerModel().costCenter(); + } + + public String customerId() { + return this.innerModel().customerId(); + } + + public String customerDisplayName() { + return this.innerModel().customerDisplayName(); + } + + public String invoiceSectionId() { + return this.innerModel().invoiceSectionId(); + } + + public String invoiceSectionDisplayName() { + return this.innerModel().invoiceSectionDisplayName(); + } + + public Reseller reseller() { + return this.innerModel().reseller(); + } + + public String skuId() { + return this.innerModel().skuId(); + } + + public String skuDescription() { + return this.innerModel().skuDescription(); + } + + public BillingSubscriptionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingSubscriptionsClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingSubscriptionsClientImpl.java new file mode 100644 index 0000000000000..995b1b576d0ad --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingSubscriptionsClientImpl.java @@ -0,0 +1,1930 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.billing.fluent.BillingSubscriptionsClient; +import com.azure.resourcemanager.billing.fluent.models.BillingSubscriptionInner; +import com.azure.resourcemanager.billing.fluent.models.ValidateSubscriptionTransferEligibilityResultInner; +import com.azure.resourcemanager.billing.models.BillingSubscriptionsListResult; +import com.azure.resourcemanager.billing.models.TransferBillingSubscriptionRequestProperties; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in BillingSubscriptionsClient. */ +public final class BillingSubscriptionsClientImpl implements BillingSubscriptionsClient { + private final ClientLogger logger = new ClientLogger(BillingSubscriptionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final BillingSubscriptionsService service; + + /** The service client containing this operation class. */ + private final BillingManagementClientImpl client; + + /** + * Initializes an instance of BillingSubscriptionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BillingSubscriptionsClientImpl(BillingManagementClientImpl client) { + this.service = + RestProxy + .create(BillingSubscriptionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BillingManagementClientBillingSubscriptions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BillingManagementCli") + private interface BillingSubscriptionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}" + + "/billingSubscriptions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCustomer( + @HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("customerName") String customerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingAccount( + @HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/billingSubscriptions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingProfile( + @HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/invoiceSections/{invoiceSectionName}/billingSubscriptions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInvoiceSection( + @HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("invoiceSectionName") String invoiceSectionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BillingSubscriptionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}" + + "/move") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> move( + @HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") TransferBillingSubscriptionRequestProperties parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{subscriptionId}" + + "/validateMoveEligibility") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> validateMove( + @HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") TransferBillingSubscriptionRequestProperties parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCustomerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingAccountNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingProfileNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInvoiceSectionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCustomerSinglePageAsync( + String billingAccountName, String customerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (customerName == null) { + return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByCustomer( + this.client.getEndpoint(), billingAccountName, customerName, apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCustomerSinglePageAsync( + String billingAccountName, String customerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (customerName == null) { + return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCustomer(this.client.getEndpoint(), billingAccountName, customerName, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCustomerAsync(String billingAccountName, String customerName) { + return new PagedFlux<>( + () -> listByCustomerSinglePageAsync(billingAccountName, customerName), + nextLink -> listByCustomerNextSinglePageAsync(nextLink)); + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCustomerAsync( + String billingAccountName, String customerName, Context context) { + return new PagedFlux<>( + () -> listByCustomerSinglePageAsync(billingAccountName, customerName, context), + nextLink -> listByCustomerNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCustomer(String billingAccountName, String customerName) { + return new PagedIterable<>(listByCustomerAsync(billingAccountName, customerName)); + } + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCustomer( + String billingAccountName, String customerName, Context context) { + return new PagedIterable<>(listByCustomerAsync(billingAccountName, customerName, context)); + } + + /** + * Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement + * type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountSinglePageAsync( + String billingAccountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBillingAccount( + this.client.getEndpoint(), billingAccountName, apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement + * type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountSinglePageAsync( + String billingAccountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingAccount(this.client.getEndpoint(), billingAccountName, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement + * type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync(String billingAccountName) { + return new PagedFlux<>( + () -> listByBillingAccountSinglePageAsync(billingAccountName), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement + * type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync(String billingAccountName, Context context) { + return new PagedFlux<>( + () -> listByBillingAccountSinglePageAsync(billingAccountName, context), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement + * type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingAccount(String billingAccountName) { + return new PagedIterable<>(listByBillingAccountAsync(billingAccountName)); + } + + /** + * Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement + * type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingAccount(String billingAccountName, Context context) { + return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, context)); + } + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileSinglePageAsync( + String billingAccountName, String billingProfileName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBillingProfile( + this.client.getEndpoint(), + billingAccountName, + billingProfileName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileSinglePageAsync( + String billingAccountName, String billingProfileName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingProfile( + this.client.getEndpoint(), billingAccountName, billingProfileName, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountName, String billingProfileName) { + return new PagedFlux<>( + () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); + } + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountName, String billingProfileName, Context context) { + return new PagedFlux<>( + () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, context), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName) { + return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName)); + } + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context) { + return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, context)); + } + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing + * accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceSectionSinglePageAsync( + String billingAccountName, String billingProfileName, String invoiceSectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInvoiceSection( + this.client.getEndpoint(), + billingAccountName, + billingProfileName, + invoiceSectionName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing + * accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceSectionSinglePageAsync( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInvoiceSection( + this.client.getEndpoint(), + billingAccountName, + billingProfileName, + invoiceSectionName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing + * accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInvoiceSectionAsync( + String billingAccountName, String billingProfileName, String invoiceSectionName) { + return new PagedFlux<>( + () -> listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName), + nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink)); + } + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing + * accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInvoiceSectionAsync( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { + return new PagedFlux<>( + () -> + listByInvoiceSectionSinglePageAsync( + billingAccountName, billingProfileName, invoiceSectionName, context), + nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing + * accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName) { + return new PagedIterable<>( + listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName)); + } + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing + * accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { + return new PagedIterable<>( + listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, context)); + } + + /** + * Gets a subscription by its ID. The operation is supported for billing accounts with agreement type Microsoft + * Customer Agreement and Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a subscription by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String billingAccountName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + billingAccountName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a subscription by its ID. The operation is supported for billing accounts with agreement type Microsoft + * Customer Agreement and Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a subscription by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String billingAccountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + billingAccountName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a subscription by its ID. The operation is supported for billing accounts with agreement type Microsoft + * Customer Agreement and Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a subscription by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String billingAccountName) { + return getWithResponseAsync(billingAccountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a subscription by its ID. The operation is supported for billing accounts with agreement type Microsoft + * Customer Agreement and Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a subscription by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingSubscriptionInner get(String billingAccountName) { + return getAsync(billingAccountName).block(); + } + + /** + * Gets a subscription by its ID. The operation is supported for billing accounts with agreement type Microsoft + * Customer Agreement and Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a subscription by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String billingAccountName, Context context) { + return getWithResponseAsync(billingAccountName, context).block(); + } + + /** + * Updates the properties of a billing subscription. Currently, cost center can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String billingAccountName, BillingSubscriptionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + billingAccountName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the properties of a billing subscription. Currently, cost center can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing subscription operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String billingAccountName, BillingSubscriptionInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + billingAccountName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Updates the properties of a billing subscription. Currently, cost center can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String billingAccountName, BillingSubscriptionInner parameters) { + return updateWithResponseAsync(billingAccountName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates the properties of a billing subscription. Currently, cost center can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingSubscriptionInner update(String billingAccountName, BillingSubscriptionInner parameters) { + return updateAsync(billingAccountName, parameters).block(); + } + + /** + * Updates the properties of a billing subscription. Currently, cost center can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing subscription operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String billingAccountName, BillingSubscriptionInner parameters, Context context) { + return updateWithResponseAsync(billingAccountName, parameters, context).block(); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the move subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> moveWithResponseAsync( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .move( + this.client.getEndpoint(), + billingAccountName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the move subscription operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> moveWithResponseAsync( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .move( + this.client.getEndpoint(), + billingAccountName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the move subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BillingSubscriptionInner> beginMoveAsync( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters) { + Mono>> mono = moveWithResponseAsync(billingAccountName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BillingSubscriptionInner.class, + BillingSubscriptionInner.class, + Context.NONE); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the move subscription operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BillingSubscriptionInner> beginMoveAsync( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = moveWithResponseAsync(billingAccountName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BillingSubscriptionInner.class, + BillingSubscriptionInner.class, + context); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the move subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BillingSubscriptionInner> beginMove( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters) { + return beginMoveAsync(billingAccountName, parameters).getSyncPoller(); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the move subscription operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BillingSubscriptionInner> beginMove( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters, Context context) { + return beginMoveAsync(billingAccountName, parameters, context).getSyncPoller(); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the move subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono moveAsync( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters) { + return beginMoveAsync(billingAccountName, parameters).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the move subscription operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono moveAsync( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters, Context context) { + return beginMoveAsync(billingAccountName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the move subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingSubscriptionInner move( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters) { + return moveAsync(billingAccountName, parameters).block(); + } + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the move subscription operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingSubscriptionInner move( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters, Context context) { + return moveAsync(billingAccountName, parameters, context).block(); + } + + /** + * Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for + * billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the validate move eligibility operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the transfer eligibility validation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> validateMoveWithResponseAsync( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .validateMove( + this.client.getEndpoint(), + billingAccountName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for + * billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the validate move eligibility operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the transfer eligibility validation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> validateMoveWithResponseAsync( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .validateMove( + this.client.getEndpoint(), + billingAccountName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for + * billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the validate move eligibility operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the transfer eligibility validation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateMoveAsync( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters) { + return validateMoveWithResponseAsync(billingAccountName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for + * billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the validate move eligibility operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the transfer eligibility validation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ValidateSubscriptionTransferEligibilityResultInner validateMove( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters) { + return validateMoveAsync(billingAccountName, parameters).block(); + } + + /** + * Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for + * billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the validate move eligibility operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the transfer eligibility validation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response validateMoveWithResponse( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters, Context context) { + return validateMoveWithResponseAsync(billingAccountName, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCustomerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByCustomerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCustomerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCustomerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByBillingAccountNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingAccountNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByBillingProfileNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingProfileNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceSectionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByInvoiceSectionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceSectionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInvoiceSectionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingSubscriptionsImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingSubscriptionsImpl.java new file mode 100644 index 0000000000000..27b5d567d52b2 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingSubscriptionsImpl.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.BillingSubscriptionsClient; +import com.azure.resourcemanager.billing.fluent.models.BillingSubscriptionInner; +import com.azure.resourcemanager.billing.fluent.models.ValidateSubscriptionTransferEligibilityResultInner; +import com.azure.resourcemanager.billing.models.BillingSubscription; +import com.azure.resourcemanager.billing.models.BillingSubscriptions; +import com.azure.resourcemanager.billing.models.TransferBillingSubscriptionRequestProperties; +import com.azure.resourcemanager.billing.models.ValidateSubscriptionTransferEligibilityResult; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class BillingSubscriptionsImpl implements BillingSubscriptions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingSubscriptionsImpl.class); + + private final BillingSubscriptionsClient innerClient; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + public BillingSubscriptionsImpl( + BillingSubscriptionsClient innerClient, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByCustomer(String billingAccountName, String customerName) { + PagedIterable inner = + this.serviceClient().listByCustomer(billingAccountName, customerName); + return Utils.mapPage(inner, inner1 -> new BillingSubscriptionImpl(inner1, this.manager())); + } + + public PagedIterable listByCustomer( + String billingAccountName, String customerName, Context context) { + PagedIterable inner = + this.serviceClient().listByCustomer(billingAccountName, customerName, context); + return Utils.mapPage(inner, inner1 -> new BillingSubscriptionImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingAccount(String billingAccountName) { + PagedIterable inner = this.serviceClient().listByBillingAccount(billingAccountName); + return Utils.mapPage(inner, inner1 -> new BillingSubscriptionImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingAccount(String billingAccountName, Context context) { + PagedIterable inner = + this.serviceClient().listByBillingAccount(billingAccountName, context); + return Utils.mapPage(inner, inner1 -> new BillingSubscriptionImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName) { + PagedIterable inner = + this.serviceClient().listByBillingProfile(billingAccountName, billingProfileName); + return Utils.mapPage(inner, inner1 -> new BillingSubscriptionImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context) { + PagedIterable inner = + this.serviceClient().listByBillingProfile(billingAccountName, billingProfileName, context); + return Utils.mapPage(inner, inner1 -> new BillingSubscriptionImpl(inner1, this.manager())); + } + + public PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName) { + PagedIterable inner = + this.serviceClient().listByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName); + return Utils.mapPage(inner, inner1 -> new BillingSubscriptionImpl(inner1, this.manager())); + } + + public PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { + PagedIterable inner = + this + .serviceClient() + .listByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, context); + return Utils.mapPage(inner, inner1 -> new BillingSubscriptionImpl(inner1, this.manager())); + } + + public BillingSubscription get(String billingAccountName) { + BillingSubscriptionInner inner = this.serviceClient().get(billingAccountName); + if (inner != null) { + return new BillingSubscriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String billingAccountName, Context context) { + Response inner = this.serviceClient().getWithResponse(billingAccountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BillingSubscriptionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BillingSubscription update(String billingAccountName, BillingSubscriptionInner parameters) { + BillingSubscriptionInner inner = this.serviceClient().update(billingAccountName, parameters); + if (inner != null) { + return new BillingSubscriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String billingAccountName, BillingSubscriptionInner parameters, Context context) { + Response inner = + this.serviceClient().updateWithResponse(billingAccountName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BillingSubscriptionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BillingSubscription move( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters) { + BillingSubscriptionInner inner = this.serviceClient().move(billingAccountName, parameters); + if (inner != null) { + return new BillingSubscriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public BillingSubscription move( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters, Context context) { + BillingSubscriptionInner inner = this.serviceClient().move(billingAccountName, parameters, context); + if (inner != null) { + return new BillingSubscriptionImpl(inner, this.manager()); + } else { + return null; + } + } + + public ValidateSubscriptionTransferEligibilityResult validateMove( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters) { + ValidateSubscriptionTransferEligibilityResultInner inner = + this.serviceClient().validateMove(billingAccountName, parameters); + if (inner != null) { + return new ValidateSubscriptionTransferEligibilityResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response validateMoveWithResponse( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters, Context context) { + Response inner = + this.serviceClient().validateMoveWithResponse(billingAccountName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ValidateSubscriptionTransferEligibilityResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private BillingSubscriptionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/CustomerImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/CustomerImpl.java new file mode 100644 index 0000000000000..666146064b57e --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/CustomerImpl.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.CustomerInner; +import com.azure.resourcemanager.billing.models.AzurePlan; +import com.azure.resourcemanager.billing.models.Customer; +import com.azure.resourcemanager.billing.models.Reseller; +import java.util.Collections; +import java.util.List; + +public final class CustomerImpl implements Customer { + private CustomerInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + CustomerImpl(CustomerInner innerObject, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String billingProfileId() { + return this.innerModel().billingProfileId(); + } + + public String billingProfileDisplayName() { + return this.innerModel().billingProfileDisplayName(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public List enabledAzurePlans() { + List inner = this.innerModel().enabledAzurePlans(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List resellers() { + List inner = this.innerModel().resellers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public CustomerInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/CustomerPolicyImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/CustomerPolicyImpl.java new file mode 100644 index 0000000000000..ab8405cf3917d --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/CustomerPolicyImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.CustomerPolicyInner; +import com.azure.resourcemanager.billing.models.CustomerPolicy; +import com.azure.resourcemanager.billing.models.ViewCharges; + +public final class CustomerPolicyImpl implements CustomerPolicy { + private CustomerPolicyInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + CustomerPolicyImpl( + CustomerPolicyInner innerObject, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ViewCharges viewCharges() { + return this.innerModel().viewCharges(); + } + + public CustomerPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/CustomersClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/CustomersClientImpl.java new file mode 100644 index 0000000000000..970999ba3929b --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/CustomersClientImpl.java @@ -0,0 +1,845 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.CustomersClient; +import com.azure.resourcemanager.billing.fluent.models.CustomerInner; +import com.azure.resourcemanager.billing.models.CustomerListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CustomersClient. */ +public final class CustomersClientImpl implements CustomersClient { + private final ClientLogger logger = new ClientLogger(CustomersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CustomersService service; + + /** The service client containing this operation class. */ + private final BillingManagementClientImpl client; + + /** + * Initializes an instance of CustomersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CustomersClientImpl(BillingManagementClientImpl client) { + this.service = + RestProxy.create(CustomersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BillingManagementClientCustomers to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BillingManagementCli") + private interface CustomersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/customers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingProfile( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @QueryParam("$search") String search, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingAccount( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @QueryParam("$search") String search, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("customerName") String customerName, + @QueryParam("$expand") String expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingProfileNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingAccountNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts + * with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param search Used for searching customers by their name. Any customer with name containing the search text will + * be included in the response. + * @param filter May be used to filter the list of customers. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileSinglePageAsync( + String billingAccountName, String billingProfileName, String search, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBillingProfile( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + search, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts + * with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param search Used for searching customers by their name. Any customer with name containing the search text will + * be included in the response. + * @param filter May be used to filter the list of customers. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileSinglePageAsync( + String billingAccountName, String billingProfileName, String search, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingProfile( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + search, + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts + * with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param search Used for searching customers by their name. Any customer with name containing the search text will + * be included in the response. + * @param filter May be used to filter the list of customers. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountName, String billingProfileName, String search, String filter) { + return new PagedFlux<>( + () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, search, filter), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts + * with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync(String billingAccountName, String billingProfileName) { + final String search = null; + final String filter = null; + return new PagedFlux<>( + () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, search, filter), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts + * with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param search Used for searching customers by their name. Any customer with name containing the search text will + * be included in the response. + * @param filter May be used to filter the list of customers. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountName, String billingProfileName, String search, String filter, Context context) { + return new PagedFlux<>( + () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, search, filter, context), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts + * with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName) { + final String search = null; + final String filter = null; + return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, search, filter)); + } + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts + * with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param search Used for searching customers by their name. Any customer with name containing the search text will + * be included in the response. + * @param filter May be used to filter the list of customers. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, String search, String filter, Context context) { + return new PagedIterable<>( + listByBillingProfileAsync(billingAccountName, billingProfileName, search, filter, context)); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts + * with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param search Used for searching customers by their name. Any customer with name containing the search text will + * be included in the response. + * @param filter May be used to filter the list of customers. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountSinglePageAsync( + String billingAccountName, String search, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBillingAccount( + this.client.getEndpoint(), apiVersion, billingAccountName, search, filter, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts + * with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param search Used for searching customers by their name. Any customer with name containing the search text will + * be included in the response. + * @param filter May be used to filter the list of customers. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountSinglePageAsync( + String billingAccountName, String search, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingAccount( + this.client.getEndpoint(), apiVersion, billingAccountName, search, filter, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts + * with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param search Used for searching customers by their name. Any customer with name containing the search text will + * be included in the response. + * @param filter May be used to filter the list of customers. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync( + String billingAccountName, String search, String filter) { + return new PagedFlux<>( + () -> listByBillingAccountSinglePageAsync(billingAccountName, search, filter), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts + * with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync(String billingAccountName) { + final String search = null; + final String filter = null; + return new PagedFlux<>( + () -> listByBillingAccountSinglePageAsync(billingAccountName, search, filter), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts + * with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param search Used for searching customers by their name. Any customer with name containing the search text will + * be included in the response. + * @param filter May be used to filter the list of customers. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync( + String billingAccountName, String search, String filter, Context context) { + return new PagedFlux<>( + () -> listByBillingAccountSinglePageAsync(billingAccountName, search, filter, context), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts + * with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingAccount(String billingAccountName) { + final String search = null; + final String filter = null; + return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, search, filter)); + } + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts + * with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param search Used for searching customers by their name. Any customer with name containing the search text will + * be included in the response. + * @param filter May be used to filter the list of customers. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingAccount( + String billingAccountName, String search, String filter, Context context) { + return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, search, filter, context)); + } + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft + * Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param expand May be used to expand enabledAzurePlans and resellers. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a customer by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String billingAccountName, String customerName, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (customerName == null) { + return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + customerName, + expand, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft + * Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param expand May be used to expand enabledAzurePlans and resellers. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a customer by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String billingAccountName, String customerName, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (customerName == null) { + return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get(this.client.getEndpoint(), apiVersion, billingAccountName, customerName, expand, accept, context); + } + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft + * Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param expand May be used to expand enabledAzurePlans and resellers. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a customer by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String billingAccountName, String customerName, String expand) { + return getWithResponseAsync(billingAccountName, customerName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft + * Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a customer by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String billingAccountName, String customerName) { + final String expand = null; + return getWithResponseAsync(billingAccountName, customerName, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft + * Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a customer by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomerInner get(String billingAccountName, String customerName) { + final String expand = null; + return getAsync(billingAccountName, customerName, expand).block(); + } + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft + * Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param expand May be used to expand enabledAzurePlans and resellers. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a customer by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String billingAccountName, String customerName, String expand, Context context) { + return getWithResponseAsync(billingAccountName, customerName, expand, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByBillingProfileNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingProfileNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByBillingAccountNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingAccountNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/CustomersImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/CustomersImpl.java new file mode 100644 index 0000000000000..4bdc72997ddea --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/CustomersImpl.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.CustomersClient; +import com.azure.resourcemanager.billing.fluent.models.CustomerInner; +import com.azure.resourcemanager.billing.models.Customer; +import com.azure.resourcemanager.billing.models.Customers; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CustomersImpl implements Customers { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomersImpl.class); + + private final CustomersClient innerClient; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + public CustomersImpl(CustomersClient innerClient, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName) { + PagedIterable inner = + this.serviceClient().listByBillingProfile(billingAccountName, billingProfileName); + return Utils.mapPage(inner, inner1 -> new CustomerImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, String search, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByBillingProfile(billingAccountName, billingProfileName, search, filter, context); + return Utils.mapPage(inner, inner1 -> new CustomerImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingAccount(String billingAccountName) { + PagedIterable inner = this.serviceClient().listByBillingAccount(billingAccountName); + return Utils.mapPage(inner, inner1 -> new CustomerImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingAccount( + String billingAccountName, String search, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByBillingAccount(billingAccountName, search, filter, context); + return Utils.mapPage(inner, inner1 -> new CustomerImpl(inner1, this.manager())); + } + + public Customer get(String billingAccountName, String customerName) { + CustomerInner inner = this.serviceClient().get(billingAccountName, customerName); + if (inner != null) { + return new CustomerImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String billingAccountName, String customerName, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(billingAccountName, customerName, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CustomerImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private CustomersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/DownloadUrlImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/DownloadUrlImpl.java new file mode 100644 index 0000000000000..8a9e1794905c7 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/DownloadUrlImpl.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.DownloadUrlInner; +import com.azure.resourcemanager.billing.models.DownloadUrl; +import java.time.OffsetDateTime; + +public final class DownloadUrlImpl implements DownloadUrl { + private DownloadUrlInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + DownloadUrlImpl(DownloadUrlInner innerObject, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public OffsetDateTime expiryTime() { + return this.innerModel().expiryTime(); + } + + public String url() { + return this.innerModel().url(); + } + + public DownloadUrlInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/EnrollmentAccountSummaryImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/EnrollmentAccountSummaryImpl.java new file mode 100644 index 0000000000000..d369fe44c1a8c --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/EnrollmentAccountSummaryImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.EnrollmentAccountSummaryInner; +import com.azure.resourcemanager.billing.models.EnrollmentAccountSummary; + +public final class EnrollmentAccountSummaryImpl implements EnrollmentAccountSummary { + private EnrollmentAccountSummaryInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + EnrollmentAccountSummaryImpl( + EnrollmentAccountSummaryInner innerObject, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String principalName() { + return this.innerModel().principalName(); + } + + public EnrollmentAccountSummaryInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/EnrollmentAccountsClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/EnrollmentAccountsClientImpl.java new file mode 100644 index 0000000000000..4239f5be75862 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/EnrollmentAccountsClientImpl.java @@ -0,0 +1,387 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.EnrollmentAccountsClient; +import com.azure.resourcemanager.billing.fluent.models.EnrollmentAccountSummaryInner; +import com.azure.resourcemanager.billing.models.EnrollmentAccountListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in EnrollmentAccountsClient. */ +public final class EnrollmentAccountsClientImpl implements EnrollmentAccountsClient { + private final ClientLogger logger = new ClientLogger(EnrollmentAccountsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final EnrollmentAccountsService service; + + /** The service client containing this operation class. */ + private final BillingManagementClientImpl client; + + /** + * Initializes an instance of EnrollmentAccountsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EnrollmentAccountsClientImpl(BillingManagementClientImpl client) { + this.service = + RestProxy.create(EnrollmentAccountsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BillingManagementClientEnrollmentAccounts to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BillingManagementCli") + private interface EnrollmentAccountsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/enrollmentAccounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/enrollmentAccounts/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the enrollment accounts the caller has access to. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing enrollment accounts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2018-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the enrollment accounts the caller has access to. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing enrollment accounts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2018-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the enrollment accounts the caller has access to. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing enrollment accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the enrollment accounts the caller has access to. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing enrollment accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the enrollment accounts the caller has access to. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing enrollment accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists the enrollment accounts the caller has access to. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing enrollment accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets a enrollment account by name. + * + * @param name Enrollment Account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a enrollment account by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String apiVersion = "2018-03-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), name, apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a enrollment account by name. + * + * @param name Enrollment Account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a enrollment account by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String apiVersion = "2018-03-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), name, apiVersion, accept, context); + } + + /** + * Gets a enrollment account by name. + * + * @param name Enrollment Account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a enrollment account by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String name) { + return getWithResponseAsync(name) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a enrollment account by name. + * + * @param name Enrollment Account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a enrollment account by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnrollmentAccountSummaryInner get(String name) { + return getAsync(name).block(); + } + + /** + * Gets a enrollment account by name. + * + * @param name Enrollment Account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a enrollment account by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String name, Context context) { + return getWithResponseAsync(name, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing enrollment accounts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing enrollment accounts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/EnrollmentAccountsImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/EnrollmentAccountsImpl.java new file mode 100644 index 0000000000000..f30584f5519e0 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/EnrollmentAccountsImpl.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.EnrollmentAccountsClient; +import com.azure.resourcemanager.billing.fluent.models.EnrollmentAccountSummaryInner; +import com.azure.resourcemanager.billing.models.EnrollmentAccountSummary; +import com.azure.resourcemanager.billing.models.EnrollmentAccounts; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class EnrollmentAccountsImpl implements EnrollmentAccounts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EnrollmentAccountsImpl.class); + + private final EnrollmentAccountsClient innerClient; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + public EnrollmentAccountsImpl( + EnrollmentAccountsClient innerClient, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new EnrollmentAccountSummaryImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new EnrollmentAccountSummaryImpl(inner1, this.manager())); + } + + public EnrollmentAccountSummary get(String name) { + EnrollmentAccountSummaryInner inner = this.serviceClient().get(name); + if (inner != null) { + return new EnrollmentAccountSummaryImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String name, Context context) { + Response inner = this.serviceClient().getWithResponse(name, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new EnrollmentAccountSummaryImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private EnrollmentAccountsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InstructionImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InstructionImpl.java new file mode 100644 index 0000000000000..fccadc2ec571b --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InstructionImpl.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.InstructionInner; +import com.azure.resourcemanager.billing.models.Instruction; +import java.time.OffsetDateTime; + +public final class InstructionImpl implements Instruction { + private InstructionInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + InstructionImpl(InstructionInner innerObject, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Float amount() { + return this.innerModel().amount(); + } + + public OffsetDateTime startDate() { + return this.innerModel().startDate(); + } + + public OffsetDateTime endDate() { + return this.innerModel().endDate(); + } + + public OffsetDateTime creationDate() { + return this.innerModel().creationDate(); + } + + public InstructionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InstructionsClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InstructionsClientImpl.java new file mode 100644 index 0000000000000..f80d1a0aac5e6 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InstructionsClientImpl.java @@ -0,0 +1,700 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.InstructionsClient; +import com.azure.resourcemanager.billing.fluent.models.InstructionInner; +import com.azure.resourcemanager.billing.models.InstructionListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in InstructionsClient. */ +public final class InstructionsClientImpl implements InstructionsClient { + private final ClientLogger logger = new ClientLogger(InstructionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final InstructionsService service; + + /** The service client containing this operation class. */ + private final BillingManagementClientImpl client; + + /** + * Initializes an instance of InstructionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + InstructionsClientImpl(BillingManagementClientImpl client) { + this.service = + RestProxy.create(InstructionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BillingManagementClientInstructions to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BillingManagementCli") + private interface InstructionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/instructions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingProfile( + @HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/instructions/{instructionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("instructionName") String instructionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/instructions/{instructionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> put( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("instructionName") String instructionName, + @BodyParam("application/json") InstructionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingProfileNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the instructions by billing profile id. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing instructions used during invoice generation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileSinglePageAsync( + String billingAccountName, String billingProfileName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBillingProfile( + this.client.getEndpoint(), + billingAccountName, + billingProfileName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the instructions by billing profile id. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing instructions used during invoice generation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileSinglePageAsync( + String billingAccountName, String billingProfileName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingProfile( + this.client.getEndpoint(), billingAccountName, billingProfileName, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the instructions by billing profile id. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing instructions used during invoice generation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountName, String billingProfileName) { + return new PagedFlux<>( + () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); + } + + /** + * Lists the instructions by billing profile id. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing instructions used during invoice generation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountName, String billingProfileName, Context context) { + return new PagedFlux<>( + () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, context), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the instructions by billing profile id. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing instructions used during invoice generation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName) { + return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName)); + } + + /** + * Lists the instructions by billing profile id. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing instructions used during invoice generation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context) { + return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, context)); + } + + /** + * Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instruction by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String billingAccountName, String billingProfileName, String instructionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (instructionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instructionName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + instructionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instruction by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String billingAccountName, String billingProfileName, String instructionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (instructionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instructionName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + instructionName, + accept, + context); + } + + /** + * Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instruction by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String billingAccountName, String billingProfileName, String instructionName) { + return getWithResponseAsync(billingAccountName, billingProfileName, instructionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instruction by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstructionInner get(String billingAccountName, String billingProfileName, String instructionName) { + return getAsync(billingAccountName, billingProfileName, instructionName).block(); + } + + /** + * Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instruction by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String billingAccountName, String billingProfileName, String instructionName, Context context) { + return getWithResponseAsync(billingAccountName, billingProfileName, instructionName, context).block(); + } + + /** + * Creates or updates an instruction. These are custom billing instructions and are only applicable for certain + * customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @param parameters The new instruction. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instruction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> putWithResponseAsync( + String billingAccountName, String billingProfileName, String instructionName, InstructionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (instructionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instructionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .put( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + instructionName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an instruction. These are custom billing instructions and are only applicable for certain + * customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @param parameters The new instruction. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instruction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> putWithResponseAsync( + String billingAccountName, + String billingProfileName, + String instructionName, + InstructionInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (instructionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter instructionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .put( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + instructionName, + parameters, + accept, + context); + } + + /** + * Creates or updates an instruction. These are custom billing instructions and are only applicable for certain + * customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @param parameters The new instruction. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instruction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono putAsync( + String billingAccountName, String billingProfileName, String instructionName, InstructionInner parameters) { + return putWithResponseAsync(billingAccountName, billingProfileName, instructionName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates an instruction. These are custom billing instructions and are only applicable for certain + * customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @param parameters The new instruction. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instruction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InstructionInner put( + String billingAccountName, String billingProfileName, String instructionName, InstructionInner parameters) { + return putAsync(billingAccountName, billingProfileName, instructionName, parameters).block(); + } + + /** + * Creates or updates an instruction. These are custom billing instructions and are only applicable for certain + * customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @param parameters The new instruction. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instruction. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response putWithResponse( + String billingAccountName, + String billingProfileName, + String instructionName, + InstructionInner parameters, + Context context) { + return putWithResponseAsync(billingAccountName, billingProfileName, instructionName, parameters, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing instructions used during invoice generation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByBillingProfileNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing instructions used during invoice generation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingProfileNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InstructionsImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InstructionsImpl.java new file mode 100644 index 0000000000000..b41a5b565c998 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InstructionsImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.InstructionsClient; +import com.azure.resourcemanager.billing.fluent.models.InstructionInner; +import com.azure.resourcemanager.billing.models.Instruction; +import com.azure.resourcemanager.billing.models.Instructions; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class InstructionsImpl implements Instructions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InstructionsImpl.class); + + private final InstructionsClient innerClient; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + public InstructionsImpl( + InstructionsClient innerClient, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName) { + PagedIterable inner = + this.serviceClient().listByBillingProfile(billingAccountName, billingProfileName); + return Utils.mapPage(inner, inner1 -> new InstructionImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context) { + PagedIterable inner = + this.serviceClient().listByBillingProfile(billingAccountName, billingProfileName, context); + return Utils.mapPage(inner, inner1 -> new InstructionImpl(inner1, this.manager())); + } + + public Instruction get(String billingAccountName, String billingProfileName, String instructionName) { + InstructionInner inner = this.serviceClient().get(billingAccountName, billingProfileName, instructionName); + if (inner != null) { + return new InstructionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String billingAccountName, String billingProfileName, String instructionName, Context context) { + Response inner = + this.serviceClient().getWithResponse(billingAccountName, billingProfileName, instructionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new InstructionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Instruction put( + String billingAccountName, String billingProfileName, String instructionName, InstructionInner parameters) { + InstructionInner inner = + this.serviceClient().put(billingAccountName, billingProfileName, instructionName, parameters); + if (inner != null) { + return new InstructionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response putWithResponse( + String billingAccountName, + String billingProfileName, + String instructionName, + InstructionInner parameters, + Context context) { + Response inner = + this + .serviceClient() + .putWithResponse(billingAccountName, billingProfileName, instructionName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new InstructionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private InstructionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceImpl.java new file mode 100644 index 0000000000000..0b4a038252070 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceImpl.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.InvoiceInner; +import com.azure.resourcemanager.billing.models.Amount; +import com.azure.resourcemanager.billing.models.Document; +import com.azure.resourcemanager.billing.models.Invoice; +import com.azure.resourcemanager.billing.models.InvoiceDocumentType; +import com.azure.resourcemanager.billing.models.InvoiceStatus; +import com.azure.resourcemanager.billing.models.InvoiceType; +import com.azure.resourcemanager.billing.models.PaymentProperties; +import com.azure.resourcemanager.billing.models.RebillDetails; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class InvoiceImpl implements Invoice { + private InvoiceInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + InvoiceImpl(InvoiceInner innerObject, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public OffsetDateTime dueDate() { + return this.innerModel().dueDate(); + } + + public OffsetDateTime invoiceDate() { + return this.innerModel().invoiceDate(); + } + + public InvoiceStatus status() { + return this.innerModel().status(); + } + + public Amount amountDue() { + return this.innerModel().amountDue(); + } + + public Amount azurePrepaymentApplied() { + return this.innerModel().azurePrepaymentApplied(); + } + + public Amount billedAmount() { + return this.innerModel().billedAmount(); + } + + public Amount creditAmount() { + return this.innerModel().creditAmount(); + } + + public Amount freeAzureCreditApplied() { + return this.innerModel().freeAzureCreditApplied(); + } + + public Amount subTotal() { + return this.innerModel().subTotal(); + } + + public Amount taxAmount() { + return this.innerModel().taxAmount(); + } + + public Amount totalAmount() { + return this.innerModel().totalAmount(); + } + + public OffsetDateTime invoicePeriodStartDate() { + return this.innerModel().invoicePeriodStartDate(); + } + + public OffsetDateTime invoicePeriodEndDate() { + return this.innerModel().invoicePeriodEndDate(); + } + + public InvoiceType invoiceType() { + return this.innerModel().invoiceType(); + } + + public Boolean isMonthlyInvoice() { + return this.innerModel().isMonthlyInvoice(); + } + + public String billingProfileId() { + return this.innerModel().billingProfileId(); + } + + public String billingProfileDisplayName() { + return this.innerModel().billingProfileDisplayName(); + } + + public String purchaseOrderNumber() { + return this.innerModel().purchaseOrderNumber(); + } + + public List documents() { + List inner = this.innerModel().documents(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List payments() { + List inner = this.innerModel().payments(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Map rebillDetails() { + Map inner = this.innerModel().rebillDetails(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public InvoiceDocumentType documentType() { + return this.innerModel().documentType(); + } + + public String billedDocumentId() { + return this.innerModel().billedDocumentId(); + } + + public String creditForDocumentId() { + return this.innerModel().creditForDocumentId(); + } + + public String subscriptionId() { + return this.innerModel().subscriptionId(); + } + + public InvoiceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceSectionImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceSectionImpl.java new file mode 100644 index 0000000000000..9acc5cdd1f6db --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceSectionImpl.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.InvoiceSectionInner; +import com.azure.resourcemanager.billing.models.InvoiceSection; +import com.azure.resourcemanager.billing.models.InvoiceSectionState; +import com.azure.resourcemanager.billing.models.TargetCloud; +import java.util.Collections; +import java.util.Map; + +public final class InvoiceSectionImpl implements InvoiceSection { + private InvoiceSectionInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + InvoiceSectionImpl( + InvoiceSectionInner innerObject, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public Map labels() { + Map inner = this.innerModel().labels(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public InvoiceSectionState state() { + return this.innerModel().state(); + } + + public String systemId() { + return this.innerModel().systemId(); + } + + public TargetCloud targetCloud() { + return this.innerModel().targetCloud(); + } + + public InvoiceSectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceSectionWithCreateSubPermissionImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceSectionWithCreateSubPermissionImpl.java new file mode 100644 index 0000000000000..97779e42498ea --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceSectionWithCreateSubPermissionImpl.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.InvoiceSectionWithCreateSubPermissionInner; +import com.azure.resourcemanager.billing.models.AzurePlan; +import com.azure.resourcemanager.billing.models.BillingProfileStatus; +import com.azure.resourcemanager.billing.models.InvoiceSectionWithCreateSubPermission; +import com.azure.resourcemanager.billing.models.SpendingLimitForBillingProfile; +import com.azure.resourcemanager.billing.models.StatusReasonCodeForBillingProfile; +import java.util.Collections; +import java.util.List; + +public final class InvoiceSectionWithCreateSubPermissionImpl implements InvoiceSectionWithCreateSubPermission { + private InvoiceSectionWithCreateSubPermissionInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + InvoiceSectionWithCreateSubPermissionImpl( + InvoiceSectionWithCreateSubPermissionInner innerObject, + com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String invoiceSectionId() { + return this.innerModel().invoiceSectionId(); + } + + public String invoiceSectionDisplayName() { + return this.innerModel().invoiceSectionDisplayName(); + } + + public String invoiceSectionSystemId() { + return this.innerModel().invoiceSectionSystemId(); + } + + public String billingProfileId() { + return this.innerModel().billingProfileId(); + } + + public String billingProfileDisplayName() { + return this.innerModel().billingProfileDisplayName(); + } + + public BillingProfileStatus billingProfileStatus() { + return this.innerModel().billingProfileStatus(); + } + + public StatusReasonCodeForBillingProfile billingProfileStatusReasonCode() { + return this.innerModel().billingProfileStatusReasonCode(); + } + + public SpendingLimitForBillingProfile billingProfileSpendingLimit() { + return this.innerModel().billingProfileSpendingLimit(); + } + + public String billingProfileSystemId() { + return this.innerModel().billingProfileSystemId(); + } + + public List enabledAzurePlans() { + List inner = this.innerModel().enabledAzurePlans(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public InvoiceSectionWithCreateSubPermissionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceSectionsClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceSectionsClientImpl.java new file mode 100644 index 0000000000000..2a873ac5da0e1 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceSectionsClientImpl.java @@ -0,0 +1,856 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.billing.fluent.InvoiceSectionsClient; +import com.azure.resourcemanager.billing.fluent.models.InvoiceSectionInner; +import com.azure.resourcemanager.billing.models.InvoiceSectionListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in InvoiceSectionsClient. */ +public final class InvoiceSectionsClientImpl implements InvoiceSectionsClient { + private final ClientLogger logger = new ClientLogger(InvoiceSectionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final InvoiceSectionsService service; + + /** The service client containing this operation class. */ + private final BillingManagementClientImpl client; + + /** + * Initializes an instance of InvoiceSectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + InvoiceSectionsClientImpl(BillingManagementClientImpl client) { + this.service = + RestProxy.create(InvoiceSectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BillingManagementClientInvoiceSections to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BillingManagementCli") + private interface InvoiceSectionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/invoiceSections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingProfile( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/invoiceSections/{invoiceSectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("invoiceSectionName") String invoiceSectionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/invoiceSections/{invoiceSectionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("invoiceSectionName") String invoiceSectionName, + @BodyParam("application/json") InvoiceSectionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingProfileNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice sections. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileSinglePageAsync( + String billingAccountName, String billingProfileName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBillingProfile( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice sections. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileSinglePageAsync( + String billingAccountName, String billingProfileName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingProfile( + this.client.getEndpoint(), apiVersion, billingAccountName, billingProfileName, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice sections. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountName, String billingProfileName) { + return new PagedFlux<>( + () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); + } + + /** + * Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice sections. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountName, String billingProfileName, Context context) { + return new PagedFlux<>( + () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, context), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice sections. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName) { + return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName)); + } + + /** + * Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice sections. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context) { + return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, context)); + } + + /** + * Gets an invoice section by its ID. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String billingAccountName, String billingProfileName, String invoiceSectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + invoiceSectionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an invoice section by its ID. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + invoiceSectionName, + accept, + context); + } + + /** + * Gets an invoice section by its ID. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String billingAccountName, String billingProfileName, String invoiceSectionName) { + return getWithResponseAsync(billingAccountName, billingProfileName, invoiceSectionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an invoice section by its ID. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InvoiceSectionInner get(String billingAccountName, String billingProfileName, String invoiceSectionName) { + return getAsync(billingAccountName, billingProfileName, invoiceSectionName).block(); + } + + /** + * Gets an invoice section by its ID. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section by its ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { + return getWithResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, context).block(); + } + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + InvoiceSectionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + invoiceSectionName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + InvoiceSectionInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + invoiceSectionName, + parameters, + accept, + context); + } + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, InvoiceSectionInner> beginCreateOrUpdateAsync( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + InvoiceSectionInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + InvoiceSectionInner.class, + InvoiceSectionInner.class, + Context.NONE); + } + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, InvoiceSectionInner> beginCreateOrUpdateAsync( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + InvoiceSectionInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + billingAccountName, billingProfileName, invoiceSectionName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), InvoiceSectionInner.class, InvoiceSectionInner.class, context); + } + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, InvoiceSectionInner> beginCreateOrUpdate( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + InvoiceSectionInner parameters) { + return beginCreateOrUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, InvoiceSectionInner> beginCreateOrUpdate( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + InvoiceSectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + InvoiceSectionInner parameters) { + return beginCreateOrUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + InvoiceSectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InvoiceSectionInner createOrUpdate( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + InvoiceSectionInner parameters) { + return createOrUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).block(); + } + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InvoiceSectionInner createOrUpdate( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + InvoiceSectionInner parameters, + Context context) { + return createOrUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice sections. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByBillingProfileNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice sections. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingProfileNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceSectionsImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceSectionsImpl.java new file mode 100644 index 0000000000000..1552947cbe8d9 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoiceSectionsImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.InvoiceSectionsClient; +import com.azure.resourcemanager.billing.fluent.models.InvoiceSectionInner; +import com.azure.resourcemanager.billing.models.InvoiceSection; +import com.azure.resourcemanager.billing.models.InvoiceSections; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class InvoiceSectionsImpl implements InvoiceSections { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InvoiceSectionsImpl.class); + + private final InvoiceSectionsClient innerClient; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + public InvoiceSectionsImpl( + InvoiceSectionsClient innerClient, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName) { + PagedIterable inner = + this.serviceClient().listByBillingProfile(billingAccountName, billingProfileName); + return Utils.mapPage(inner, inner1 -> new InvoiceSectionImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context) { + PagedIterable inner = + this.serviceClient().listByBillingProfile(billingAccountName, billingProfileName, context); + return Utils.mapPage(inner, inner1 -> new InvoiceSectionImpl(inner1, this.manager())); + } + + public InvoiceSection get(String billingAccountName, String billingProfileName, String invoiceSectionName) { + InvoiceSectionInner inner = + this.serviceClient().get(billingAccountName, billingProfileName, invoiceSectionName); + if (inner != null) { + return new InvoiceSectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { + Response inner = + this.serviceClient().getWithResponse(billingAccountName, billingProfileName, invoiceSectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new InvoiceSectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public InvoiceSection createOrUpdate( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + InvoiceSectionInner parameters) { + InvoiceSectionInner inner = + this.serviceClient().createOrUpdate(billingAccountName, billingProfileName, invoiceSectionName, parameters); + if (inner != null) { + return new InvoiceSectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public InvoiceSection createOrUpdate( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + InvoiceSectionInner parameters, + Context context) { + InvoiceSectionInner inner = + this + .serviceClient() + .createOrUpdate(billingAccountName, billingProfileName, invoiceSectionName, parameters, context); + if (inner != null) { + return new InvoiceSectionImpl(inner, this.manager()); + } else { + return null; + } + } + + private InvoiceSectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoicesClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoicesClientImpl.java new file mode 100644 index 0000000000000..1d1071bfbeed8 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoicesClientImpl.java @@ -0,0 +1,2364 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.billing.fluent.InvoicesClient; +import com.azure.resourcemanager.billing.fluent.models.DownloadUrlInner; +import com.azure.resourcemanager.billing.fluent.models.InvoiceInner; +import com.azure.resourcemanager.billing.models.InvoiceListResult; +import java.nio.ByteBuffer; +import java.util.List; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in InvoicesClient. */ +public final class InvoicesClientImpl implements InvoicesClient { + private final ClientLogger logger = new ClientLogger(InvoicesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final InvoicesService service; + + /** The service client containing this operation class. */ + private final BillingManagementClientImpl client; + + /** + * Initializes an instance of InvoicesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + InvoicesClientImpl(BillingManagementClientImpl client) { + this.service = RestProxy.create(InvoicesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BillingManagementClientInvoices to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BillingManagementCli") + private interface InvoicesService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingAccount( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @QueryParam("periodStartDate") String periodStartDate, + @QueryParam("periodEndDate") String periodEndDate, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/invoices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingProfile( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @QueryParam("periodStartDate") String periodStartDate, + @QueryParam("periodEndDate") String periodEndDate, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("invoiceName") String invoiceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/billingAccounts/default/invoices/{invoiceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getById( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("invoiceName") String invoiceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/download") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> downloadInvoice( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("invoiceName") String invoiceName, + @QueryParam("downloadToken") String downloadToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/downloadDocuments") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> downloadMultipleBillingProfileInvoices( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @BodyParam("application/json") List downloadUrls, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingSubscription( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("periodStartDate") String periodStartDate, + @QueryParam("periodEndDate") String periodEndDate, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices" + + "/{invoiceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getBySubscriptionAndInvoiceId( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("invoiceName") String invoiceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices" + + "/{invoiceName}/download") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> downloadBillingSubscriptionInvoice( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("invoiceName") String invoiceName, + @QueryParam("downloadToken") String downloadToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}" + + "/downloadDocuments") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> downloadMultipleBillingSubscriptionInvoices( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") List downloadUrls, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingAccountNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingProfileNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingSubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the invoices for a billing account for a given start date and end date. The operation is supported for + * billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountSinglePageAsync( + String billingAccountName, String periodStartDate, String periodEndDate) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (periodStartDate == null) { + return Mono + .error(new IllegalArgumentException("Parameter periodStartDate is required and cannot be null.")); + } + if (periodEndDate == null) { + return Mono.error(new IllegalArgumentException("Parameter periodEndDate is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBillingAccount( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + periodStartDate, + periodEndDate, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the invoices for a billing account for a given start date and end date. The operation is supported for + * billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountSinglePageAsync( + String billingAccountName, String periodStartDate, String periodEndDate, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (periodStartDate == null) { + return Mono + .error(new IllegalArgumentException("Parameter periodStartDate is required and cannot be null.")); + } + if (periodEndDate == null) { + return Mono.error(new IllegalArgumentException("Parameter periodEndDate is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingAccount( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + periodStartDate, + periodEndDate, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the invoices for a billing account for a given start date and end date. The operation is supported for + * billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync( + String billingAccountName, String periodStartDate, String periodEndDate) { + return new PagedFlux<>( + () -> listByBillingAccountSinglePageAsync(billingAccountName, periodStartDate, periodEndDate), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists the invoices for a billing account for a given start date and end date. The operation is supported for + * billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync( + String billingAccountName, String periodStartDate, String periodEndDate, Context context) { + return new PagedFlux<>( + () -> listByBillingAccountSinglePageAsync(billingAccountName, periodStartDate, periodEndDate, context), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the invoices for a billing account for a given start date and end date. The operation is supported for + * billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingAccount( + String billingAccountName, String periodStartDate, String periodEndDate) { + return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, periodStartDate, periodEndDate)); + } + + /** + * Lists the invoices for a billing account for a given start date and end date. The operation is supported for + * billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingAccount( + String billingAccountName, String periodStartDate, String periodEndDate, Context context) { + return new PagedIterable<>( + listByBillingAccountAsync(billingAccountName, periodStartDate, periodEndDate, context)); + } + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for + * billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileSinglePageAsync( + String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (periodStartDate == null) { + return Mono + .error(new IllegalArgumentException("Parameter periodStartDate is required and cannot be null.")); + } + if (periodEndDate == null) { + return Mono.error(new IllegalArgumentException("Parameter periodEndDate is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBillingProfile( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + periodStartDate, + periodEndDate, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for + * billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileSinglePageAsync( + String billingAccountName, + String billingProfileName, + String periodStartDate, + String periodEndDate, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (periodStartDate == null) { + return Mono + .error(new IllegalArgumentException("Parameter periodStartDate is required and cannot be null.")); + } + if (periodEndDate == null) { + return Mono.error(new IllegalArgumentException("Parameter periodEndDate is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingProfile( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + periodStartDate, + periodEndDate, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for + * billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate) { + return new PagedFlux<>( + () -> + listByBillingProfileSinglePageAsync( + billingAccountName, billingProfileName, periodStartDate, periodEndDate), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); + } + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for + * billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountName, + String billingProfileName, + String periodStartDate, + String periodEndDate, + Context context) { + return new PagedFlux<>( + () -> + listByBillingProfileSinglePageAsync( + billingAccountName, billingProfileName, periodStartDate, periodEndDate, context), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for + * billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate) { + return new PagedIterable<>( + listByBillingProfileAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate)); + } + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for + * billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingProfile( + String billingAccountName, + String billingProfileName, + String periodStartDate, + String periodEndDate, + Context context) { + return new PagedIterable<>( + listByBillingProfileAsync(billingAccountName, billingProfileName, periodStartDate, periodEndDate, context)); + } + + /** + * Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by billing account name and ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String billingAccountName, String invoiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (invoiceName == null) { + return Mono.error(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get(this.client.getEndpoint(), apiVersion, billingAccountName, invoiceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by billing account name and ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String billingAccountName, String invoiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (invoiceName == null) { + return Mono.error(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), apiVersion, billingAccountName, invoiceName, accept, context); + } + + /** + * Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by billing account name and ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String billingAccountName, String invoiceName) { + return getWithResponseAsync(billingAccountName, invoiceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by billing account name and ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InvoiceInner get(String billingAccountName, String invoiceName) { + return getAsync(billingAccountName, invoiceName).block(); + } + + /** + * Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by billing account name and ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String billingAccountName, String invoiceName, Context context) { + return getWithResponseAsync(billingAccountName, invoiceName, context).block(); + } + + /** + * Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner + * Agreement or Microsoft Customer Agreement. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByIdWithResponseAsync(String invoiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (invoiceName == null) { + return Mono.error(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.getById(this.client.getEndpoint(), apiVersion, invoiceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner + * Agreement or Microsoft Customer Agreement. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByIdWithResponseAsync(String invoiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (invoiceName == null) { + return Mono.error(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getById(this.client.getEndpoint(), apiVersion, invoiceName, accept, context); + } + + /** + * Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner + * Agreement or Microsoft Customer Agreement. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByIdAsync(String invoiceName) { + return getByIdWithResponseAsync(invoiceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner + * Agreement or Microsoft Customer Agreement. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InvoiceInner getById(String invoiceName) { + return getByIdAsync(invoiceName).block(); + } + + /** + * Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner + * Agreement or Microsoft Customer Agreement. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByIdWithResponse(String invoiceName, Context context) { + return getByIdWithResponseAsync(invoiceName, context).block(); + } + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft + * Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> downloadInvoiceWithResponseAsync( + String billingAccountName, String invoiceName, String downloadToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (invoiceName == null) { + return Mono.error(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); + } + if (downloadToken == null) { + return Mono.error(new IllegalArgumentException("Parameter downloadToken is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .downloadInvoice( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + invoiceName, + downloadToken, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft + * Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> downloadInvoiceWithResponseAsync( + String billingAccountName, String invoiceName, String downloadToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (invoiceName == null) { + return Mono.error(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); + } + if (downloadToken == null) { + return Mono.error(new IllegalArgumentException("Parameter downloadToken is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .downloadInvoice( + this.client.getEndpoint(), apiVersion, billingAccountName, invoiceName, downloadToken, accept, context); + } + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft + * Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DownloadUrlInner> beginDownloadInvoiceAsync( + String billingAccountName, String invoiceName, String downloadToken) { + Mono>> mono = + downloadInvoiceWithResponseAsync(billingAccountName, invoiceName, downloadToken); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DownloadUrlInner.class, DownloadUrlInner.class, Context.NONE); + } + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft + * Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DownloadUrlInner> beginDownloadInvoiceAsync( + String billingAccountName, String invoiceName, String downloadToken, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + downloadInvoiceWithResponseAsync(billingAccountName, invoiceName, downloadToken, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DownloadUrlInner.class, DownloadUrlInner.class, context); + } + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft + * Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DownloadUrlInner> beginDownloadInvoice( + String billingAccountName, String invoiceName, String downloadToken) { + return beginDownloadInvoiceAsync(billingAccountName, invoiceName, downloadToken).getSyncPoller(); + } + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft + * Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DownloadUrlInner> beginDownloadInvoice( + String billingAccountName, String invoiceName, String downloadToken, Context context) { + return beginDownloadInvoiceAsync(billingAccountName, invoiceName, downloadToken, context).getSyncPoller(); + } + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft + * Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono downloadInvoiceAsync( + String billingAccountName, String invoiceName, String downloadToken) { + return beginDownloadInvoiceAsync(billingAccountName, invoiceName, downloadToken) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft + * Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono downloadInvoiceAsync( + String billingAccountName, String invoiceName, String downloadToken, Context context) { + return beginDownloadInvoiceAsync(billingAccountName, invoiceName, downloadToken, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft + * Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DownloadUrlInner downloadInvoice(String billingAccountName, String invoiceName, String downloadToken) { + return downloadInvoiceAsync(billingAccountName, invoiceName, downloadToken).block(); + } + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft + * Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DownloadUrlInner downloadInvoice( + String billingAccountName, String invoiceName, String downloadToken, Context context) { + return downloadInvoiceAsync(billingAccountName, invoiceName, downloadToken, context).block(); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The + * operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> downloadMultipleBillingProfileInvoicesWithResponseAsync( + String billingAccountName, List downloadUrls) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (downloadUrls == null) { + return Mono.error(new IllegalArgumentException("Parameter downloadUrls is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .downloadMultipleBillingProfileInvoices( + this.client.getEndpoint(), apiVersion, billingAccountName, downloadUrls, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The + * operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> downloadMultipleBillingProfileInvoicesWithResponseAsync( + String billingAccountName, List downloadUrls, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (downloadUrls == null) { + return Mono.error(new IllegalArgumentException("Parameter downloadUrls is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .downloadMultipleBillingProfileInvoices( + this.client.getEndpoint(), apiVersion, billingAccountName, downloadUrls, accept, context); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The + * operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DownloadUrlInner> beginDownloadMultipleBillingProfileInvoicesAsync( + String billingAccountName, List downloadUrls) { + Mono>> mono = + downloadMultipleBillingProfileInvoicesWithResponseAsync(billingAccountName, downloadUrls); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DownloadUrlInner.class, DownloadUrlInner.class, Context.NONE); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The + * operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DownloadUrlInner> beginDownloadMultipleBillingProfileInvoicesAsync( + String billingAccountName, List downloadUrls, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + downloadMultipleBillingProfileInvoicesWithResponseAsync(billingAccountName, downloadUrls, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DownloadUrlInner.class, DownloadUrlInner.class, context); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The + * operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DownloadUrlInner> beginDownloadMultipleBillingProfileInvoices( + String billingAccountName, List downloadUrls) { + return beginDownloadMultipleBillingProfileInvoicesAsync(billingAccountName, downloadUrls).getSyncPoller(); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The + * operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DownloadUrlInner> beginDownloadMultipleBillingProfileInvoices( + String billingAccountName, List downloadUrls, Context context) { + return beginDownloadMultipleBillingProfileInvoicesAsync(billingAccountName, downloadUrls, context) + .getSyncPoller(); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The + * operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono downloadMultipleBillingProfileInvoicesAsync( + String billingAccountName, List downloadUrls) { + return beginDownloadMultipleBillingProfileInvoicesAsync(billingAccountName, downloadUrls) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The + * operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono downloadMultipleBillingProfileInvoicesAsync( + String billingAccountName, List downloadUrls, Context context) { + return beginDownloadMultipleBillingProfileInvoicesAsync(billingAccountName, downloadUrls, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The + * operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DownloadUrlInner downloadMultipleBillingProfileInvoices( + String billingAccountName, List downloadUrls) { + return downloadMultipleBillingProfileInvoicesAsync(billingAccountName, downloadUrls).block(); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The + * operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DownloadUrlInner downloadMultipleBillingProfileInvoices( + String billingAccountName, List downloadUrls, Context context) { + return downloadMultipleBillingProfileInvoicesAsync(billingAccountName, downloadUrls, context).block(); + } + + /** + * Lists the invoices for a subscription. + * + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingSubscriptionSinglePageAsync( + String periodStartDate, String periodEndDate) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (periodStartDate == null) { + return Mono + .error(new IllegalArgumentException("Parameter periodStartDate is required and cannot be null.")); + } + if (periodEndDate == null) { + return Mono.error(new IllegalArgumentException("Parameter periodEndDate is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBillingSubscription( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + periodStartDate, + periodEndDate, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the invoices for a subscription. + * + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingSubscriptionSinglePageAsync( + String periodStartDate, String periodEndDate, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (periodStartDate == null) { + return Mono + .error(new IllegalArgumentException("Parameter periodStartDate is required and cannot be null.")); + } + if (periodEndDate == null) { + return Mono.error(new IllegalArgumentException("Parameter periodEndDate is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingSubscription( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + periodStartDate, + periodEndDate, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the invoices for a subscription. + * + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingSubscriptionAsync(String periodStartDate, String periodEndDate) { + return new PagedFlux<>( + () -> listByBillingSubscriptionSinglePageAsync(periodStartDate, periodEndDate), + nextLink -> listByBillingSubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists the invoices for a subscription. + * + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingSubscriptionAsync( + String periodStartDate, String periodEndDate, Context context) { + return new PagedFlux<>( + () -> listByBillingSubscriptionSinglePageAsync(periodStartDate, periodEndDate, context), + nextLink -> listByBillingSubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the invoices for a subscription. + * + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingSubscription(String periodStartDate, String periodEndDate) { + return new PagedIterable<>(listByBillingSubscriptionAsync(periodStartDate, periodEndDate)); + } + + /** + * Lists the invoices for a subscription. + * + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingSubscription( + String periodStartDate, String periodEndDate, Context context) { + return new PagedIterable<>(listByBillingSubscriptionAsync(periodStartDate, periodEndDate, context)); + } + + /** + * Gets an invoice by subscription ID and invoice ID. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by subscription ID and invoice ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getBySubscriptionAndInvoiceIdWithResponseAsync(String invoiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (invoiceName == null) { + return Mono.error(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getBySubscriptionAndInvoiceId( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + invoiceName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an invoice by subscription ID and invoice ID. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by subscription ID and invoice ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getBySubscriptionAndInvoiceIdWithResponseAsync( + String invoiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (invoiceName == null) { + return Mono.error(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getBySubscriptionAndInvoiceId( + this.client.getEndpoint(), this.client.getSubscriptionId(), invoiceName, apiVersion, accept, context); + } + + /** + * Gets an invoice by subscription ID and invoice ID. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by subscription ID and invoice ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getBySubscriptionAndInvoiceIdAsync(String invoiceName) { + return getBySubscriptionAndInvoiceIdWithResponseAsync(invoiceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an invoice by subscription ID and invoice ID. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by subscription ID and invoice ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InvoiceInner getBySubscriptionAndInvoiceId(String invoiceName) { + return getBySubscriptionAndInvoiceIdAsync(invoiceName).block(); + } + + /** + * Gets an invoice by subscription ID and invoice ID. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by subscription ID and invoice ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getBySubscriptionAndInvoiceIdWithResponse(String invoiceName, Context context) { + return getBySubscriptionAndInvoiceIdWithResponseAsync(invoiceName, context).block(); + } + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> downloadBillingSubscriptionInvoiceWithResponseAsync( + String invoiceName, String downloadToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (invoiceName == null) { + return Mono.error(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); + } + if (downloadToken == null) { + return Mono.error(new IllegalArgumentException("Parameter downloadToken is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .downloadBillingSubscriptionInvoice( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + invoiceName, + downloadToken, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> downloadBillingSubscriptionInvoiceWithResponseAsync( + String invoiceName, String downloadToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (invoiceName == null) { + return Mono.error(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); + } + if (downloadToken == null) { + return Mono.error(new IllegalArgumentException("Parameter downloadToken is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .downloadBillingSubscriptionInvoice( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + invoiceName, + downloadToken, + accept, + context); + } + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DownloadUrlInner> beginDownloadBillingSubscriptionInvoiceAsync( + String invoiceName, String downloadToken) { + Mono>> mono = + downloadBillingSubscriptionInvoiceWithResponseAsync(invoiceName, downloadToken); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DownloadUrlInner.class, DownloadUrlInner.class, Context.NONE); + } + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DownloadUrlInner> beginDownloadBillingSubscriptionInvoiceAsync( + String invoiceName, String downloadToken, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + downloadBillingSubscriptionInvoiceWithResponseAsync(invoiceName, downloadToken, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DownloadUrlInner.class, DownloadUrlInner.class, context); + } + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DownloadUrlInner> beginDownloadBillingSubscriptionInvoice( + String invoiceName, String downloadToken) { + return beginDownloadBillingSubscriptionInvoiceAsync(invoiceName, downloadToken).getSyncPoller(); + } + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DownloadUrlInner> beginDownloadBillingSubscriptionInvoice( + String invoiceName, String downloadToken, Context context) { + return beginDownloadBillingSubscriptionInvoiceAsync(invoiceName, downloadToken, context).getSyncPoller(); + } + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono downloadBillingSubscriptionInvoiceAsync(String invoiceName, String downloadToken) { + return beginDownloadBillingSubscriptionInvoiceAsync(invoiceName, downloadToken) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono downloadBillingSubscriptionInvoiceAsync( + String invoiceName, String downloadToken, Context context) { + return beginDownloadBillingSubscriptionInvoiceAsync(invoiceName, downloadToken, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DownloadUrlInner downloadBillingSubscriptionInvoice(String invoiceName, String downloadToken) { + return downloadBillingSubscriptionInvoiceAsync(invoiceName, downloadToken).block(); + } + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DownloadUrlInner downloadBillingSubscriptionInvoice( + String invoiceName, String downloadToken, Context context) { + return downloadBillingSubscriptionInvoiceAsync(invoiceName, downloadToken, context).block(); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> downloadMultipleBillingSubscriptionInvoicesWithResponseAsync( + List downloadUrls) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (downloadUrls == null) { + return Mono.error(new IllegalArgumentException("Parameter downloadUrls is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .downloadMultipleBillingSubscriptionInvoices( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + downloadUrls, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> downloadMultipleBillingSubscriptionInvoicesWithResponseAsync( + List downloadUrls, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (downloadUrls == null) { + return Mono.error(new IllegalArgumentException("Parameter downloadUrls is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .downloadMultipleBillingSubscriptionInvoices( + this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), downloadUrls, accept, context); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DownloadUrlInner> + beginDownloadMultipleBillingSubscriptionInvoicesAsync(List downloadUrls) { + Mono>> mono = + downloadMultipleBillingSubscriptionInvoicesWithResponseAsync(downloadUrls); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DownloadUrlInner.class, DownloadUrlInner.class, Context.NONE); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DownloadUrlInner> + beginDownloadMultipleBillingSubscriptionInvoicesAsync(List downloadUrls, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + downloadMultipleBillingSubscriptionInvoicesWithResponseAsync(downloadUrls, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DownloadUrlInner.class, DownloadUrlInner.class, context); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DownloadUrlInner> beginDownloadMultipleBillingSubscriptionInvoices( + List downloadUrls) { + return beginDownloadMultipleBillingSubscriptionInvoicesAsync(downloadUrls).getSyncPoller(); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DownloadUrlInner> beginDownloadMultipleBillingSubscriptionInvoices( + List downloadUrls, Context context) { + return beginDownloadMultipleBillingSubscriptionInvoicesAsync(downloadUrls, context).getSyncPoller(); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono downloadMultipleBillingSubscriptionInvoicesAsync(List downloadUrls) { + return beginDownloadMultipleBillingSubscriptionInvoicesAsync(downloadUrls) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono downloadMultipleBillingSubscriptionInvoicesAsync( + List downloadUrls, Context context) { + return beginDownloadMultipleBillingSubscriptionInvoicesAsync(downloadUrls, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DownloadUrlInner downloadMultipleBillingSubscriptionInvoices(List downloadUrls) { + return downloadMultipleBillingSubscriptionInvoicesAsync(downloadUrls).block(); + } + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DownloadUrlInner downloadMultipleBillingSubscriptionInvoices(List downloadUrls, Context context) { + return downloadMultipleBillingSubscriptionInvoicesAsync(downloadUrls, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByBillingAccountNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingAccountNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByBillingProfileNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingProfileNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingSubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByBillingSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingSubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingSubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoicesImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoicesImpl.java new file mode 100644 index 0000000000000..76d0d8511598a --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/InvoicesImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.InvoicesClient; +import com.azure.resourcemanager.billing.fluent.models.DownloadUrlInner; +import com.azure.resourcemanager.billing.fluent.models.InvoiceInner; +import com.azure.resourcemanager.billing.models.DownloadUrl; +import com.azure.resourcemanager.billing.models.Invoice; +import com.azure.resourcemanager.billing.models.Invoices; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.List; + +public final class InvoicesImpl implements Invoices { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InvoicesImpl.class); + + private final InvoicesClient innerClient; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + public InvoicesImpl(InvoicesClient innerClient, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByBillingAccount( + String billingAccountName, String periodStartDate, String periodEndDate) { + PagedIterable inner = + this.serviceClient().listByBillingAccount(billingAccountName, periodStartDate, periodEndDate); + return Utils.mapPage(inner, inner1 -> new InvoiceImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingAccount( + String billingAccountName, String periodStartDate, String periodEndDate, Context context) { + PagedIterable inner = + this.serviceClient().listByBillingAccount(billingAccountName, periodStartDate, periodEndDate, context); + return Utils.mapPage(inner, inner1 -> new InvoiceImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate) { + PagedIterable inner = + this + .serviceClient() + .listByBillingProfile(billingAccountName, billingProfileName, periodStartDate, periodEndDate); + return Utils.mapPage(inner, inner1 -> new InvoiceImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingProfile( + String billingAccountName, + String billingProfileName, + String periodStartDate, + String periodEndDate, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByBillingProfile(billingAccountName, billingProfileName, periodStartDate, periodEndDate, context); + return Utils.mapPage(inner, inner1 -> new InvoiceImpl(inner1, this.manager())); + } + + public Invoice get(String billingAccountName, String invoiceName) { + InvoiceInner inner = this.serviceClient().get(billingAccountName, invoiceName); + if (inner != null) { + return new InvoiceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String billingAccountName, String invoiceName, Context context) { + Response inner = this.serviceClient().getWithResponse(billingAccountName, invoiceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new InvoiceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Invoice getById(String invoiceName) { + InvoiceInner inner = this.serviceClient().getById(invoiceName); + if (inner != null) { + return new InvoiceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByIdWithResponse(String invoiceName, Context context) { + Response inner = this.serviceClient().getByIdWithResponse(invoiceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new InvoiceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DownloadUrl downloadInvoice(String billingAccountName, String invoiceName, String downloadToken) { + DownloadUrlInner inner = this.serviceClient().downloadInvoice(billingAccountName, invoiceName, downloadToken); + if (inner != null) { + return new DownloadUrlImpl(inner, this.manager()); + } else { + return null; + } + } + + public DownloadUrl downloadInvoice( + String billingAccountName, String invoiceName, String downloadToken, Context context) { + DownloadUrlInner inner = + this.serviceClient().downloadInvoice(billingAccountName, invoiceName, downloadToken, context); + if (inner != null) { + return new DownloadUrlImpl(inner, this.manager()); + } else { + return null; + } + } + + public DownloadUrl downloadMultipleBillingProfileInvoices(String billingAccountName, List downloadUrls) { + DownloadUrlInner inner = + this.serviceClient().downloadMultipleBillingProfileInvoices(billingAccountName, downloadUrls); + if (inner != null) { + return new DownloadUrlImpl(inner, this.manager()); + } else { + return null; + } + } + + public DownloadUrl downloadMultipleBillingProfileInvoices( + String billingAccountName, List downloadUrls, Context context) { + DownloadUrlInner inner = + this.serviceClient().downloadMultipleBillingProfileInvoices(billingAccountName, downloadUrls, context); + if (inner != null) { + return new DownloadUrlImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByBillingSubscription(String periodStartDate, String periodEndDate) { + PagedIterable inner = + this.serviceClient().listByBillingSubscription(periodStartDate, periodEndDate); + return Utils.mapPage(inner, inner1 -> new InvoiceImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingSubscription( + String periodStartDate, String periodEndDate, Context context) { + PagedIterable inner = + this.serviceClient().listByBillingSubscription(periodStartDate, periodEndDate, context); + return Utils.mapPage(inner, inner1 -> new InvoiceImpl(inner1, this.manager())); + } + + public Invoice getBySubscriptionAndInvoiceId(String invoiceName) { + InvoiceInner inner = this.serviceClient().getBySubscriptionAndInvoiceId(invoiceName); + if (inner != null) { + return new InvoiceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getBySubscriptionAndInvoiceIdWithResponse(String invoiceName, Context context) { + Response inner = + this.serviceClient().getBySubscriptionAndInvoiceIdWithResponse(invoiceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new InvoiceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DownloadUrl downloadBillingSubscriptionInvoice(String invoiceName, String downloadToken) { + DownloadUrlInner inner = this.serviceClient().downloadBillingSubscriptionInvoice(invoiceName, downloadToken); + if (inner != null) { + return new DownloadUrlImpl(inner, this.manager()); + } else { + return null; + } + } + + public DownloadUrl downloadBillingSubscriptionInvoice(String invoiceName, String downloadToken, Context context) { + DownloadUrlInner inner = + this.serviceClient().downloadBillingSubscriptionInvoice(invoiceName, downloadToken, context); + if (inner != null) { + return new DownloadUrlImpl(inner, this.manager()); + } else { + return null; + } + } + + public DownloadUrl downloadMultipleBillingSubscriptionInvoices(List downloadUrls) { + DownloadUrlInner inner = this.serviceClient().downloadMultipleBillingSubscriptionInvoices(downloadUrls); + if (inner != null) { + return new DownloadUrlImpl(inner, this.manager()); + } else { + return null; + } + } + + public DownloadUrl downloadMultipleBillingSubscriptionInvoices(List downloadUrls, Context context) { + DownloadUrlInner inner = + this.serviceClient().downloadMultipleBillingSubscriptionInvoices(downloadUrls, context); + if (inner != null) { + return new DownloadUrlImpl(inner, this.manager()); + } else { + return null; + } + } + + private InvoicesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/OperationImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/OperationImpl.java new file mode 100644 index 0000000000000..453842b1818e1 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/OperationImpl.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.OperationInner; +import com.azure.resourcemanager.billing.models.Operation; +import com.azure.resourcemanager.billing.models.OperationDisplay; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/OperationsClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..2c8dd394d526c --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/OperationsClientImpl.java @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.OperationsClient; +import com.azure.resourcemanager.billing.fluent.models.OperationInner; +import com.azure.resourcemanager.billing.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final BillingManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(BillingManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BillingManagementClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BillingManagementCli") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the available billing REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing operations and a URL link to get the next set of results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the available billing REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing operations and a URL link to get the next set of results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the available billing REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing operations and a URL link to get the next set of results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the available billing REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing operations and a URL link to get the next set of results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the available billing REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing operations and a URL link to get the next set of results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists the available billing REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing operations and a URL link to get the next set of results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing operations and a URL link to get the next set of results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing operations and a URL link to get the next set of results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/OperationsImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..03e76f1aa0999 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/OperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.OperationsClient; +import com.azure.resourcemanager.billing.fluent.models.OperationInner; +import com.azure.resourcemanager.billing.models.Operation; +import com.azure.resourcemanager.billing.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/PoliciesClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/PoliciesClientImpl.java new file mode 100644 index 0000000000000..d96b4f5761a07 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/PoliciesClientImpl.java @@ -0,0 +1,704 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.PoliciesClient; +import com.azure.resourcemanager.billing.fluent.models.CustomerPolicyInner; +import com.azure.resourcemanager.billing.fluent.models.PolicyInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PoliciesClient. */ +public final class PoliciesClientImpl implements PoliciesClient { + private final ClientLogger logger = new ClientLogger(PoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PoliciesService service; + + /** The service client containing this operation class. */ + private final BillingManagementClientImpl client; + + /** + * Initializes an instance of PoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PoliciesClientImpl(BillingManagementClientImpl client) { + this.service = RestProxy.create(PoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BillingManagementClientPolicies to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BillingManagementCli") + private interface PoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/policies/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByBillingProfile( + @HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/policies/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @BodyParam("application/json") PolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies" + + "/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByCustomer( + @HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("customerName") String customerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies" + + "/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateCustomer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("customerName") String customerName, + @BodyParam("application/json") CustomerPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the policies for a billing profile. This operation is supported only for billing accounts with agreement + * type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByBillingProfileWithResponseAsync( + String billingAccountName, String billingProfileName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByBillingProfile( + this.client.getEndpoint(), + billingAccountName, + billingProfileName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the policies for a billing profile. This operation is supported only for billing accounts with agreement + * type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByBillingProfileWithResponseAsync( + String billingAccountName, String billingProfileName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByBillingProfile( + this.client.getEndpoint(), billingAccountName, billingProfileName, apiVersion, accept, context); + } + + /** + * Lists the policies for a billing profile. This operation is supported only for billing accounts with agreement + * type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByBillingProfileAsync(String billingAccountName, String billingProfileName) { + return getByBillingProfileWithResponseAsync(billingAccountName, billingProfileName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the policies for a billing profile. This operation is supported only for billing accounts with agreement + * type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PolicyInner getByBillingProfile(String billingAccountName, String billingProfileName) { + return getByBillingProfileAsync(billingAccountName, billingProfileName).block(); + } + + /** + * Lists the policies for a billing profile. This operation is supported only for billing accounts with agreement + * type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByBillingProfileWithResponse( + String billingAccountName, String billingProfileName, Context context) { + return getByBillingProfileWithResponseAsync(billingAccountName, billingProfileName, context).block(); + } + + /** + * Updates the policies for a billing profile. This operation is supported only for billing accounts with agreement + * type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters Request parameters that are provided to the update policies operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String billingAccountName, String billingProfileName, PolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the policies for a billing profile. This operation is supported only for billing accounts with agreement + * type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters Request parameters that are provided to the update policies operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String billingAccountName, String billingProfileName, PolicyInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + parameters, + accept, + context); + } + + /** + * Updates the policies for a billing profile. This operation is supported only for billing accounts with agreement + * type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters Request parameters that are provided to the update policies operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String billingAccountName, String billingProfileName, PolicyInner parameters) { + return updateWithResponseAsync(billingAccountName, billingProfileName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates the policies for a billing profile. This operation is supported only for billing accounts with agreement + * type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters Request parameters that are provided to the update policies operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PolicyInner update(String billingAccountName, String billingProfileName, PolicyInner parameters) { + return updateAsync(billingAccountName, billingProfileName, parameters).block(); + } + + /** + * Updates the policies for a billing profile. This operation is supported only for billing accounts with agreement + * type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters Request parameters that are provided to the update policies operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String billingAccountName, String billingProfileName, PolicyInner parameters, Context context) { + return updateWithResponseAsync(billingAccountName, billingProfileName, parameters, context).block(); + } + + /** + * Lists the policies for a customer. This operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the customer's Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByCustomerWithResponseAsync( + String billingAccountName, String customerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (customerName == null) { + return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByCustomer( + this.client.getEndpoint(), billingAccountName, customerName, apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the policies for a customer. This operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the customer's Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByCustomerWithResponseAsync( + String billingAccountName, String customerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (customerName == null) { + return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByCustomer(this.client.getEndpoint(), billingAccountName, customerName, apiVersion, accept, context); + } + + /** + * Lists the policies for a customer. This operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the customer's Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByCustomerAsync(String billingAccountName, String customerName) { + return getByCustomerWithResponseAsync(billingAccountName, customerName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the policies for a customer. This operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the customer's Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomerPolicyInner getByCustomer(String billingAccountName, String customerName) { + return getByCustomerAsync(billingAccountName, customerName).block(); + } + + /** + * Lists the policies for a customer. This operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the customer's Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByCustomerWithResponse( + String billingAccountName, String customerName, Context context) { + return getByCustomerWithResponseAsync(billingAccountName, customerName, context).block(); + } + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param parameters Request parameters that are provided to the update policies operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the customer's Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateCustomerWithResponseAsync( + String billingAccountName, String customerName, CustomerPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (customerName == null) { + return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateCustomer( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + customerName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param parameters Request parameters that are provided to the update policies operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the customer's Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateCustomerWithResponseAsync( + String billingAccountName, String customerName, CustomerPolicyInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (customerName == null) { + return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateCustomer( + this.client.getEndpoint(), apiVersion, billingAccountName, customerName, parameters, accept, context); + } + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param parameters Request parameters that are provided to the update policies operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the customer's Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateCustomerAsync( + String billingAccountName, String customerName, CustomerPolicyInner parameters) { + return updateCustomerWithResponseAsync(billingAccountName, customerName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param parameters Request parameters that are provided to the update policies operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the customer's Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CustomerPolicyInner updateCustomer( + String billingAccountName, String customerName, CustomerPolicyInner parameters) { + return updateCustomerAsync(billingAccountName, customerName, parameters).block(); + } + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param parameters Request parameters that are provided to the update policies operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the customer's Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateCustomerWithResponse( + String billingAccountName, String customerName, CustomerPolicyInner parameters, Context context) { + return updateCustomerWithResponseAsync(billingAccountName, customerName, parameters, context).block(); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/PoliciesImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/PoliciesImpl.java new file mode 100644 index 0000000000000..5ff31524a507f --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/PoliciesImpl.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.PoliciesClient; +import com.azure.resourcemanager.billing.fluent.models.CustomerPolicyInner; +import com.azure.resourcemanager.billing.fluent.models.PolicyInner; +import com.azure.resourcemanager.billing.models.CustomerPolicy; +import com.azure.resourcemanager.billing.models.Policies; +import com.azure.resourcemanager.billing.models.Policy; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PoliciesImpl implements Policies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PoliciesImpl.class); + + private final PoliciesClient innerClient; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + public PoliciesImpl(PoliciesClient innerClient, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Policy getByBillingProfile(String billingAccountName, String billingProfileName) { + PolicyInner inner = this.serviceClient().getByBillingProfile(billingAccountName, billingProfileName); + if (inner != null) { + return new PolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByBillingProfileWithResponse( + String billingAccountName, String billingProfileName, Context context) { + Response inner = + this.serviceClient().getByBillingProfileWithResponse(billingAccountName, billingProfileName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Policy update(String billingAccountName, String billingProfileName, PolicyInner parameters) { + PolicyInner inner = this.serviceClient().update(billingAccountName, billingProfileName, parameters); + if (inner != null) { + return new PolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String billingAccountName, String billingProfileName, PolicyInner parameters, Context context) { + Response inner = + this.serviceClient().updateWithResponse(billingAccountName, billingProfileName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CustomerPolicy getByCustomer(String billingAccountName, String customerName) { + CustomerPolicyInner inner = this.serviceClient().getByCustomer(billingAccountName, customerName); + if (inner != null) { + return new CustomerPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByCustomerWithResponse( + String billingAccountName, String customerName, Context context) { + Response inner = + this.serviceClient().getByCustomerWithResponse(billingAccountName, customerName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CustomerPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CustomerPolicy updateCustomer( + String billingAccountName, String customerName, CustomerPolicyInner parameters) { + CustomerPolicyInner inner = this.serviceClient().updateCustomer(billingAccountName, customerName, parameters); + if (inner != null) { + return new CustomerPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateCustomerWithResponse( + String billingAccountName, String customerName, CustomerPolicyInner parameters, Context context) { + Response inner = + this.serviceClient().updateCustomerWithResponse(billingAccountName, customerName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CustomerPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private PoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/PolicyImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/PolicyImpl.java new file mode 100644 index 0000000000000..082c8eb531013 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/PolicyImpl.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.PolicyInner; +import com.azure.resourcemanager.billing.models.MarketplacePurchasesPolicy; +import com.azure.resourcemanager.billing.models.Policy; +import com.azure.resourcemanager.billing.models.ReservationPurchasesPolicy; +import com.azure.resourcemanager.billing.models.ViewChargesPolicy; + +public final class PolicyImpl implements Policy { + private PolicyInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + PolicyImpl(PolicyInner innerObject, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public MarketplacePurchasesPolicy marketplacePurchases() { + return this.innerModel().marketplacePurchases(); + } + + public ReservationPurchasesPolicy reservationPurchases() { + return this.innerModel().reservationPurchases(); + } + + public ViewChargesPolicy viewCharges() { + return this.innerModel().viewCharges(); + } + + public PolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ProductImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ProductImpl.java new file mode 100644 index 0000000000000..fc58f601ea94d --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ProductImpl.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.ProductInner; +import com.azure.resourcemanager.billing.models.Amount; +import com.azure.resourcemanager.billing.models.AutoRenew; +import com.azure.resourcemanager.billing.models.BillingFrequency; +import com.azure.resourcemanager.billing.models.Product; +import com.azure.resourcemanager.billing.models.ProductStatusType; +import com.azure.resourcemanager.billing.models.Reseller; +import java.time.OffsetDateTime; + +public final class ProductImpl implements Product { + private ProductInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + ProductImpl(ProductInner innerObject, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public AutoRenew autoRenew() { + return this.innerModel().autoRenew(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public OffsetDateTime purchaseDate() { + return this.innerModel().purchaseDate(); + } + + public String productTypeId() { + return this.innerModel().productTypeId(); + } + + public String productType() { + return this.innerModel().productType(); + } + + public ProductStatusType status() { + return this.innerModel().status(); + } + + public OffsetDateTime endDate() { + return this.innerModel().endDate(); + } + + public BillingFrequency billingFrequency() { + return this.innerModel().billingFrequency(); + } + + public Amount lastCharge() { + return this.innerModel().lastCharge(); + } + + public OffsetDateTime lastChargeDate() { + return this.innerModel().lastChargeDate(); + } + + public Float quantity() { + return this.innerModel().quantity(); + } + + public String skuId() { + return this.innerModel().skuId(); + } + + public String skuDescription() { + return this.innerModel().skuDescription(); + } + + public String tenantId() { + return this.innerModel().tenantId(); + } + + public String availabilityId() { + return this.innerModel().availabilityId(); + } + + public String invoiceSectionId() { + return this.innerModel().invoiceSectionId(); + } + + public String invoiceSectionDisplayName() { + return this.innerModel().invoiceSectionDisplayName(); + } + + public String billingProfileId() { + return this.innerModel().billingProfileId(); + } + + public String billingProfileDisplayName() { + return this.innerModel().billingProfileDisplayName(); + } + + public String customerId() { + return this.innerModel().customerId(); + } + + public String customerDisplayName() { + return this.innerModel().customerDisplayName(); + } + + public Reseller reseller() { + return this.innerModel().reseller(); + } + + public ProductInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ProductsClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ProductsClientImpl.java new file mode 100644 index 0000000000000..0b77f71f1b359 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ProductsClientImpl.java @@ -0,0 +1,1909 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.ProductsClient; +import com.azure.resourcemanager.billing.fluent.models.ProductInner; +import com.azure.resourcemanager.billing.fluent.models.ValidateProductTransferEligibilityResultInner; +import com.azure.resourcemanager.billing.models.ProductsListResult; +import com.azure.resourcemanager.billing.models.ProductsMoveResponse; +import com.azure.resourcemanager.billing.models.TransferProductRequestProperties; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ProductsClient. */ +public final class ProductsClientImpl implements ProductsClient { + private final ClientLogger logger = new ClientLogger(ProductsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ProductsService service; + + /** The service client containing this operation class. */ + private final BillingManagementClientImpl client; + + /** + * Initializes an instance of ProductsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ProductsClientImpl(BillingManagementClientImpl client) { + this.service = RestProxy.create(ProductsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BillingManagementClientProducts to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BillingManagementCli") + private interface ProductsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/products") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCustomer( + @HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("customerName") String customerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingAccount( + @HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/products") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingProfile( + @HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/invoiceSections/{invoiceSectionName}/products") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInvoiceSection( + @HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("invoiceSectionName") String invoiceSectionName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("productName") String productName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("productName") String productName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ProductInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/move") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono move( + @HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("productName") String productName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") TransferProductRequestProperties parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}" + + "/validateMoveEligibility") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> validateMove( + @HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("productName") String productName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") TransferProductRequestProperties parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCustomerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingAccountNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingProfileNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInvoiceSectionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported + * only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCustomerSinglePageAsync( + String billingAccountName, String customerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (customerName == null) { + return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByCustomer( + this.client.getEndpoint(), billingAccountName, customerName, apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported + * only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCustomerSinglePageAsync( + String billingAccountName, String customerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (customerName == null) { + return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCustomer(this.client.getEndpoint(), billingAccountName, customerName, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported + * only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCustomerAsync(String billingAccountName, String customerName) { + return new PagedFlux<>( + () -> listByCustomerSinglePageAsync(billingAccountName, customerName), + nextLink -> listByCustomerNextSinglePageAsync(nextLink)); + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported + * only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCustomerAsync( + String billingAccountName, String customerName, Context context) { + return new PagedFlux<>( + () -> listByCustomerSinglePageAsync(billingAccountName, customerName, context), + nextLink -> listByCustomerNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported + * only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCustomer(String billingAccountName, String customerName) { + return new PagedIterable<>(listByCustomerAsync(billingAccountName, customerName)); + } + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported + * only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCustomer(String billingAccountName, String customerName, Context context) { + return new PagedIterable<>(listByCustomerAsync(billingAccountName, customerName, context)); + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is + * supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. + * It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value + * are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountSinglePageAsync( + String billingAccountName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBillingAccount( + this.client.getEndpoint(), billingAccountName, apiVersion, filter, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is + * supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. + * It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value + * are separated by a colon (:). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountSinglePageAsync( + String billingAccountName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingAccount(this.client.getEndpoint(), billingAccountName, apiVersion, filter, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is + * supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. + * It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value + * are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync(String billingAccountName, String filter) { + return new PagedFlux<>( + () -> listByBillingAccountSinglePageAsync(billingAccountName, filter), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is + * supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync(String billingAccountName) { + final String filter = null; + return new PagedFlux<>( + () -> listByBillingAccountSinglePageAsync(billingAccountName, filter), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is + * supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. + * It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value + * are separated by a colon (:). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync( + String billingAccountName, String filter, Context context) { + return new PagedFlux<>( + () -> listByBillingAccountSinglePageAsync(billingAccountName, filter, context), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is + * supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingAccount(String billingAccountName) { + final String filter = null; + return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, filter)); + } + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is + * supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. + * It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value + * are separated by a colon (:). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingAccount(String billingAccountName, String filter, Context context) { + return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, filter, context)); + } + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is + * supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. + * It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value + * are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileSinglePageAsync( + String billingAccountName, String billingProfileName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBillingProfile( + this.client.getEndpoint(), + billingAccountName, + billingProfileName, + apiVersion, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is + * supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. + * It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value + * are separated by a colon (:). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileSinglePageAsync( + String billingAccountName, String billingProfileName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingProfile( + this.client.getEndpoint(), billingAccountName, billingProfileName, apiVersion, filter, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is + * supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. + * It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value + * are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountName, String billingProfileName, String filter) { + return new PagedFlux<>( + () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, filter), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); + } + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is + * supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync(String billingAccountName, String billingProfileName) { + final String filter = null; + return new PagedFlux<>( + () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, filter), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); + } + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is + * supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. + * It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value + * are separated by a colon (:). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountName, String billingProfileName, String filter, Context context) { + return new PagedFlux<>( + () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, filter, context), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is + * supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName) { + final String filter = null; + return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, filter)); + } + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is + * supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. + * It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value + * are separated by a colon (:). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, String filter, Context context) { + return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, filter, context)); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. + * It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value + * are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceSectionSinglePageAsync( + String billingAccountName, String billingProfileName, String invoiceSectionName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInvoiceSection( + this.client.getEndpoint(), + billingAccountName, + billingProfileName, + invoiceSectionName, + apiVersion, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. + * It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value + * are separated by a colon (:). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceSectionSinglePageAsync( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInvoiceSection( + this.client.getEndpoint(), + billingAccountName, + billingProfileName, + invoiceSectionName, + apiVersion, + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. + * It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value + * are separated by a colon (:). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInvoiceSectionAsync( + String billingAccountName, String billingProfileName, String invoiceSectionName, String filter) { + return new PagedFlux<>( + () -> + listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName, filter), + nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink)); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInvoiceSectionAsync( + String billingAccountName, String billingProfileName, String invoiceSectionName) { + final String filter = null; + return new PagedFlux<>( + () -> + listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName, filter), + nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink)); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. + * It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value + * are separated by a colon (:). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInvoiceSectionAsync( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listByInvoiceSectionSinglePageAsync( + billingAccountName, billingProfileName, invoiceSectionName, filter, context), + nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName) { + final String filter = null; + return new PagedIterable<>( + listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, filter)); + } + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. + * It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value + * are separated by a colon (:). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInvoiceSection( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String filter, + Context context) { + return new PagedIterable<>( + listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, filter, context)); + } + + /** + * Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String billingAccountName, String productName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get(this.client.getEndpoint(), billingAccountName, productName, apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String billingAccountName, String productName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), billingAccountName, productName, apiVersion, accept, context); + } + + /** + * Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String billingAccountName, String productName) { + return getWithResponseAsync(billingAccountName, productName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProductInner get(String billingAccountName, String productName) { + return getAsync(billingAccountName, productName).block(); + } + + /** + * Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product by ID. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String billingAccountName, String productName, Context context) { + return getWithResponseAsync(billingAccountName, productName, context).block(); + } + + /** + * Updates the properties of a Product. Currently, auto renew can be updated. The operation is supported only for + * billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the update product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String billingAccountName, String productName, ProductInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + billingAccountName, + productName, + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the properties of a Product. Currently, auto renew can be updated. The operation is supported only for + * billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the update product operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String billingAccountName, String productName, ProductInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), billingAccountName, productName, apiVersion, parameters, accept, context); + } + + /** + * Updates the properties of a Product. Currently, auto renew can be updated. The operation is supported only for + * billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the update product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String billingAccountName, String productName, ProductInner parameters) { + return updateWithResponseAsync(billingAccountName, productName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates the properties of a Product. Currently, auto renew can be updated. The operation is supported only for + * billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the update product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProductInner update(String billingAccountName, String productName, ProductInner parameters) { + return updateAsync(billingAccountName, productName, parameters).block(); + } + + /** + * Updates the properties of a Product. Currently, auto renew can be updated. The operation is supported only for + * billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the update product operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String billingAccountName, String productName, ProductInner parameters, Context context) { + return updateWithResponseAsync(billingAccountName, productName, parameters, context).block(); + } + + /** + * Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported only for products that are purchased with a + * recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the move product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono moveWithResponseAsync( + String billingAccountName, String productName, TransferProductRequestProperties parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .move( + this.client.getEndpoint(), + billingAccountName, + productName, + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported only for products that are purchased with a + * recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the move product operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono moveWithResponseAsync( + String billingAccountName, String productName, TransferProductRequestProperties parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .move(this.client.getEndpoint(), billingAccountName, productName, apiVersion, parameters, accept, context); + } + + /** + * Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported only for products that are purchased with a + * recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the move product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono moveAsync( + String billingAccountName, String productName, TransferProductRequestProperties parameters) { + return moveWithResponseAsync(billingAccountName, productName, parameters) + .flatMap( + (ProductsMoveResponse res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported only for products that are purchased with a + * recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the move product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProductInner move( + String billingAccountName, String productName, TransferProductRequestProperties parameters) { + return moveAsync(billingAccountName, productName, parameters).block(); + } + + /** + * Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported only for products that are purchased with a + * recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the move product operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProductsMoveResponse moveWithResponse( + String billingAccountName, String productName, TransferProductRequestProperties parameters, Context context) { + return moveWithResponseAsync(billingAccountName, productName, parameters, context).block(); + } + + /** + * Validates if a product's charges can be moved to a new invoice section. This operation is supported only for + * products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft + * Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the validate move eligibility operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the product transfer eligibility validation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> validateMoveWithResponseAsync( + String billingAccountName, String productName, TransferProductRequestProperties parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .validateMove( + this.client.getEndpoint(), + billingAccountName, + productName, + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Validates if a product's charges can be moved to a new invoice section. This operation is supported only for + * products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft + * Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the validate move eligibility operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the product transfer eligibility validation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> validateMoveWithResponseAsync( + String billingAccountName, String productName, TransferProductRequestProperties parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (productName == null) { + return Mono.error(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .validateMove( + this.client.getEndpoint(), billingAccountName, productName, apiVersion, parameters, accept, context); + } + + /** + * Validates if a product's charges can be moved to a new invoice section. This operation is supported only for + * products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft + * Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the validate move eligibility operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the product transfer eligibility validation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono validateMoveAsync( + String billingAccountName, String productName, TransferProductRequestProperties parameters) { + return validateMoveWithResponseAsync(billingAccountName, productName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Validates if a product's charges can be moved to a new invoice section. This operation is supported only for + * products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft + * Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the validate move eligibility operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the product transfer eligibility validation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ValidateProductTransferEligibilityResultInner validateMove( + String billingAccountName, String productName, TransferProductRequestProperties parameters) { + return validateMoveAsync(billingAccountName, productName, parameters).block(); + } + + /** + * Validates if a product's charges can be moved to a new invoice section. This operation is supported only for + * products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft + * Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the validate move eligibility operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the product transfer eligibility validation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response validateMoveWithResponse( + String billingAccountName, String productName, TransferProductRequestProperties parameters, Context context) { + return validateMoveWithResponseAsync(billingAccountName, productName, parameters, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCustomerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByCustomerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCustomerNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCustomerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByBillingAccountNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingAccountNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByBillingProfileNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingProfileNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceSectionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByInvoiceSectionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceSectionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInvoiceSectionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ProductsImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ProductsImpl.java new file mode 100644 index 0000000000000..690758ee45534 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ProductsImpl.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.ProductsClient; +import com.azure.resourcemanager.billing.fluent.models.ProductInner; +import com.azure.resourcemanager.billing.fluent.models.ValidateProductTransferEligibilityResultInner; +import com.azure.resourcemanager.billing.models.Product; +import com.azure.resourcemanager.billing.models.Products; +import com.azure.resourcemanager.billing.models.ProductsMoveResponse; +import com.azure.resourcemanager.billing.models.TransferProductRequestProperties; +import com.azure.resourcemanager.billing.models.ValidateProductTransferEligibilityResult; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ProductsImpl implements Products { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProductsImpl.class); + + private final ProductsClient innerClient; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + public ProductsImpl(ProductsClient innerClient, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByCustomer(String billingAccountName, String customerName) { + PagedIterable inner = this.serviceClient().listByCustomer(billingAccountName, customerName); + return Utils.mapPage(inner, inner1 -> new ProductImpl(inner1, this.manager())); + } + + public PagedIterable listByCustomer(String billingAccountName, String customerName, Context context) { + PagedIterable inner = + this.serviceClient().listByCustomer(billingAccountName, customerName, context); + return Utils.mapPage(inner, inner1 -> new ProductImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingAccount(String billingAccountName) { + PagedIterable inner = this.serviceClient().listByBillingAccount(billingAccountName); + return Utils.mapPage(inner, inner1 -> new ProductImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingAccount(String billingAccountName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByBillingAccount(billingAccountName, filter, context); + return Utils.mapPage(inner, inner1 -> new ProductImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName) { + PagedIterable inner = + this.serviceClient().listByBillingProfile(billingAccountName, billingProfileName); + return Utils.mapPage(inner, inner1 -> new ProductImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByBillingProfile(billingAccountName, billingProfileName, filter, context); + return Utils.mapPage(inner, inner1 -> new ProductImpl(inner1, this.manager())); + } + + public PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName) { + PagedIterable inner = + this.serviceClient().listByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName); + return Utils.mapPage(inner, inner1 -> new ProductImpl(inner1, this.manager())); + } + + public PagedIterable listByInvoiceSection( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, filter, context); + return Utils.mapPage(inner, inner1 -> new ProductImpl(inner1, this.manager())); + } + + public Product get(String billingAccountName, String productName) { + ProductInner inner = this.serviceClient().get(billingAccountName, productName); + if (inner != null) { + return new ProductImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String billingAccountName, String productName, Context context) { + Response inner = this.serviceClient().getWithResponse(billingAccountName, productName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ProductImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Product update(String billingAccountName, String productName, ProductInner parameters) { + ProductInner inner = this.serviceClient().update(billingAccountName, productName, parameters); + if (inner != null) { + return new ProductImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String billingAccountName, String productName, ProductInner parameters, Context context) { + Response inner = + this.serviceClient().updateWithResponse(billingAccountName, productName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ProductImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Product move(String billingAccountName, String productName, TransferProductRequestProperties parameters) { + ProductInner inner = this.serviceClient().move(billingAccountName, productName, parameters); + if (inner != null) { + return new ProductImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response moveWithResponse( + String billingAccountName, String productName, TransferProductRequestProperties parameters, Context context) { + ProductsMoveResponse inner = + this.serviceClient().moveWithResponse(billingAccountName, productName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ProductImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ValidateProductTransferEligibilityResult validateMove( + String billingAccountName, String productName, TransferProductRequestProperties parameters) { + ValidateProductTransferEligibilityResultInner inner = + this.serviceClient().validateMove(billingAccountName, productName, parameters); + if (inner != null) { + return new ValidateProductTransferEligibilityResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response validateMoveWithResponse( + String billingAccountName, String productName, TransferProductRequestProperties parameters, Context context) { + Response inner = + this.serviceClient().validateMoveWithResponse(billingAccountName, productName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ValidateProductTransferEligibilityResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ProductsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ReservationImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ReservationImpl.java new file mode 100644 index 0000000000000..69d3939218821 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ReservationImpl.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.ReservationInner; +import com.azure.resourcemanager.billing.models.Reservation; +import com.azure.resourcemanager.billing.models.ReservationPropertyUtilization; +import com.azure.resourcemanager.billing.models.ReservationSkuProperty; +import java.util.Collections; +import java.util.List; + +public final class ReservationImpl implements Reservation { + private ReservationInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + ReservationImpl(ReservationInner innerObject, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public ReservationSkuProperty sku() { + return this.innerModel().sku(); + } + + public List appliedScopes() { + List inner = this.innerModel().appliedScopes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String appliedScopeType() { + return this.innerModel().appliedScopeType(); + } + + public String reservedResourceType() { + return this.innerModel().reservedResourceType(); + } + + public Float quantity() { + return this.innerModel().quantity(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String expiryDate() { + return this.innerModel().expiryDate(); + } + + public String provisioningSubState() { + return this.innerModel().provisioningSubState(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String displayProvisioningState() { + return this.innerModel().displayProvisioningState(); + } + + public String userFriendlyRenewState() { + return this.innerModel().userFriendlyRenewState(); + } + + public String userFriendlyAppliedScopeType() { + return this.innerModel().userFriendlyAppliedScopeType(); + } + + public String effectiveDateTime() { + return this.innerModel().effectiveDateTime(); + } + + public String skuDescription() { + return this.innerModel().skuDescription(); + } + + public String term() { + return this.innerModel().term(); + } + + public Boolean renew() { + return this.innerModel().renew(); + } + + public String renewSource() { + return this.innerModel().renewSource(); + } + + public ReservationPropertyUtilization utilization() { + return this.innerModel().utilization(); + } + + public ReservationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ReservationsClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ReservationsClientImpl.java new file mode 100644 index 0000000000000..bdf045472b21b --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ReservationsClientImpl.java @@ -0,0 +1,772 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.ReservationsClient; +import com.azure.resourcemanager.billing.fluent.models.ReservationInner; +import com.azure.resourcemanager.billing.models.ReservationsListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ReservationsClient. */ +public final class ReservationsClientImpl implements ReservationsClient { + private final ClientLogger logger = new ClientLogger(ReservationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ReservationsService service; + + /** The service client containing this operation class. */ + private final BillingManagementClientImpl client; + + /** + * Initializes an instance of ReservationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ReservationsClientImpl(BillingManagementClientImpl client) { + this.service = + RestProxy.create(ReservationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BillingManagementClientReservations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BillingManagementCli") + private interface ReservationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/reservations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingAccount( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @QueryParam("$filter") String filter, + @QueryParam("$orderby") String orderby, + @QueryParam("refreshsummary") String refreshsummary, + @QueryParam("selectedState") String selectedState, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}" + + "/reservations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingProfile( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @QueryParam("$filter") String filter, + @QueryParam("$orderby") String orderby, + @QueryParam("refreshsummary") String refreshsummary, + @QueryParam("selectedState") String selectedState, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingAccountNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBillingProfileNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the reservations for a billing account and the roll up counts of reservations group by provisioning states. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does + * not currently support 'ne', 'gt', 'le', 'ge', or 'not'. + * @param orderby May be used to sort order by reservation properties. + * @param refreshsummary To indicate whether to refresh the roll up counts of the reservations group by provisioning + * states. + * @param selectedState The selected provisioning state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountSinglePageAsync( + String billingAccountName, String filter, String orderby, String refreshsummary, String selectedState) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBillingAccount( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + filter, + orderby, + refreshsummary, + selectedState, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the reservations for a billing account and the roll up counts of reservations group by provisioning states. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does + * not currently support 'ne', 'gt', 'le', 'ge', or 'not'. + * @param orderby May be used to sort order by reservation properties. + * @param refreshsummary To indicate whether to refresh the roll up counts of the reservations group by provisioning + * states. + * @param selectedState The selected provisioning state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountSinglePageAsync( + String billingAccountName, + String filter, + String orderby, + String refreshsummary, + String selectedState, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingAccount( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + filter, + orderby, + refreshsummary, + selectedState, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the reservations for a billing account and the roll up counts of reservations group by provisioning states. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does + * not currently support 'ne', 'gt', 'le', 'ge', or 'not'. + * @param orderby May be used to sort order by reservation properties. + * @param refreshsummary To indicate whether to refresh the roll up counts of the reservations group by provisioning + * states. + * @param selectedState The selected provisioning state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync( + String billingAccountName, String filter, String orderby, String refreshsummary, String selectedState) { + return new PagedFlux<>( + () -> + listByBillingAccountSinglePageAsync(billingAccountName, filter, orderby, refreshsummary, selectedState), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists the reservations for a billing account and the roll up counts of reservations group by provisioning states. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync(String billingAccountName) { + final String filter = null; + final String orderby = null; + final String refreshsummary = null; + final String selectedState = null; + return new PagedFlux<>( + () -> + listByBillingAccountSinglePageAsync(billingAccountName, filter, orderby, refreshsummary, selectedState), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists the reservations for a billing account and the roll up counts of reservations group by provisioning states. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does + * not currently support 'ne', 'gt', 'le', 'ge', or 'not'. + * @param orderby May be used to sort order by reservation properties. + * @param refreshsummary To indicate whether to refresh the roll up counts of the reservations group by provisioning + * states. + * @param selectedState The selected provisioning state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync( + String billingAccountName, + String filter, + String orderby, + String refreshsummary, + String selectedState, + Context context) { + return new PagedFlux<>( + () -> + listByBillingAccountSinglePageAsync( + billingAccountName, filter, orderby, refreshsummary, selectedState, context), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the reservations for a billing account and the roll up counts of reservations group by provisioning states. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingAccount(String billingAccountName) { + final String filter = null; + final String orderby = null; + final String refreshsummary = null; + final String selectedState = null; + return new PagedIterable<>( + listByBillingAccountAsync(billingAccountName, filter, orderby, refreshsummary, selectedState)); + } + + /** + * Lists the reservations for a billing account and the roll up counts of reservations group by provisioning states. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does + * not currently support 'ne', 'gt', 'le', 'ge', or 'not'. + * @param orderby May be used to sort order by reservation properties. + * @param refreshsummary To indicate whether to refresh the roll up counts of the reservations group by provisioning + * states. + * @param selectedState The selected provisioning state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingAccount( + String billingAccountName, + String filter, + String orderby, + String refreshsummary, + String selectedState, + Context context) { + return new PagedIterable<>( + listByBillingAccountAsync(billingAccountName, filter, orderby, refreshsummary, selectedState, context)); + } + + /** + * Lists the reservations for a billing profile and the roll up counts of reservations group by provisioning state. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does + * not currently support 'ne', 'gt', 'le', 'ge', or 'not'. + * @param orderby May be used to sort order by reservation properties. + * @param refreshsummary To indicate whether to refresh the roll up counts of the reservations group by provisioning + * state. + * @param selectedState The selected provisioning state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileSinglePageAsync( + String billingAccountName, + String billingProfileName, + String filter, + String orderby, + String refreshsummary, + String selectedState) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByBillingProfile( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + filter, + orderby, + refreshsummary, + selectedState, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the reservations for a billing profile and the roll up counts of reservations group by provisioning state. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does + * not currently support 'ne', 'gt', 'le', 'ge', or 'not'. + * @param orderby May be used to sort order by reservation properties. + * @param refreshsummary To indicate whether to refresh the roll up counts of the reservations group by provisioning + * state. + * @param selectedState The selected provisioning state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileSinglePageAsync( + String billingAccountName, + String billingProfileName, + String filter, + String orderby, + String refreshsummary, + String selectedState, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingProfile( + this.client.getEndpoint(), + apiVersion, + billingAccountName, + billingProfileName, + filter, + orderby, + refreshsummary, + selectedState, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the reservations for a billing profile and the roll up counts of reservations group by provisioning state. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does + * not currently support 'ne', 'gt', 'le', 'ge', or 'not'. + * @param orderby May be used to sort order by reservation properties. + * @param refreshsummary To indicate whether to refresh the roll up counts of the reservations group by provisioning + * state. + * @param selectedState The selected provisioning state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountName, + String billingProfileName, + String filter, + String orderby, + String refreshsummary, + String selectedState) { + return new PagedFlux<>( + () -> + listByBillingProfileSinglePageAsync( + billingAccountName, billingProfileName, filter, orderby, refreshsummary, selectedState), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); + } + + /** + * Lists the reservations for a billing profile and the roll up counts of reservations group by provisioning state. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountName, String billingProfileName) { + final String filter = null; + final String orderby = null; + final String refreshsummary = null; + final String selectedState = null; + return new PagedFlux<>( + () -> + listByBillingProfileSinglePageAsync( + billingAccountName, billingProfileName, filter, orderby, refreshsummary, selectedState), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); + } + + /** + * Lists the reservations for a billing profile and the roll up counts of reservations group by provisioning state. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does + * not currently support 'ne', 'gt', 'le', 'ge', or 'not'. + * @param orderby May be used to sort order by reservation properties. + * @param refreshsummary To indicate whether to refresh the roll up counts of the reservations group by provisioning + * state. + * @param selectedState The selected provisioning state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync( + String billingAccountName, + String billingProfileName, + String filter, + String orderby, + String refreshsummary, + String selectedState, + Context context) { + return new PagedFlux<>( + () -> + listByBillingProfileSinglePageAsync( + billingAccountName, billingProfileName, filter, orderby, refreshsummary, selectedState, context), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the reservations for a billing profile and the roll up counts of reservations group by provisioning state. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName) { + final String filter = null; + final String orderby = null; + final String refreshsummary = null; + final String selectedState = null; + return new PagedIterable<>( + listByBillingProfileAsync( + billingAccountName, billingProfileName, filter, orderby, refreshsummary, selectedState)); + } + + /** + * Lists the reservations for a billing profile and the roll up counts of reservations group by provisioning state. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does + * not currently support 'ne', 'gt', 'le', 'ge', or 'not'. + * @param orderby May be used to sort order by reservation properties. + * @param refreshsummary To indicate whether to refresh the roll up counts of the reservations group by provisioning + * state. + * @param selectedState The selected provisioning state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingProfile( + String billingAccountName, + String billingProfileName, + String filter, + String orderby, + String refreshsummary, + String selectedState, + Context context) { + return new PagedIterable<>( + listByBillingProfileAsync( + billingAccountName, billingProfileName, filter, orderby, refreshsummary, selectedState, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByBillingAccountNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingAccountNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingAccountNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByBillingProfileNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBillingProfileNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByBillingProfileNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ReservationsImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ReservationsImpl.java new file mode 100644 index 0000000000000..fc3d09eebdf59 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ReservationsImpl.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.ReservationsClient; +import com.azure.resourcemanager.billing.fluent.models.ReservationInner; +import com.azure.resourcemanager.billing.models.Reservation; +import com.azure.resourcemanager.billing.models.Reservations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ReservationsImpl implements Reservations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReservationsImpl.class); + + private final ReservationsClient innerClient; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + public ReservationsImpl( + ReservationsClient innerClient, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByBillingAccount(String billingAccountName) { + PagedIterable inner = this.serviceClient().listByBillingAccount(billingAccountName); + return Utils.mapPage(inner, inner1 -> new ReservationImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingAccount( + String billingAccountName, + String filter, + String orderby, + String refreshsummary, + String selectedState, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByBillingAccount(billingAccountName, filter, orderby, refreshsummary, selectedState, context); + return Utils.mapPage(inner, inner1 -> new ReservationImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName) { + PagedIterable inner = + this.serviceClient().listByBillingProfile(billingAccountName, billingProfileName); + return Utils.mapPage(inner, inner1 -> new ReservationImpl(inner1, this.manager())); + } + + public PagedIterable listByBillingProfile( + String billingAccountName, + String billingProfileName, + String filter, + String orderby, + String refreshsummary, + String selectedState, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listByBillingProfile( + billingAccountName, billingProfileName, filter, orderby, refreshsummary, selectedState, context); + return Utils.mapPage(inner, inner1 -> new ReservationImpl(inner1, this.manager())); + } + + private ReservationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/TransactionImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/TransactionImpl.java new file mode 100644 index 0000000000000..0727972df9c85 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/TransactionImpl.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.TransactionInner; +import com.azure.resourcemanager.billing.models.Amount; +import com.azure.resourcemanager.billing.models.ReservationType; +import com.azure.resourcemanager.billing.models.Transaction; +import com.azure.resourcemanager.billing.models.TransactionTypeKind; +import java.time.OffsetDateTime; + +public final class TransactionImpl implements Transaction { + private TransactionInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + TransactionImpl(TransactionInner innerObject, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public TransactionTypeKind kind() { + return this.innerModel().kind(); + } + + public OffsetDateTime date() { + return this.innerModel().date(); + } + + public String invoice() { + return this.innerModel().invoice(); + } + + public String invoiceId() { + return this.innerModel().invoiceId(); + } + + public String orderId() { + return this.innerModel().orderId(); + } + + public String orderName() { + return this.innerModel().orderName(); + } + + public String productFamily() { + return this.innerModel().productFamily(); + } + + public String productTypeId() { + return this.innerModel().productTypeId(); + } + + public String productType() { + return this.innerModel().productType(); + } + + public String productDescription() { + return this.innerModel().productDescription(); + } + + public ReservationType transactionType() { + return this.innerModel().transactionType(); + } + + public Amount transactionAmount() { + return this.innerModel().transactionAmount(); + } + + public Integer quantity() { + return this.innerModel().quantity(); + } + + public String invoiceSectionId() { + return this.innerModel().invoiceSectionId(); + } + + public String invoiceSectionDisplayName() { + return this.innerModel().invoiceSectionDisplayName(); + } + + public String billingProfileId() { + return this.innerModel().billingProfileId(); + } + + public String billingProfileDisplayName() { + return this.innerModel().billingProfileDisplayName(); + } + + public String customerId() { + return this.innerModel().customerId(); + } + + public String customerDisplayName() { + return this.innerModel().customerDisplayName(); + } + + public String subscriptionId() { + return this.innerModel().subscriptionId(); + } + + public String subscriptionName() { + return this.innerModel().subscriptionName(); + } + + public String azurePlan() { + return this.innerModel().azurePlan(); + } + + public Amount azureCreditApplied() { + return this.innerModel().azureCreditApplied(); + } + + public String billingCurrency() { + return this.innerModel().billingCurrency(); + } + + public Float discount() { + return this.innerModel().discount(); + } + + public Amount effectivePrice() { + return this.innerModel().effectivePrice(); + } + + public Float exchangeRate() { + return this.innerModel().exchangeRate(); + } + + public Amount marketPrice() { + return this.innerModel().marketPrice(); + } + + public String pricingCurrency() { + return this.innerModel().pricingCurrency(); + } + + public OffsetDateTime servicePeriodStartDate() { + return this.innerModel().servicePeriodStartDate(); + } + + public OffsetDateTime servicePeriodEndDate() { + return this.innerModel().servicePeriodEndDate(); + } + + public Amount subTotal() { + return this.innerModel().subTotal(); + } + + public Amount tax() { + return this.innerModel().tax(); + } + + public String unitOfMeasure() { + return this.innerModel().unitOfMeasure(); + } + + public Float units() { + return this.innerModel().units(); + } + + public String unitType() { + return this.innerModel().unitType(); + } + + public TransactionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/TransactionsClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/TransactionsClientImpl.java new file mode 100644 index 0000000000000..a9fbee359a795 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/TransactionsClientImpl.java @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.TransactionsClient; +import com.azure.resourcemanager.billing.fluent.models.TransactionInner; +import com.azure.resourcemanager.billing.models.TransactionListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TransactionsClient. */ +public final class TransactionsClientImpl implements TransactionsClient { + private final ClientLogger logger = new ClientLogger(TransactionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TransactionsService service; + + /** The service client containing this operation class. */ + private final BillingManagementClientImpl client; + + /** + * Initializes an instance of TransactionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TransactionsClientImpl(BillingManagementClientImpl client) { + this.service = + RestProxy.create(TransactionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BillingManagementClientTransactions to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BillingManagementCli") + private interface TransactionsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/transactions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInvoice( + @HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("invoiceName") String invoiceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByInvoiceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of transactions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceSinglePageAsync( + String billingAccountName, String invoiceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (invoiceName == null) { + return Mono.error(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByInvoice( + this.client.getEndpoint(), billingAccountName, invoiceName, apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of transactions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceSinglePageAsync( + String billingAccountName, String invoiceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (invoiceName == null) { + return Mono.error(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); + } + final String apiVersion = "2020-05-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInvoice(this.client.getEndpoint(), billingAccountName, invoiceName, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of transactions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInvoiceAsync(String billingAccountName, String invoiceName) { + return new PagedFlux<>( + () -> listByInvoiceSinglePageAsync(billingAccountName, invoiceName), + nextLink -> listByInvoiceNextSinglePageAsync(nextLink)); + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of transactions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInvoiceAsync( + String billingAccountName, String invoiceName, Context context) { + return new PagedFlux<>( + () -> listByInvoiceSinglePageAsync(billingAccountName, invoiceName, context), + nextLink -> listByInvoiceNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of transactions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInvoice(String billingAccountName, String invoiceName) { + return new PagedIterable<>(listByInvoiceAsync(billingAccountName, invoiceName)); + } + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of transactions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByInvoice( + String billingAccountName, String invoiceName, Context context) { + return new PagedIterable<>(listByInvoiceAsync(billingAccountName, invoiceName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of transactions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByInvoiceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of transactions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByInvoiceNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByInvoiceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/TransactionsImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/TransactionsImpl.java new file mode 100644 index 0000000000000..5d505fc210586 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/TransactionsImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.TransactionsClient; +import com.azure.resourcemanager.billing.fluent.models.TransactionInner; +import com.azure.resourcemanager.billing.models.Transaction; +import com.azure.resourcemanager.billing.models.Transactions; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TransactionsImpl implements Transactions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TransactionsImpl.class); + + private final TransactionsClient innerClient; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + public TransactionsImpl( + TransactionsClient innerClient, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByInvoice(String billingAccountName, String invoiceName) { + PagedIterable inner = this.serviceClient().listByInvoice(billingAccountName, invoiceName); + return Utils.mapPage(inner, inner1 -> new TransactionImpl(inner1, this.manager())); + } + + public PagedIterable listByInvoice(String billingAccountName, String invoiceName, Context context) { + PagedIterable inner = + this.serviceClient().listByInvoice(billingAccountName, invoiceName, context); + return Utils.mapPage(inner, inner1 -> new TransactionImpl(inner1, this.manager())); + } + + private TransactionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/Utils.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/Utils.java new file mode 100644 index 0000000000000..0105faff013de --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ValidateAddressResponseImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ValidateAddressResponseImpl.java new file mode 100644 index 0000000000000..fc38d1c46bdd0 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ValidateAddressResponseImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.ValidateAddressResponseInner; +import com.azure.resourcemanager.billing.models.AddressDetails; +import com.azure.resourcemanager.billing.models.AddressValidationStatus; +import com.azure.resourcemanager.billing.models.ValidateAddressResponse; +import java.util.Collections; +import java.util.List; + +public final class ValidateAddressResponseImpl implements ValidateAddressResponse { + private ValidateAddressResponseInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + ValidateAddressResponseImpl( + ValidateAddressResponseInner innerObject, com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public AddressValidationStatus status() { + return this.innerModel().status(); + } + + public List suggestedAddresses() { + List inner = this.innerModel().suggestedAddresses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String validationMessage() { + return this.innerModel().validationMessage(); + } + + public ValidateAddressResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ValidateProductTransferEligibilityResultImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ValidateProductTransferEligibilityResultImpl.java new file mode 100644 index 0000000000000..294dfa24f0f74 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ValidateProductTransferEligibilityResultImpl.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.ValidateProductTransferEligibilityResultInner; +import com.azure.resourcemanager.billing.models.ValidateProductTransferEligibilityError; +import com.azure.resourcemanager.billing.models.ValidateProductTransferEligibilityResult; + +public final class ValidateProductTransferEligibilityResultImpl implements ValidateProductTransferEligibilityResult { + private ValidateProductTransferEligibilityResultInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + ValidateProductTransferEligibilityResultImpl( + ValidateProductTransferEligibilityResultInner innerObject, + com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean isMoveEligible() { + return this.innerModel().isMoveEligible(); + } + + public ValidateProductTransferEligibilityError errorDetails() { + return this.innerModel().errorDetails(); + } + + public ValidateProductTransferEligibilityResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ValidateSubscriptionTransferEligibilityResultImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ValidateSubscriptionTransferEligibilityResultImpl.java new file mode 100644 index 0000000000000..de1a9d1016898 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ValidateSubscriptionTransferEligibilityResultImpl.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.implementation; + +import com.azure.resourcemanager.billing.fluent.models.ValidateSubscriptionTransferEligibilityResultInner; +import com.azure.resourcemanager.billing.models.ValidateSubscriptionTransferEligibilityError; +import com.azure.resourcemanager.billing.models.ValidateSubscriptionTransferEligibilityResult; + +public final class ValidateSubscriptionTransferEligibilityResultImpl + implements ValidateSubscriptionTransferEligibilityResult { + private ValidateSubscriptionTransferEligibilityResultInner innerObject; + + private final com.azure.resourcemanager.billing.BillingManager serviceManager; + + ValidateSubscriptionTransferEligibilityResultImpl( + ValidateSubscriptionTransferEligibilityResultInner innerObject, + com.azure.resourcemanager.billing.BillingManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean isMoveEligible() { + return this.innerModel().isMoveEligible(); + } + + public ValidateSubscriptionTransferEligibilityError errorDetails() { + return this.innerModel().errorDetails(); + } + + public ValidateSubscriptionTransferEligibilityResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.billing.BillingManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/package-info.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/package-info.java new file mode 100644 index 0000000000000..067b2a6a57ccb --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for BillingManagementClient. Billing client provides access to billing + * resources for Azure subscriptions. + */ +package com.azure.resourcemanager.billing.implementation; diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AcceptanceMode.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AcceptanceMode.java new file mode 100644 index 0000000000000..107241a07f01e --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AcceptanceMode.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AcceptanceMode. */ +public final class AcceptanceMode extends ExpandableStringEnum { + /** Static value ClickToAccept for AcceptanceMode. */ + public static final AcceptanceMode CLICK_TO_ACCEPT = fromString("ClickToAccept"); + + /** Static value ESignEmbedded for AcceptanceMode. */ + public static final AcceptanceMode ESIGN_EMBEDDED = fromString("ESignEmbedded"); + + /** Static value ESignOffline for AcceptanceMode. */ + public static final AcceptanceMode ESIGN_OFFLINE = fromString("ESignOffline"); + + /** + * Creates or finds a AcceptanceMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding AcceptanceMode. + */ + @JsonCreator + public static AcceptanceMode fromString(String name) { + return fromString(name, AcceptanceMode.class); + } + + /** @return known AcceptanceMode values. */ + public static Collection values() { + return values(AcceptanceMode.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AccountStatus.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AccountStatus.java new file mode 100644 index 0000000000000..2ad647f69cfc6 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AccountStatus.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AccountStatus. */ +public final class AccountStatus extends ExpandableStringEnum { + /** Static value Active for AccountStatus. */ + public static final AccountStatus ACTIVE = fromString("Active"); + + /** Static value Deleted for AccountStatus. */ + public static final AccountStatus DELETED = fromString("Deleted"); + + /** Static value Disabled for AccountStatus. */ + public static final AccountStatus DISABLED = fromString("Disabled"); + + /** Static value Expired for AccountStatus. */ + public static final AccountStatus EXPIRED = fromString("Expired"); + + /** Static value Transferred for AccountStatus. */ + public static final AccountStatus TRANSFERRED = fromString("Transferred"); + + /** Static value Extended for AccountStatus. */ + public static final AccountStatus EXTENDED = fromString("Extended"); + + /** Static value Terminated for AccountStatus. */ + public static final AccountStatus TERMINATED = fromString("Terminated"); + + /** + * Creates or finds a AccountStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding AccountStatus. + */ + @JsonCreator + public static AccountStatus fromString(String name) { + return fromString(name, AccountStatus.class); + } + + /** @return known AccountStatus values. */ + public static Collection values() { + return values(AccountStatus.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AccountType.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AccountType.java new file mode 100644 index 0000000000000..5262257801eb1 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AccountType.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AccountType. */ +public final class AccountType extends ExpandableStringEnum { + /** Static value Enterprise for AccountType. */ + public static final AccountType ENTERPRISE = fromString("Enterprise"); + + /** Static value Individual for AccountType. */ + public static final AccountType INDIVIDUAL = fromString("Individual"); + + /** Static value Partner for AccountType. */ + public static final AccountType PARTNER = fromString("Partner"); + + /** + * Creates or finds a AccountType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AccountType. + */ + @JsonCreator + public static AccountType fromString(String name) { + return fromString(name, AccountType.class); + } + + /** @return known AccountType values. */ + public static Collection values() { + return values(AccountType.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Address.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Address.java new file mode 100644 index 0000000000000..b050b59356ac7 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Address.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Address. */ +public interface Address { + /** + * Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. + * + * @param address Address details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the address validation. + */ + ValidateAddressResponse validate(AddressDetails address); + + /** + * Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. + * + * @param address Address details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the address validation. + */ + Response validateWithResponse(AddressDetails address, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AddressDetails.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AddressDetails.java new file mode 100644 index 0000000000000..cae97a59a9610 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AddressDetails.java @@ -0,0 +1,372 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Address details. */ +@Fluent +public final class AddressDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AddressDetails.class); + + /* + * First name. + */ + @JsonProperty(value = "firstName") + private String firstName; + + /* + * Last name. + */ + @JsonProperty(value = "lastName") + private String lastName; + + /* + * Company name. + */ + @JsonProperty(value = "companyName") + private String companyName; + + /* + * Address line 1. + */ + @JsonProperty(value = "addressLine1", required = true) + private String addressLine1; + + /* + * Address line 2. + */ + @JsonProperty(value = "addressLine2") + private String addressLine2; + + /* + * Address line 3. + */ + @JsonProperty(value = "addressLine3") + private String addressLine3; + + /* + * Address city. + */ + @JsonProperty(value = "city") + private String city; + + /* + * Address district. + */ + @JsonProperty(value = "district") + private String district; + + /* + * Address region. + */ + @JsonProperty(value = "region") + private String region; + + /* + * Country code uses ISO2, 2-digit format. + */ + @JsonProperty(value = "country", required = true) + private String country; + + /* + * Postal code. + */ + @JsonProperty(value = "postalCode") + private String postalCode; + + /* + * Email address. + */ + @JsonProperty(value = "email") + private String email; + + /* + * Phone number. + */ + @JsonProperty(value = "phoneNumber") + private String phoneNumber; + + /** + * Get the firstName property: First name. + * + * @return the firstName value. + */ + public String firstName() { + return this.firstName; + } + + /** + * Set the firstName property: First name. + * + * @param firstName the firstName value to set. + * @return the AddressDetails object itself. + */ + public AddressDetails withFirstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get the lastName property: Last name. + * + * @return the lastName value. + */ + public String lastName() { + return this.lastName; + } + + /** + * Set the lastName property: Last name. + * + * @param lastName the lastName value to set. + * @return the AddressDetails object itself. + */ + public AddressDetails withLastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get the companyName property: Company name. + * + * @return the companyName value. + */ + public String companyName() { + return this.companyName; + } + + /** + * Set the companyName property: Company name. + * + * @param companyName the companyName value to set. + * @return the AddressDetails object itself. + */ + public AddressDetails withCompanyName(String companyName) { + this.companyName = companyName; + return this; + } + + /** + * Get the addressLine1 property: Address line 1. + * + * @return the addressLine1 value. + */ + public String addressLine1() { + return this.addressLine1; + } + + /** + * Set the addressLine1 property: Address line 1. + * + * @param addressLine1 the addressLine1 value to set. + * @return the AddressDetails object itself. + */ + public AddressDetails withAddressLine1(String addressLine1) { + this.addressLine1 = addressLine1; + return this; + } + + /** + * Get the addressLine2 property: Address line 2. + * + * @return the addressLine2 value. + */ + public String addressLine2() { + return this.addressLine2; + } + + /** + * Set the addressLine2 property: Address line 2. + * + * @param addressLine2 the addressLine2 value to set. + * @return the AddressDetails object itself. + */ + public AddressDetails withAddressLine2(String addressLine2) { + this.addressLine2 = addressLine2; + return this; + } + + /** + * Get the addressLine3 property: Address line 3. + * + * @return the addressLine3 value. + */ + public String addressLine3() { + return this.addressLine3; + } + + /** + * Set the addressLine3 property: Address line 3. + * + * @param addressLine3 the addressLine3 value to set. + * @return the AddressDetails object itself. + */ + public AddressDetails withAddressLine3(String addressLine3) { + this.addressLine3 = addressLine3; + return this; + } + + /** + * Get the city property: Address city. + * + * @return the city value. + */ + public String city() { + return this.city; + } + + /** + * Set the city property: Address city. + * + * @param city the city value to set. + * @return the AddressDetails object itself. + */ + public AddressDetails withCity(String city) { + this.city = city; + return this; + } + + /** + * Get the district property: Address district. + * + * @return the district value. + */ + public String district() { + return this.district; + } + + /** + * Set the district property: Address district. + * + * @param district the district value to set. + * @return the AddressDetails object itself. + */ + public AddressDetails withDistrict(String district) { + this.district = district; + return this; + } + + /** + * Get the region property: Address region. + * + * @return the region value. + */ + public String region() { + return this.region; + } + + /** + * Set the region property: Address region. + * + * @param region the region value to set. + * @return the AddressDetails object itself. + */ + public AddressDetails withRegion(String region) { + this.region = region; + return this; + } + + /** + * Get the country property: Country code uses ISO2, 2-digit format. + * + * @return the country value. + */ + public String country() { + return this.country; + } + + /** + * Set the country property: Country code uses ISO2, 2-digit format. + * + * @param country the country value to set. + * @return the AddressDetails object itself. + */ + public AddressDetails withCountry(String country) { + this.country = country; + return this; + } + + /** + * Get the postalCode property: Postal code. + * + * @return the postalCode value. + */ + public String postalCode() { + return this.postalCode; + } + + /** + * Set the postalCode property: Postal code. + * + * @param postalCode the postalCode value to set. + * @return the AddressDetails object itself. + */ + public AddressDetails withPostalCode(String postalCode) { + this.postalCode = postalCode; + return this; + } + + /** + * Get the email property: Email address. + * + * @return the email value. + */ + public String email() { + return this.email; + } + + /** + * Set the email property: Email address. + * + * @param email the email value to set. + * @return the AddressDetails object itself. + */ + public AddressDetails withEmail(String email) { + this.email = email; + return this; + } + + /** + * Get the phoneNumber property: Phone number. + * + * @return the phoneNumber value. + */ + public String phoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phoneNumber property: Phone number. + * + * @param phoneNumber the phoneNumber value to set. + * @return the AddressDetails object itself. + */ + public AddressDetails withPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (addressLine1() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property addressLine1 in model AddressDetails")); + } + if (country() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property country in model AddressDetails")); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AddressValidationStatus.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AddressValidationStatus.java new file mode 100644 index 0000000000000..f01461a546183 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AddressValidationStatus.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** 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/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Agreement.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Agreement.java new file mode 100644 index 0000000000000..e6a183f3a8f5c --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Agreement.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.AgreementInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of Agreement. */ +public interface Agreement { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the agreementLink property: The URL to download the agreement. + * + * @return the agreementLink value. + */ + String agreementLink(); + + /** + * Gets the category property: The category of the agreement signed by a customer. + * + * @return the category value. + */ + Category category(); + + /** + * Gets the acceptanceMode property: The mode of acceptance for an agreement. + * + * @return the acceptanceMode value. + */ + AcceptanceMode acceptanceMode(); + + /** + * Gets the effectiveDate property: The date from which the agreement is effective. + * + * @return the effectiveDate value. + */ + OffsetDateTime effectiveDate(); + + /** + * Gets the expirationDate property: The date when the agreement expires. + * + * @return the expirationDate value. + */ + OffsetDateTime expirationDate(); + + /** + * Gets the participants property: The list of participants that participates in acceptance of an agreement. + * + * @return the participants value. + */ + List participants(); + + /** + * Gets the status property: The current status of the agreement. + * + * @return the status value. + */ + String status(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.AgreementInner object. + * + * @return the inner object. + */ + AgreementInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AgreementListResult.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AgreementListResult.java new file mode 100644 index 0000000000000..211b66737c848 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AgreementListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.models.AgreementInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of listing agreements. */ +@Immutable +public final class AgreementListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AgreementListResult.class); + + /* + * The list of agreements. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of agreements. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AgreementType.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AgreementType.java new file mode 100644 index 0000000000000..4629aaa50fd05 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AgreementType.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AgreementType. */ +public final class AgreementType extends ExpandableStringEnum { + /** Static value MicrosoftCustomerAgreement for AgreementType. */ + public static final AgreementType MICROSOFT_CUSTOMER_AGREEMENT = fromString("MicrosoftCustomerAgreement"); + + /** Static value EnterpriseAgreement for AgreementType. */ + public static final AgreementType ENTERPRISE_AGREEMENT = fromString("EnterpriseAgreement"); + + /** Static value MicrosoftOnlineServicesProgram for AgreementType. */ + public static final AgreementType MICROSOFT_ONLINE_SERVICES_PROGRAM = fromString("MicrosoftOnlineServicesProgram"); + + /** Static value MicrosoftPartnerAgreement for AgreementType. */ + public static final AgreementType MICROSOFT_PARTNER_AGREEMENT = fromString("MicrosoftPartnerAgreement"); + + /** + * Creates or finds a AgreementType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AgreementType. + */ + @JsonCreator + public static AgreementType fromString(String name) { + return fromString(name, AgreementType.class); + } + + /** @return known AgreementType values. */ + public static Collection values() { + return values(AgreementType.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Agreements.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Agreements.java new file mode 100644 index 0000000000000..1585663af4687 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Agreements.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Agreements. */ +public interface Agreements { + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing agreements. + */ + PagedIterable listByBillingAccount(String billingAccountName); + + /** + * Lists the agreements for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the participants. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing agreements. + */ + PagedIterable listByBillingAccount(String billingAccountName, String expand, Context context); + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an agreement by ID. + */ + Agreement get(String billingAccountName, String agreementName); + + /** + * Gets an agreement by ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param agreementName The ID that uniquely identifies an agreement. + * @param expand May be used to expand the participants. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an agreement by ID. + */ + Response getWithResponse( + String billingAccountName, String agreementName, String expand, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Amount.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Amount.java new file mode 100644 index 0000000000000..e835dfc0d8f77 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Amount.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The amount. */ +@Fluent +public final class Amount { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Amount.class); + + /* + * The currency for the amount value. + */ + @JsonProperty(value = "currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /* + * Amount value. + */ + @JsonProperty(value = "value") + private Float value; + + /** + * Get the currency property: The currency for the amount value. + * + * @return the currency value. + */ + public String currency() { + return this.currency; + } + + /** + * Get the value property: Amount value. + * + * @return the value value. + */ + public Float value() { + return this.value; + } + + /** + * Set the value property: Amount value. + * + * @param value the value value to set. + * @return the Amount object itself. + */ + public Amount withValue(Float value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AutoRenew.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AutoRenew.java new file mode 100644 index 0000000000000..4cde432a75d3f --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AutoRenew.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AutoRenew. */ +public final class AutoRenew extends ExpandableStringEnum { + /** Static value Off for AutoRenew. */ + public static final AutoRenew OFF = fromString("Off"); + + /** Static value On for AutoRenew. */ + public static final AutoRenew ON = fromString("On"); + + /** + * Creates or finds a AutoRenew from its string representation. + * + * @param name a name to look for. + * @return the corresponding AutoRenew. + */ + @JsonCreator + public static AutoRenew fromString(String name) { + return fromString(name, AutoRenew.class); + } + + /** @return known AutoRenew values. */ + public static Collection values() { + return values(AutoRenew.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AvailableBalance.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AvailableBalance.java new file mode 100644 index 0000000000000..78bbb1e705d5f --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AvailableBalance.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.AvailableBalanceInner; + +/** An immutable client-side representation of AvailableBalance. */ +public interface AvailableBalance { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the amount property: Balance amount. + * + * @return the amount value. + */ + Amount amount(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.AvailableBalanceInner object. + * + * @return the inner object. + */ + AvailableBalanceInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AvailableBalances.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AvailableBalances.java new file mode 100644 index 0000000000000..db3cb67b29bba --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AvailableBalances.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of AvailableBalances. */ +public interface AvailableBalances { + /** + * The available credit balance for a billing profile. This is the balance that can be used for pay now to settle + * due or past due invoices. The operation is supported only for billing accounts with agreement type Microsoft + * Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the latest Azure credit balance. + */ + AvailableBalance get(String billingAccountName, String billingProfileName); + + /** + * The available credit balance for a billing profile. This is the balance that can be used for pay now to settle + * due or past due invoices. The operation is supported only for billing accounts with agreement type Microsoft + * Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the latest Azure credit balance. + */ + Response getWithResponse(String billingAccountName, String billingProfileName, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AzurePlan.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AzurePlan.java new file mode 100644 index 0000000000000..afd025f54c734 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/AzurePlan.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Details of the Azure plan. */ +@Fluent +public final class AzurePlan { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzurePlan.class); + + /* + * 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 skuId property: The sku id. + * + * @return the skuId value. + */ + public String skuId() { + return this.skuId; + } + + /** + * Set the skuId property: The sku id. + * + * @param skuId the skuId value to set. + * @return the AzurePlan object itself. + */ + public AzurePlan withSkuId(String skuId) { + this.skuId = skuId; + return this; + } + + /** + * Get the skuDescription property: The sku description. + * + * @return the skuDescription value. + */ + public String skuDescription() { + return this.skuDescription; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingAccount.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingAccount.java new file mode 100644 index 0000000000000..cce0f7dca2a1d --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingAccount.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.BillingAccountInner; +import java.util.List; + +/** An immutable client-side representation of BillingAccount. */ +public interface BillingAccount { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the displayName property: The billing account name. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the soldTo property: The address of the individual or organization that is responsible for the billing + * account. + * + * @return the soldTo value. + */ + AddressDetails soldTo(); + + /** + * Gets the agreementType property: The type of agreement. + * + * @return the agreementType value. + */ + AgreementType agreementType(); + + /** + * Gets the accountType property: The type of customer. + * + * @return the accountType value. + */ + AccountType accountType(); + + /** + * Gets the accountStatus property: The current status of the billing account. + * + * @return the accountStatus value. + */ + AccountStatus accountStatus(); + + /** + * Gets the billingProfiles property: The billing profiles associated with the billing account. By default this is + * not populated, unless it's specified in $expand. + * + * @return the billingProfiles value. + */ + BillingProfilesOnExpand billingProfiles(); + + /** + * Gets the enrollmentDetails property: The details about the associated legacy enrollment. By default this is not + * populated, unless it's specified in $expand. + * + * @return the enrollmentDetails value. + */ + Enrollment enrollmentDetails(); + + /** + * Gets the departments property: The departments associated to the enrollment. + * + * @return the departments value. + */ + List departments(); + + /** + * Gets the enrollmentAccounts property: The accounts associated to the enrollment. + * + * @return the enrollmentAccounts value. + */ + List enrollmentAccounts(); + + /** + * Gets the hasReadAccess property: Indicates whether user has read access to the billing account. + * + * @return the hasReadAccess value. + */ + Boolean hasReadAccess(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.BillingAccountInner object. + * + * @return the inner object. + */ + BillingAccountInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingAccountListResult.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingAccountListResult.java new file mode 100644 index 0000000000000..1e4830e58ee3b --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingAccountListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.models.BillingAccountInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of billing accounts. */ +@Immutable +public final class BillingAccountListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingAccountListResult.class); + + /* + * The list of billing accounts. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of billing accounts. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingAccountUpdateRequest.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingAccountUpdateRequest.java new file mode 100644 index 0000000000000..2826aff435b71 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingAccountUpdateRequest.java @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The request properties of the billing account that can be updated. */ +@JsonFlatten +@Fluent +public class BillingAccountUpdateRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingAccountUpdateRequest.class); + + /* + * The billing account name. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /* + * The address of the individual or organization that is responsible for + * the billing account. + */ + @JsonProperty(value = "properties.soldTo") + private AddressDetails soldTo; + + /* + * The type of agreement. + */ + @JsonProperty(value = "properties.agreementType", access = JsonProperty.Access.WRITE_ONLY) + private AgreementType agreementType; + + /* + * The type of customer. + */ + @JsonProperty(value = "properties.accountType", access = JsonProperty.Access.WRITE_ONLY) + private AccountType accountType; + + /* + * The current status of the billing account. + */ + @JsonProperty(value = "properties.accountStatus", access = JsonProperty.Access.WRITE_ONLY) + private AccountStatus accountStatus; + + /* + * The billing profiles associated with the billing account. By default + * this is not populated, unless it's specified in $expand. + */ + @JsonProperty(value = "properties.billingProfiles") + private BillingProfilesOnExpand 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; + + /* + * Indicates whether user has read access to the billing account. + */ + @JsonProperty(value = "properties.hasReadAccess", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasReadAccess; + + /** + * Get the displayName property: The billing account name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The billing account name. + * + * @param displayName the displayName value to set. + * @return the BillingAccountUpdateRequest object itself. + */ + public BillingAccountUpdateRequest withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the soldTo property: The address of the individual or organization that is responsible for the billing + * account. + * + * @return the soldTo value. + */ + public AddressDetails soldTo() { + return this.soldTo; + } + + /** + * Set the soldTo property: The address of the individual or organization that is responsible for the billing + * account. + * + * @param soldTo the soldTo value to set. + * @return the BillingAccountUpdateRequest object itself. + */ + public BillingAccountUpdateRequest withSoldTo(AddressDetails soldTo) { + this.soldTo = soldTo; + return this; + } + + /** + * Get the agreementType property: The type of agreement. + * + * @return the agreementType value. + */ + public AgreementType agreementType() { + return this.agreementType; + } + + /** + * Get the accountType property: The type of customer. + * + * @return the accountType value. + */ + public AccountType accountType() { + return this.accountType; + } + + /** + * Get the accountStatus property: The current status of the billing account. + * + * @return the accountStatus value. + */ + public AccountStatus accountStatus() { + return this.accountStatus; + } + + /** + * Get the billingProfiles property: The billing profiles associated with the billing account. By default this is + * not populated, unless it's specified in $expand. + * + * @return the billingProfiles value. + */ + public BillingProfilesOnExpand billingProfiles() { + return this.billingProfiles; + } + + /** + * Set the billingProfiles property: The billing profiles associated with the billing account. By default this is + * not populated, unless it's specified in $expand. + * + * @param billingProfiles the billingProfiles value to set. + * @return the BillingAccountUpdateRequest object itself. + */ + public BillingAccountUpdateRequest withBillingProfiles(BillingProfilesOnExpand billingProfiles) { + this.billingProfiles = billingProfiles; + return this; + } + + /** + * Get the enrollmentDetails property: 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 property: The departments associated to the enrollment. + * + * @return the departments value. + */ + public List departments() { + return this.departments; + } + + /** + * Set the departments property: The departments associated to the enrollment. + * + * @param departments the departments value to set. + * @return the BillingAccountUpdateRequest object itself. + */ + public BillingAccountUpdateRequest withDepartments(List departments) { + this.departments = departments; + return this; + } + + /** + * Get the enrollmentAccounts property: The accounts associated to the enrollment. + * + * @return the enrollmentAccounts value. + */ + public List enrollmentAccounts() { + return this.enrollmentAccounts; + } + + /** + * Set the enrollmentAccounts property: The accounts associated to the enrollment. + * + * @param enrollmentAccounts the enrollmentAccounts value to set. + * @return the BillingAccountUpdateRequest object itself. + */ + public BillingAccountUpdateRequest withEnrollmentAccounts(List enrollmentAccounts) { + this.enrollmentAccounts = enrollmentAccounts; + return this; + } + + /** + * Get the hasReadAccess property: Indicates whether user has read access to the billing account. + * + * @return the hasReadAccess value. + */ + public Boolean hasReadAccess() { + return this.hasReadAccess; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (soldTo() != null) { + soldTo().validate(); + } + if (billingProfiles() != null) { + billingProfiles().validate(); + } + if (enrollmentDetails() != null) { + enrollmentDetails().validate(); + } + if (departments() != null) { + departments().forEach(e -> e.validate()); + } + if (enrollmentAccounts() != null) { + enrollmentAccounts().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingAccounts.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingAccounts.java new file mode 100644 index 0000000000000..fbfbd069beed6 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingAccounts.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of BillingAccounts. */ +public interface BillingAccounts { + /** + * Lists the billing accounts that a user has access to. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing accounts. + */ + PagedIterable list(); + + /** + * Lists the billing accounts that a user has access to. + * + * @param expand May be used to expand the soldTo, invoice sections and billing profiles. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing accounts. + */ + PagedIterable list(String expand, Context context); + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account by its ID. + */ + BillingAccount get(String billingAccountName); + + /** + * Gets a billing account by its ID. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the soldTo, invoice sections and billing profiles. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account by its ID. + */ + Response getWithResponse(String billingAccountName, String expand, Context context); + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account. + */ + BillingAccount update(String billingAccountName, BillingAccountUpdateRequest parameters); + + /** + * Updates the properties of a billing account. Currently, displayName and address can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing account operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing account. + */ + BillingAccount update(String billingAccountName, BillingAccountUpdateRequest parameters, Context context); + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice section properties with create subscription permission. + */ + PagedIterable listInvoiceSectionsByCreateSubscriptionPermission( + String billingAccountName); + + /** + * Lists the invoice sections for which the user has permission to create Azure subscriptions. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice section properties with create subscription permission. + */ + PagedIterable listInvoiceSectionsByCreateSubscriptionPermission( + String billingAccountName, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingFrequency.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingFrequency.java new file mode 100644 index 0000000000000..3bc102e7aa56f --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingFrequency.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** 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/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPeriod.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPeriod.java new file mode 100644 index 0000000000000..ba9aaa0314b7e --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPeriod.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.BillingPeriodInner; +import java.time.LocalDate; +import java.util.List; + +/** An immutable client-side representation of BillingPeriod. */ +public interface BillingPeriod { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the billingPeriodStartDate property: The start of the date range covered by the billing period. + * + * @return the billingPeriodStartDate value. + */ + LocalDate billingPeriodStartDate(); + + /** + * Gets the billingPeriodEndDate property: The end of the date range covered by the billing period. + * + * @return the billingPeriodEndDate value. + */ + LocalDate billingPeriodEndDate(); + + /** + * Gets the invoiceIds property: Array of invoice ids that associated with. + * + * @return the invoiceIds value. + */ + List invoiceIds(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.BillingPeriodInner object. + * + * @return the inner object. + */ + BillingPeriodInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPeriods.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPeriods.java new file mode 100644 index 0000000000000..e2b820043aa7b --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPeriods.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of BillingPeriods. */ +public interface BillingPeriods { + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for + * Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web + * portal are not supported through this preview API. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing billing periods. + */ + PagedIterable list(); + + /** + * Lists the available billing periods for a subscription in reverse chronological order. This is only supported for + * Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web + * portal are not supported through this preview API. + * + * @param filter May be used to filter billing periods by billingPeriodEndDate. The filter supports 'eq', 'lt', + * 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not'. + * @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 top May be used to limit the number of results to the most recent N billing periods. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing billing periods. + */ + PagedIterable list(String filter, String skiptoken, Integer top, Context context); + + /** + * Gets a named billing period. This is only supported for Azure Web-Direct subscriptions. Other subscription types + * which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @param billingPeriodName The name of a BillingPeriod resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a named billing period. + */ + BillingPeriod get(String billingPeriodName); + + /** + * Gets a named billing period. This is only supported for Azure Web-Direct subscriptions. Other subscription types + * which were not purchased directly through the Azure web portal are not supported through this preview API. + * + * @param billingPeriodName The name of a BillingPeriod resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a named billing period. + */ + Response getWithResponse(String billingPeriodName, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPeriodsListResult.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPeriodsListResult.java new file mode 100644 index 0000000000000..eb1b669895b8c --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPeriodsListResult.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.models.BillingPeriodInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of listing billing periods. It contains a list of available billing periods in reverse chronological order. + */ +@Immutable +public final class BillingPeriodsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingPeriodsListResult.class); + + /* + * The list of billing periods. + */ + @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 value property: The list of billing periods. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPermissions.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPermissions.java new file mode 100644 index 0000000000000..d77726f5684db --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPermissions.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of BillingPermissions. */ +public interface BillingPermissions { + /** + * Lists the billing permissions the caller has for a customer. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + PagedIterable listByCustomer(String billingAccountName, String customerName); + + /** + * Lists the billing permissions the caller has for a customer. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + PagedIterable listByCustomer( + String billingAccountName, String customerName, Context context); + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + PagedIterable listByBillingAccount(String billingAccountName); + + /** + * Lists the billing permissions the caller has on a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + PagedIterable listByBillingAccount(String billingAccountName, Context context); + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + PagedIterable listByInvoiceSections( + String billingAccountName, String billingProfileName, String invoiceSectionName); + + /** + * Lists the billing permissions the caller has on an invoice section. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + PagedIterable listByInvoiceSections( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context); + + /** + * Lists the billing permissions the caller has on a billing profile. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName); + + /** + * Lists the billing permissions the caller has on a billing profile. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of list billingPermissions a caller has on a billing account. + */ + PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPermissionsListResult.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPermissionsListResult.java new file mode 100644 index 0000000000000..b33bb19f409ee --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPermissionsListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.models.BillingPermissionsPropertiesInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of list billingPermissions a caller has on a billing account. */ +@Immutable +public final class BillingPermissionsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingPermissionsListResult.class); + + /* + * The list of billingPermissions a caller has on a billing account. + */ + @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 value property: The list of billingPermissions a caller has on a billing account. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPermissionsProperties.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPermissionsProperties.java new file mode 100644 index 0000000000000..0c19fdaf8542f --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingPermissionsProperties.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.BillingPermissionsPropertiesInner; +import java.util.List; + +/** An immutable client-side representation of BillingPermissionsProperties. */ +public interface BillingPermissionsProperties { + /** + * Gets the actions property: The set of actions that the caller is allowed to perform. + * + * @return the actions value. + */ + List actions(); + + /** + * Gets the notActions property: The set of actions that the caller is not allowed to perform. + * + * @return the notActions value. + */ + List notActions(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.BillingPermissionsPropertiesInner object. + * + * @return the inner object. + */ + BillingPermissionsPropertiesInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfile.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfile.java new file mode 100644 index 0000000000000..e3f57907bd016 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfile.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.BillingProfileInner; +import java.util.List; + +/** An immutable client-side representation of BillingProfile. */ +public interface BillingProfile { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the displayName property: The name of the billing profile. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the poNumber property: The purchase order name that will appear on the invoices generated for the billing + * profile. + * + * @return the poNumber value. + */ + String poNumber(); + + /** + * Gets the billingRelationshipType property: Identifies which services and purchases are paid by a billing profile. + * + * @return the billingRelationshipType value. + */ + BillingRelationshipType billingRelationshipType(); + + /** + * Gets the billTo property: Billing address. + * + * @return the billTo value. + */ + AddressDetails billTo(); + + /** + * Gets the indirectRelationshipInfo property: Identifies the billing profile that is linked to another billing + * profile in indirect purchase motion. + * + * @return the indirectRelationshipInfo value. + */ + IndirectRelationshipInfo indirectRelationshipInfo(); + + /** + * Gets the invoiceEmailOptIn property: Flag controlling whether the invoices for the billing profile are sent + * through email. + * + * @return the invoiceEmailOptIn value. + */ + Boolean invoiceEmailOptIn(); + + /** + * Gets the invoiceDay property: The day of the month when the invoice for the billing profile is generated. + * + * @return the invoiceDay value. + */ + Integer invoiceDay(); + + /** + * Gets the currency property: The currency in which the charges for the billing profile are billed. + * + * @return the currency value. + */ + String currency(); + + /** + * Gets the enabledAzurePlans property: Information about the enabled azure plans. + * + * @return the enabledAzurePlans value. + */ + List enabledAzurePlans(); + + /** + * Gets the invoiceSections property: The invoice sections associated to the billing profile. By default this is not + * populated, unless it's specified in $expand. + * + * @return the invoiceSections value. + */ + InvoiceSectionsOnExpand invoiceSections(); + + /** + * Gets the hasReadAccess property: Indicates whether user has read access to the billing profile. + * + * @return the hasReadAccess value. + */ + Boolean hasReadAccess(); + + /** + * Gets the systemId property: The system generated unique identifier for a billing profile. + * + * @return the systemId value. + */ + String systemId(); + + /** + * Gets the status property: The status of the billing profile. + * + * @return the status value. + */ + BillingProfileStatus status(); + + /** + * Gets the statusReasonCode property: Reason for the specified billing profile status. + * + * @return the statusReasonCode value. + */ + StatusReasonCode statusReasonCode(); + + /** + * Gets the spendingLimit property: The billing profile spending limit. + * + * @return the spendingLimit value. + */ + SpendingLimit spendingLimit(); + + /** + * Gets the targetClouds property: Identifies the cloud environments that are associated with a billing profile. + * This is a system managed optional field and gets updated as the billing profile gets associated with accounts in + * various clouds. + * + * @return the targetClouds value. + */ + List targetClouds(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.BillingProfileInner object. + * + * @return the inner object. + */ + BillingProfileInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfileListResult.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfileListResult.java new file mode 100644 index 0000000000000..d04b645306ba2 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfileListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.models.BillingProfileInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of billing profiles. */ +@Immutable +public final class BillingProfileListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingProfileListResult.class); + + /* + * The list of billing profiles. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of billing profiles. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfileSpendingLimit.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfileSpendingLimit.java new file mode 100644 index 0000000000000..63e71f62c514e --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfileSpendingLimit.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for BillingProfileSpendingLimit. */ +public final class BillingProfileSpendingLimit extends ExpandableStringEnum { + /** Static value Off for BillingProfileSpendingLimit. */ + public static final BillingProfileSpendingLimit OFF = fromString("Off"); + + /** Static value On for BillingProfileSpendingLimit. */ + public static final BillingProfileSpendingLimit ON = fromString("On"); + + /** + * Creates or finds a BillingProfileSpendingLimit from its string representation. + * + * @param name a name to look for. + * @return the corresponding BillingProfileSpendingLimit. + */ + @JsonCreator + public static BillingProfileSpendingLimit fromString(String name) { + return fromString(name, BillingProfileSpendingLimit.class); + } + + /** @return known BillingProfileSpendingLimit values. */ + public static Collection values() { + return values(BillingProfileSpendingLimit.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfileStatus.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfileStatus.java new file mode 100644 index 0000000000000..d6c08a8091156 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfileStatus.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for BillingProfileStatus. */ +public final class BillingProfileStatus extends ExpandableStringEnum { + /** Static value Active for BillingProfileStatus. */ + public static final BillingProfileStatus ACTIVE = fromString("Active"); + + /** Static value Disabled for BillingProfileStatus. */ + public static final BillingProfileStatus DISABLED = fromString("Disabled"); + + /** Static value Warned for BillingProfileStatus. */ + public static final BillingProfileStatus WARNED = fromString("Warned"); + + /** + * Creates or finds a BillingProfileStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding BillingProfileStatus. + */ + @JsonCreator + public static BillingProfileStatus fromString(String name) { + return fromString(name, BillingProfileStatus.class); + } + + /** @return known BillingProfileStatus values. */ + public static Collection values() { + return values(BillingProfileStatus.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfileStatusReasonCode.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfileStatusReasonCode.java new file mode 100644 index 0000000000000..6e83246feb2fd --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfileStatusReasonCode.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for BillingProfileStatusReasonCode. */ +public final class BillingProfileStatusReasonCode extends ExpandableStringEnum { + /** Static value PastDue for BillingProfileStatusReasonCode. */ + public static final BillingProfileStatusReasonCode PAST_DUE = fromString("PastDue"); + + /** Static value SpendingLimitReached for BillingProfileStatusReasonCode. */ + public static final BillingProfileStatusReasonCode SPENDING_LIMIT_REACHED = fromString("SpendingLimitReached"); + + /** Static value SpendingLimitExpired for BillingProfileStatusReasonCode. */ + public static final BillingProfileStatusReasonCode SPENDING_LIMIT_EXPIRED = fromString("SpendingLimitExpired"); + + /** + * Creates or finds a BillingProfileStatusReasonCode from its string representation. + * + * @param name a name to look for. + * @return the corresponding BillingProfileStatusReasonCode. + */ + @JsonCreator + public static BillingProfileStatusReasonCode fromString(String name) { + return fromString(name, BillingProfileStatusReasonCode.class); + } + + /** @return known BillingProfileStatusReasonCode values. */ + public static Collection values() { + return values(BillingProfileStatusReasonCode.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfiles.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfiles.java new file mode 100644 index 0000000000000..963647c7ca360 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfiles.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.billing.fluent.models.BillingProfileInner; + +/** Resource collection API of BillingProfiles. */ +public interface BillingProfiles { + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with + * agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing profiles. + */ + PagedIterable listByBillingAccount(String billingAccountName); + + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with + * agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param expand May be used to expand the invoice sections. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing profiles. + */ + PagedIterable listByBillingAccount(String billingAccountName, String expand, Context context); + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft + * Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile by its ID. + */ + BillingProfile get(String billingAccountName, String billingProfileName); + + /** + * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft + * Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param expand May be used to expand the invoice sections. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile by its ID. + */ + Response getWithResponse( + String billingAccountName, String billingProfileName, String expand, Context context); + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile. + */ + BillingProfile createOrUpdate(String billingAccountName, String billingProfileName, BillingProfileInner parameters); + + /** + * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters The new or updated billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing profile. + */ + BillingProfile createOrUpdate( + String billingAccountName, String billingProfileName, BillingProfileInner parameters, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfilesCreateOrUpdateHeaders.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfilesCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..0e3de662525e0 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfilesCreateOrUpdateHeaders.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The BillingProfilesCreateOrUpdateHeaders model. */ +@Fluent +public final class BillingProfilesCreateOrUpdateHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingProfilesCreateOrUpdateHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the BillingProfilesCreateOrUpdateHeaders object itself. + */ + public BillingProfilesCreateOrUpdateHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the BillingProfilesCreateOrUpdateHeaders object itself. + */ + public BillingProfilesCreateOrUpdateHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfilesCreateOrUpdateResponse.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfilesCreateOrUpdateResponse.java new file mode 100644 index 0000000000000..4e96dc6ce51f3 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfilesCreateOrUpdateResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.billing.fluent.models.BillingProfileInner; + +/** Contains all response data for the createOrUpdate operation. */ +public final class BillingProfilesCreateOrUpdateResponse + extends ResponseBase { + /** + * Creates an instance of BillingProfilesCreateOrUpdateResponse. + * + * @param request the request which resulted in this BillingProfilesCreateOrUpdateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public BillingProfilesCreateOrUpdateResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + BillingProfileInner value, + BillingProfilesCreateOrUpdateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public BillingProfileInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfilesOnExpand.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfilesOnExpand.java new file mode 100644 index 0000000000000..973e9d0a6a5a1 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProfilesOnExpand.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.models.BillingProfileInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The billing profiles associated with the billing account. By default this is not populated, unless it's specified in + * $expand. + */ +@Fluent +public final class BillingProfilesOnExpand { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingProfilesOnExpand.class); + + /* + * Indicates whether there are more billing profiles than the ones listed + * in this collection. The collection lists a maximum of 50 billing + * profiles. To get all billing profiles, use the list billing profiles + * API. + */ + @JsonProperty(value = "hasMoreResults", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasMoreResults; + + /* + * The billing profiles associated with the billing account. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the hasMoreResults property: Indicates whether there are more billing profiles than the ones listed in this + * collection. The collection lists a maximum of 50 billing profiles. To get all billing profiles, use the list + * billing profiles API. + * + * @return the hasMoreResults value. + */ + public Boolean hasMoreResults() { + return this.hasMoreResults; + } + + /** + * Get the value property: The billing profiles associated with the billing account. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The billing profiles associated with the billing account. + * + * @param value the value value to set. + * @return the BillingProfilesOnExpand object itself. + */ + public BillingProfilesOnExpand withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProperties.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProperties.java new file mode 100644 index 0000000000000..f14257349f5c6 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProperties.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.billing.fluent.models.BillingPropertyInner; + +/** Resource collection API of BillingProperties. */ +public interface BillingProperties { + /** + * Get the billing properties for a subscription. This operation is not supported for billing accounts with + * agreement type Enterprise Agreement. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the billing properties for a subscription. + */ + BillingProperty get(); + + /** + * Get the billing properties for a subscription. This operation is not supported for billing accounts with + * agreement type Enterprise Agreement. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the billing properties for a subscription. + */ + Response getWithResponse(Context context); + + /** + * Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported + * only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param parameters Request parameters that are provided to the update billing property operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing property. + */ + BillingProperty update(BillingPropertyInner parameters); + + /** + * Updates the billing property of a subscription. Currently, cost center can be updated. The operation is supported + * only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param parameters Request parameters that are provided to the update billing property operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing property. + */ + Response updateWithResponse(BillingPropertyInner parameters, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProperty.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProperty.java new file mode 100644 index 0000000000000..14688c694a2e2 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingProperty.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.BillingPropertyInner; + +/** An immutable client-side representation of BillingProperty. */ +public interface BillingProperty { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the accountAdminNotificationEmailAddress property: The email address on which the account admin gets all + * Azure notifications. + * + * @return the accountAdminNotificationEmailAddress value. + */ + String accountAdminNotificationEmailAddress(); + + /** + * Gets the billingTenantId property: The Azure AD tenant ID of the billing account for the subscription. + * + * @return the billingTenantId value. + */ + String billingTenantId(); + + /** + * Gets the billingAccountId property: The ID of the billing account to which the subscription is billed. + * + * @return the billingAccountId value. + */ + String billingAccountId(); + + /** + * Gets the billingAccountDisplayName property: The name of the billing account to which the subscription is billed. + * + * @return the billingAccountDisplayName value. + */ + String billingAccountDisplayName(); + + /** + * Gets the billingProfileId property: The ID of the billing profile to which the subscription is billed. + * + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * Gets the billingProfileDisplayName property: The name of the billing profile to which the subscription is billed. + * + * @return the billingProfileDisplayName value. + */ + String billingProfileDisplayName(); + + /** + * Gets the billingProfileStatus property: The status of the billing profile. + * + * @return the billingProfileStatus value. + */ + BillingProfileStatus billingProfileStatus(); + + /** + * Gets the billingProfileStatusReasonCode property: Reason for the specified billing profile status. + * + * @return the billingProfileStatusReasonCode value. + */ + BillingProfileStatusReasonCode billingProfileStatusReasonCode(); + + /** + * Gets the billingProfileSpendingLimit property: The billing profile spending limit. + * + * @return the billingProfileSpendingLimit value. + */ + BillingProfileSpendingLimit billingProfileSpendingLimit(); + + /** + * Gets the costCenter property: The cost center applied to the subscription. + * + * @return the costCenter value. + */ + String costCenter(); + + /** + * Gets the invoiceSectionId property: The ID of the invoice section to which the subscription is billed. + * + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * Gets the invoiceSectionDisplayName property: The name of the invoice section to which the subscription is billed. + * + * @return the invoiceSectionDisplayName value. + */ + String invoiceSectionDisplayName(); + + /** + * Gets the isAccountAdmin property: Indicates whether user is the account admin. + * + * @return the isAccountAdmin value. + */ + Boolean isAccountAdmin(); + + /** + * Gets the productId property: The product ID of the Azure plan. + * + * @return the productId value. + */ + String productId(); + + /** + * Gets the productName property: The product name of the Azure plan. + * + * @return the productName value. + */ + String productName(); + + /** + * Gets the skuId property: The sku ID of the Azure plan for the subscription. + * + * @return the skuId value. + */ + String skuId(); + + /** + * Gets the skuDescription property: The sku description of the Azure plan for the subscription. + * + * @return the skuDescription value. + */ + String skuDescription(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.BillingPropertyInner object. + * + * @return the inner object. + */ + BillingPropertyInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRelationshipType.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRelationshipType.java new file mode 100644 index 0000000000000..17da8c5e2223c --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRelationshipType.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for BillingRelationshipType. */ +public final class BillingRelationshipType extends ExpandableStringEnum { + /** Static value Direct for BillingRelationshipType. */ + public static final BillingRelationshipType DIRECT = fromString("Direct"); + + /** Static value IndirectCustomer for BillingRelationshipType. */ + public static final BillingRelationshipType INDIRECT_CUSTOMER = fromString("IndirectCustomer"); + + /** Static value IndirectPartner for BillingRelationshipType. */ + public static final BillingRelationshipType INDIRECT_PARTNER = fromString("IndirectPartner"); + + /** Static value CSPPartner for BillingRelationshipType. */ + public static final BillingRelationshipType CSPPARTNER = fromString("CSPPartner"); + + /** + * Creates or finds a BillingRelationshipType from its string representation. + * + * @param name a name to look for. + * @return the corresponding BillingRelationshipType. + */ + @JsonCreator + public static BillingRelationshipType fromString(String name) { + return fromString(name, BillingRelationshipType.class); + } + + /** @return known BillingRelationshipType values. */ + public static Collection values() { + return values(BillingRelationshipType.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleAssignment.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleAssignment.java new file mode 100644 index 0000000000000..12309dabb5a29 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleAssignment.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.BillingRoleAssignmentInner; + +/** An immutable client-side representation of BillingRoleAssignment. */ +public interface BillingRoleAssignment { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the createdOn property: The date the role assignment was created. + * + * @return the createdOn value. + */ + String createdOn(); + + /** + * Gets the createdByPrincipalTenantId property: The tenant Id of the user who created the role assignment. + * + * @return the createdByPrincipalTenantId value. + */ + String createdByPrincipalTenantId(); + + /** + * Gets the createdByPrincipalId property: The principal Id of the user who created the role assignment. + * + * @return the createdByPrincipalId value. + */ + String createdByPrincipalId(); + + /** + * Gets the createdByUserEmailAddress property: The email address of the user who created the role assignment. + * + * @return the createdByUserEmailAddress value. + */ + String createdByUserEmailAddress(); + + /** + * Gets the principalId property: The principal id of the user to whom the role was assigned. + * + * @return the principalId value. + */ + String principalId(); + + /** + * Gets the principalTenantId property: The principal tenant id of the user to whom the role was assigned. + * + * @return the principalTenantId value. + */ + String principalTenantId(); + + /** + * Gets the roleDefinitionId property: The ID of the role definition. + * + * @return the roleDefinitionId value. + */ + String roleDefinitionId(); + + /** + * Gets the scope property: The scope at which the role was assigned. + * + * @return the scope value. + */ + String scope(); + + /** + * Gets the userAuthenticationType property: The authentication type. + * + * @return the userAuthenticationType value. + */ + String userAuthenticationType(); + + /** + * Gets the userEmailAddress property: The email address of the user. + * + * @return the userEmailAddress value. + */ + String userEmailAddress(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.BillingRoleAssignmentInner object. + * + * @return the inner object. + */ + BillingRoleAssignmentInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleAssignmentListResult.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleAssignmentListResult.java new file mode 100644 index 0000000000000..c6af8ad08b553 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleAssignmentListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.models.BillingRoleAssignmentInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of role assignments. */ +@Immutable +public final class BillingRoleAssignmentListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingRoleAssignmentListResult.class); + + /* + * The list of role assignments. + */ + @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 value property: The list of role assignments. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleAssignments.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleAssignments.java new file mode 100644 index 0000000000000..db514c419c639 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleAssignments.java @@ -0,0 +1,294 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of BillingRoleAssignments. */ +public interface BillingRoleAssignments { + /** + * Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on a billing account. + */ + BillingRoleAssignment getByBillingAccount(String billingAccountName, String billingRoleAssignmentName); + + /** + * Gets a role assignment for the caller on a billing account. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on a billing account. + */ + Response getByBillingAccountWithResponse( + String billingAccountName, String billingRoleAssignmentName, Context context); + + /** + * Deletes a role assignment for the caller on a billing account. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + BillingRoleAssignment deleteByBillingAccount(String billingAccountName, String billingRoleAssignmentName); + + /** + * Deletes a role assignment for the caller on a billing account. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + Response deleteByBillingAccountWithResponse( + String billingAccountName, String billingRoleAssignmentName, Context context); + + /** + * Gets a role assignment for the caller on an invoice section. The operation is supported for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on an invoice section. + */ + BillingRoleAssignment getByInvoiceSection( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleAssignmentName); + + /** + * Gets a role assignment for the caller on an invoice section. The operation is supported for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on an invoice section. + */ + Response getByInvoiceSectionWithResponse( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleAssignmentName, + Context context); + + /** + * Deletes a role assignment for the caller on an invoice section. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + BillingRoleAssignment deleteByInvoiceSection( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleAssignmentName); + + /** + * Deletes a role assignment for the caller on an invoice section. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + Response deleteByInvoiceSectionWithResponse( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleAssignmentName, + Context context); + + /** + * Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on a billing profile. + */ + BillingRoleAssignment getByBillingProfile( + String billingAccountName, String billingProfileName, String billingRoleAssignmentName); + + /** + * Gets a role assignment for the caller on a billing profile. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a role assignment for the caller on a billing profile. + */ + Response getByBillingProfileWithResponse( + String billingAccountName, String billingProfileName, String billingRoleAssignmentName, Context context); + + /** + * Deletes a role assignment for the caller on a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + BillingRoleAssignment deleteByBillingProfile( + String billingAccountName, String billingProfileName, String billingRoleAssignmentName); + + /** + * Deletes a role assignment for the caller on a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the role assignment. + */ + Response deleteByBillingProfileWithResponse( + String billingAccountName, String billingProfileName, String billingRoleAssignmentName, Context context); + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + PagedIterable listByBillingAccount(String billingAccountName); + + /** + * Lists the role assignments for the caller on a billing account. The operation is supported for billing accounts + * with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + PagedIterable listByBillingAccount(String billingAccountName, Context context); + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName); + + /** + * Lists the role assignments for the caller on an invoice section. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context); + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName); + + /** + * Lists the role assignments for the caller on a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role assignments. + */ + PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleDefinition.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleDefinition.java new file mode 100644 index 0000000000000..c1b7fbb0c17bc --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleDefinition.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.BillingRoleDefinitionInner; +import java.util.List; + +/** An immutable client-side representation of BillingRoleDefinition. */ +public interface BillingRoleDefinition { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the description property: The role description. + * + * @return the description value. + */ + String description(); + + /** + * Gets the permissions property: The billingPermissions the role has. + * + * @return the permissions value. + */ + List permissions(); + + /** + * Gets the roleName property: The name of the role. + * + * @return the roleName value. + */ + String roleName(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.BillingRoleDefinitionInner object. + * + * @return the inner object. + */ + BillingRoleDefinitionInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleDefinitionListResult.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleDefinitionListResult.java new file mode 100644 index 0000000000000..f91d44eddcf3a --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleDefinitionListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.models.BillingRoleDefinitionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of role definitions. */ +@Immutable +public final class BillingRoleDefinitionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingRoleDefinitionListResult.class); + + /* + * The role definitions. + */ + @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 value property: The role definitions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleDefinitions.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleDefinitions.java new file mode 100644 index 0000000000000..9fc865e32bf94 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingRoleDefinitions.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of BillingRoleDefinitions. */ +public interface BillingRoleDefinitions { + /** + * Gets the definition for a role on a billing account. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on a billing account. + */ + BillingRoleDefinition getByBillingAccount(String billingAccountName, String billingRoleDefinitionName); + + /** + * Gets the definition for a role on a billing account. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on a billing account. + */ + Response getByBillingAccountWithResponse( + String billingAccountName, String billingRoleDefinitionName, Context context); + + /** + * Gets the definition for a role on an invoice section. The operation is supported only for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on an invoice section. + */ + BillingRoleDefinition getByInvoiceSection( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleDefinitionName); + + /** + * Gets the definition for a role on an invoice section. The operation is supported only for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on an invoice section. + */ + Response getByInvoiceSectionWithResponse( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String billingRoleDefinitionName, + Context context); + + /** + * Gets the definition for a role on a billing profile. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on a billing profile. + */ + BillingRoleDefinition getByBillingProfile( + String billingAccountName, String billingProfileName, String billingRoleDefinitionName); + + /** + * Gets the definition for a role on a billing profile. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param billingRoleDefinitionName The ID that uniquely identifies a role definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition for a role on a billing profile. + */ + Response getByBillingProfileWithResponse( + String billingAccountName, String billingProfileName, String billingRoleDefinitionName, Context context); + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + PagedIterable listByBillingAccount(String billingAccountName); + + /** + * Lists the role definitions for a billing account. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + PagedIterable listByBillingAccount(String billingAccountName, Context context); + + /** + * Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName); + + /** + * Lists the role definitions for an invoice section. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context); + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName); + + /** + * Lists the role definitions for a billing profile. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of role definitions. + */ + PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscription.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscription.java new file mode 100644 index 0000000000000..f5c05a7477665 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscription.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.BillingSubscriptionInner; +import java.util.UUID; + +/** An immutable client-side representation of BillingSubscription. */ +public interface BillingSubscription { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the displayName property: The name of the subscription. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the subscriptionId property: The ID of the subscription. + * + * @return the subscriptionId value. + */ + UUID subscriptionId(); + + /** + * Gets the subscriptionBillingStatus property: The current billing status of the subscription. + * + * @return the subscriptionBillingStatus value. + */ + BillingSubscriptionStatusType subscriptionBillingStatus(); + + /** + * Gets the lastMonthCharges property: The last month charges. + * + * @return the lastMonthCharges value. + */ + Amount lastMonthCharges(); + + /** + * Gets the monthToDateCharges property: The current month to date charges. + * + * @return the monthToDateCharges value. + */ + Amount monthToDateCharges(); + + /** + * Gets the billingProfileId property: The ID of the billing profile to which the subscription is billed. + * + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * Gets the billingProfileDisplayName property: The name of the billing profile to which the subscription is billed. + * + * @return the billingProfileDisplayName value. + */ + String billingProfileDisplayName(); + + /** + * Gets the costCenter property: The cost center applied to the subscription. + * + * @return the costCenter value. + */ + String costCenter(); + + /** + * Gets the customerId property: The ID of the customer for whom the subscription was created. The field is + * applicable only for Microsoft Partner Agreement billing account. + * + * @return the customerId value. + */ + String customerId(); + + /** + * Gets the customerDisplayName property: The name of the customer for whom the subscription was created. The field + * is applicable only for Microsoft Partner Agreement billing account. + * + * @return the customerDisplayName value. + */ + String customerDisplayName(); + + /** + * Gets the invoiceSectionId property: The ID of the invoice section to which the subscription is billed. + * + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * Gets the invoiceSectionDisplayName property: The name of the invoice section to which the subscription is billed. + * + * @return the invoiceSectionDisplayName value. + */ + String invoiceSectionDisplayName(); + + /** + * Gets the reseller property: Reseller for this subscription. + * + * @return the reseller value. + */ + Reseller reseller(); + + /** + * Gets the skuId property: The sku ID of the Azure plan for the subscription. + * + * @return the skuId value. + */ + String skuId(); + + /** + * Gets the skuDescription property: The sku description of the Azure plan for the subscription. + * + * @return the skuDescription value. + */ + String skuDescription(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.BillingSubscriptionInner object. + * + * @return the inner object. + */ + BillingSubscriptionInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionStatusType.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionStatusType.java new file mode 100644 index 0000000000000..a2ca1265ed9ac --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionStatusType.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** 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/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptions.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptions.java new file mode 100644 index 0000000000000..4d9fed6033d11 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptions.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.billing.fluent.models.BillingSubscriptionInner; + +/** Resource collection API of BillingSubscriptions. */ +public interface BillingSubscriptions { + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + PagedIterable listByCustomer(String billingAccountName, String customerName); + + /** + * Lists the subscriptions for a customer. The operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + PagedIterable listByCustomer(String billingAccountName, String customerName, Context context); + + /** + * Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement + * type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + PagedIterable listByBillingAccount(String billingAccountName); + + /** + * Lists the subscriptions for a billing account. The operation is supported for billing accounts with agreement + * type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + PagedIterable listByBillingAccount(String billingAccountName, Context context); + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName); + + /** + * Lists the subscriptions that are billed to a billing profile. The operation is supported for billing accounts + * with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context); + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing + * accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName); + + /** + * Lists the subscriptions that are billed to an invoice section. The operation is supported only for billing + * accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing subscriptions. + */ + PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context); + + /** + * Gets a subscription by its ID. The operation is supported for billing accounts with agreement type Microsoft + * Customer Agreement and Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a subscription by its ID. + */ + BillingSubscription get(String billingAccountName); + + /** + * Gets a subscription by its ID. The operation is supported for billing accounts with agreement type Microsoft + * Customer Agreement and Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a subscription by its ID. + */ + Response getWithResponse(String billingAccountName, Context context); + + /** + * Updates the properties of a billing subscription. Currently, cost center can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + BillingSubscription update(String billingAccountName, BillingSubscriptionInner parameters); + + /** + * Updates the properties of a billing subscription. Currently, cost center can be updated. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the update billing subscription operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + Response updateWithResponse( + String billingAccountName, BillingSubscriptionInner parameters, Context context); + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the move subscription operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + BillingSubscription move(String billingAccountName, TransferBillingSubscriptionRequestProperties parameters); + + /** + * Moves a subscription's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the move subscription operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a billing subscription. + */ + BillingSubscription move( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters, Context context); + + /** + * Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for + * billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the validate move eligibility operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the transfer eligibility validation. + */ + ValidateSubscriptionTransferEligibilityResult validateMove( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters); + + /** + * Validates if a subscription's charges can be moved to a new invoice section. This operation is supported for + * billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param parameters Request parameters that are provided to the validate move eligibility operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the transfer eligibility validation. + */ + Response validateMoveWithResponse( + String billingAccountName, TransferBillingSubscriptionRequestProperties parameters, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionsListResult.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionsListResult.java new file mode 100644 index 0000000000000..25fb08dfce592 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionsListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.models.BillingSubscriptionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of billing subscriptions. */ +@Immutable +public final class BillingSubscriptionsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingSubscriptionsListResult.class); + + /* + * The list of billing subscriptions. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of billing subscriptions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionsMoveHeaders.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionsMoveHeaders.java new file mode 100644 index 0000000000000..28d4593ed5915 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionsMoveHeaders.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The BillingSubscriptionsMoveHeaders model. */ +@Fluent +public final class BillingSubscriptionsMoveHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BillingSubscriptionsMoveHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the BillingSubscriptionsMoveHeaders object itself. + */ + public BillingSubscriptionsMoveHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the BillingSubscriptionsMoveHeaders object itself. + */ + public BillingSubscriptionsMoveHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionsMoveResponse.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionsMoveResponse.java new file mode 100644 index 0000000000000..1017331eedcce --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionsMoveResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.billing.fluent.models.BillingSubscriptionInner; + +/** Contains all response data for the move operation. */ +public final class BillingSubscriptionsMoveResponse + extends ResponseBase { + /** + * Creates an instance of BillingSubscriptionsMoveResponse. + * + * @param request the request which resulted in this BillingSubscriptionsMoveResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public BillingSubscriptionsMoveResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + BillingSubscriptionInner value, + BillingSubscriptionsMoveHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public BillingSubscriptionInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Category.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Category.java new file mode 100644 index 0000000000000..c82bc47445712 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Category.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Category. */ +public final class Category extends ExpandableStringEnum { + /** Static value MicrosoftCustomerAgreement for Category. */ + public static final Category MICROSOFT_CUSTOMER_AGREEMENT = fromString("MicrosoftCustomerAgreement"); + + /** Static value AffiliatePurchaseTerms for Category. */ + public static final Category AFFILIATE_PURCHASE_TERMS = fromString("AffiliatePurchaseTerms"); + + /** Static value Other for Category. */ + public static final Category OTHER = fromString("Other"); + + /** + * Creates or finds a Category from its string representation. + * + * @param name a name to look for. + * @return the corresponding Category. + */ + @JsonCreator + public static Category fromString(String name) { + return fromString(name, Category.class); + } + + /** @return known Category values. */ + public static Collection values() { + return values(Category.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Customer.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Customer.java new file mode 100644 index 0000000000000..5bba073947f63 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Customer.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.CustomerInner; +import java.util.List; + +/** An immutable client-side representation of Customer. */ +public interface Customer { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the billingProfileId property: The ID of the billing profile for the invoice section. + * + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * Gets the billingProfileDisplayName property: The name of the billing profile for the invoice section. + * + * @return the billingProfileDisplayName value. + */ + String billingProfileDisplayName(); + + /** + * Gets the displayName property: The name of the customer. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the enabledAzurePlans property: Azure plans enabled for the customer. + * + * @return the enabledAzurePlans value. + */ + List enabledAzurePlans(); + + /** + * Gets the resellers property: The list of resellers for which an Azure plan is enabled for the customer. + * + * @return the resellers value. + */ + List resellers(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.CustomerInner object. + * + * @return the inner object. + */ + CustomerInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/CustomerListResult.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/CustomerListResult.java new file mode 100644 index 0000000000000..f98d2f0917a52 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/CustomerListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.models.CustomerInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of customers. */ +@Immutable +public final class CustomerListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CustomerListResult.class); + + /* + * The list of customers. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of customers. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/CustomerPolicy.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/CustomerPolicy.java new file mode 100644 index 0000000000000..378612defd516 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/CustomerPolicy.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.CustomerPolicyInner; + +/** An immutable client-side representation of CustomerPolicy. */ +public interface CustomerPolicy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the viewCharges property: The policy that controls whether the users in customer's organization can view + * charges at pay-as-you-go prices. + * + * @return the viewCharges value. + */ + ViewCharges viewCharges(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.CustomerPolicyInner object. + * + * @return the inner object. + */ + CustomerPolicyInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Customers.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Customers.java new file mode 100644 index 0000000000000..dde20eec5f200 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Customers.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Customers. */ +public interface Customers { + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts + * with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName); + + /** + * Lists the customers that are billed to a billing profile. The operation is supported only for billing accounts + * with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param search Used for searching customers by their name. Any customer with name containing the search text will + * be included in the response. + * @param filter May be used to filter the list of customers. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, String search, String filter, Context context); + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts + * with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + PagedIterable listByBillingAccount(String billingAccountName); + + /** + * Lists the customers that are billed to a billing account. The operation is supported only for billing accounts + * with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param search Used for searching customers by their name. Any customer with name containing the search text will + * be included in the response. + * @param filter May be used to filter the list of customers. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of customers. + */ + PagedIterable listByBillingAccount( + String billingAccountName, String search, String filter, Context context); + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft + * Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a customer by its ID. + */ + Customer get(String billingAccountName, String customerName); + + /** + * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft + * Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param expand May be used to expand enabledAzurePlans and resellers. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a customer by its ID. + */ + Response getWithResponse(String billingAccountName, String customerName, String expand, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Department.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Department.java new file mode 100644 index 0000000000000..a9b765b02d3c9 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Department.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A department. */ +@JsonFlatten +@Fluent +public class Department extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Department.class); + + /* + * The name of the department. + */ + @JsonProperty(value = "properties.departmentName") + private String departmentName; + + /* + * The cost center associated with the department. + */ + @JsonProperty(value = "properties.costCenter") + private String costCenter; + + /* + * The status of the department. + */ + @JsonProperty(value = "properties.status") + private String status; + + /* + * Associated enrollment accounts. By default this is not populated, unless + * it's specified in $expand. + */ + @JsonProperty(value = "properties.enrollmentAccounts") + private List enrollmentAccounts; + + /** + * Get the departmentName property: The name of the department. + * + * @return the departmentName value. + */ + public String departmentName() { + return this.departmentName; + } + + /** + * Set the departmentName property: The name of the department. + * + * @param departmentName the departmentName value to set. + * @return the Department object itself. + */ + public Department withDepartmentName(String departmentName) { + this.departmentName = departmentName; + return this; + } + + /** + * Get the costCenter property: The cost center associated with the department. + * + * @return the costCenter value. + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Set the costCenter property: The cost center associated with the department. + * + * @param costCenter the costCenter value to set. + * @return the Department object itself. + */ + public Department withCostCenter(String costCenter) { + this.costCenter = costCenter; + return this; + } + + /** + * Get the status property: The status of the department. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The status of the department. + * + * @param status the status value to set. + * @return the Department object itself. + */ + public Department withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the enrollmentAccounts property: 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 the enrollmentAccounts property: Associated enrollment accounts. By default this is not populated, unless + * it's specified in $expand. + * + * @param enrollmentAccounts the enrollmentAccounts value to set. + * @return the Department object itself. + */ + public Department withEnrollmentAccounts(List enrollmentAccounts) { + this.enrollmentAccounts = enrollmentAccounts; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (enrollmentAccounts() != null) { + enrollmentAccounts().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Document.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Document.java new file mode 100644 index 0000000000000..b220edb350a9a --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Document.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a document. */ +@Immutable +public final class Document { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Document.class); + + /* + * The type of the document. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private DocumentType kind; + + /* + * Document URL. + */ + @JsonProperty(value = "url", access = JsonProperty.Access.WRITE_ONLY) + private String url; + + /* + * The source of the document. ENF for Brazil and DRS for rest of the + * world. + */ + @JsonProperty(value = "source", access = JsonProperty.Access.WRITE_ONLY) + private DocumentSource source; + + /** + * Get the kind property: The type of the document. + * + * @return the kind value. + */ + public DocumentType kind() { + return this.kind; + } + + /** + * Get the url property: Document URL. + * + * @return the url value. + */ + public String url() { + return this.url; + } + + /** + * Get the source property: The source of the document. ENF for Brazil and DRS for rest of the world. + * + * @return the source value. + */ + public DocumentSource source() { + return this.source; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/DocumentSource.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/DocumentSource.java new file mode 100644 index 0000000000000..05c5bde83de4a --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/DocumentSource.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DocumentSource. */ +public final class DocumentSource extends ExpandableStringEnum { + /** Static value DRS for DocumentSource. */ + public static final DocumentSource DRS = fromString("DRS"); + + /** Static value ENF for DocumentSource. */ + public static final DocumentSource ENF = fromString("ENF"); + + /** + * Creates or finds a DocumentSource from its string representation. + * + * @param name a name to look for. + * @return the corresponding DocumentSource. + */ + @JsonCreator + public static DocumentSource fromString(String name) { + return fromString(name, DocumentSource.class); + } + + /** @return known DocumentSource values. */ + public static Collection values() { + return values(DocumentSource.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/DocumentType.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/DocumentType.java new file mode 100644 index 0000000000000..f838d2ce83e75 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/DocumentType.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DocumentType. */ +public final class DocumentType extends ExpandableStringEnum { + /** Static value Invoice for DocumentType. */ + public static final DocumentType INVOICE = fromString("Invoice"); + + /** Static value VoidNote for DocumentType. */ + public static final DocumentType VOID_NOTE = fromString("VoidNote"); + + /** Static value TaxReceipt for DocumentType. */ + public static final DocumentType TAX_RECEIPT = fromString("TaxReceipt"); + + /** Static value CreditNote for DocumentType. */ + public static final DocumentType CREDIT_NOTE = fromString("CreditNote"); + + /** + * Creates or finds a DocumentType from its string representation. + * + * @param name a name to look for. + * @return the corresponding DocumentType. + */ + @JsonCreator + public static DocumentType fromString(String name) { + return fromString(name, DocumentType.class); + } + + /** @return known DocumentType values. */ + public static Collection values() { + return values(DocumentType.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/DownloadUrl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/DownloadUrl.java new file mode 100644 index 0000000000000..fc484bae34203 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/DownloadUrl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.DownloadUrlInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of DownloadUrl. */ +public interface DownloadUrl { + /** + * Gets the expiryTime property: The time in UTC when the download URL will expire. + * + * @return the expiryTime value. + */ + OffsetDateTime expiryTime(); + + /** + * Gets the url property: The URL to the PDF file. + * + * @return the url value. + */ + String url(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.DownloadUrlInner object. + * + * @return the inner object. + */ + DownloadUrlInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Enrollment.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Enrollment.java new file mode 100644 index 0000000000000..853e8ab502ad4 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Enrollment.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of an enrollment. */ +@Fluent +public final class Enrollment { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Enrollment.class); + + /* + * The start date of the enrollment. + */ + @JsonProperty(value = "startDate") + private OffsetDateTime startDate; + + /* + * The end date of the enrollment. + */ + @JsonProperty(value = "endDate") + private OffsetDateTime endDate; + + /* + * The billing currency for the enrollment. + */ + @JsonProperty(value = "currency", access = JsonProperty.Access.WRITE_ONLY) + private String currency; + + /* + * The channel type of the enrollment. + */ + @JsonProperty(value = "channel", access = JsonProperty.Access.WRITE_ONLY) + private String channel; + + /* + * The policies for Enterprise Agreement enrollments. + */ + @JsonProperty(value = "policies", access = JsonProperty.Access.WRITE_ONLY) + private EnrollmentPolicies policies; + + /* + * The language for the enrollment. + */ + @JsonProperty(value = "language", access = JsonProperty.Access.WRITE_ONLY) + private String language; + + /* + * The country code of the enrollment. + */ + @JsonProperty(value = "countryCode", access = JsonProperty.Access.WRITE_ONLY) + private String countryCode; + + /* + * The current status of the enrollment. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * The billing cycle for the enrollment. + */ + @JsonProperty(value = "billingCycle", access = JsonProperty.Access.WRITE_ONLY) + private String billingCycle; + + /** + * Get the startDate property: The start date of the enrollment. + * + * @return the startDate value. + */ + public OffsetDateTime startDate() { + return this.startDate; + } + + /** + * Set the startDate property: The start date of the enrollment. + * + * @param startDate the startDate value to set. + * @return the Enrollment object itself. + */ + public Enrollment withStartDate(OffsetDateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get the endDate property: The end date of the enrollment. + * + * @return the endDate value. + */ + public OffsetDateTime endDate() { + return this.endDate; + } + + /** + * Set the endDate property: The end date of the enrollment. + * + * @param endDate the endDate value to set. + * @return the Enrollment object itself. + */ + public Enrollment withEndDate(OffsetDateTime endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get the currency property: The billing currency for the enrollment. + * + * @return the currency value. + */ + public String currency() { + return this.currency; + } + + /** + * Get the channel property: The channel type of the enrollment. + * + * @return the channel value. + */ + public String channel() { + return this.channel; + } + + /** + * Get the policies property: The policies for Enterprise Agreement enrollments. + * + * @return the policies value. + */ + public EnrollmentPolicies policies() { + return this.policies; + } + + /** + * Get the language property: The language for the enrollment. + * + * @return the language value. + */ + public String language() { + return this.language; + } + + /** + * Get the countryCode property: The country code of the enrollment. + * + * @return the countryCode value. + */ + public String countryCode() { + return this.countryCode; + } + + /** + * Get the status property: The current status of the enrollment. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the billingCycle property: The billing cycle for the enrollment. + * + * @return the billingCycle value. + */ + public String billingCycle() { + return this.billingCycle; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (policies() != null) { + policies().validate(); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/EnrollmentAccount.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/EnrollmentAccount.java new file mode 100644 index 0000000000000..c7688d6b17ff7 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/EnrollmentAccount.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** An enrollment account. */ +@JsonFlatten +@Fluent +public class EnrollmentAccount extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EnrollmentAccount.class); + + /* + * The name of the enrollment account. + */ + @JsonProperty(value = "properties.accountName") + private String accountName; + + /* + * The cost center associated with the enrollment account. + */ + @JsonProperty(value = "properties.costCenter") + private String costCenter; + + /* + * The owner of the enrollment account. + */ + @JsonProperty(value = "properties.accountOwner") + private String accountOwner; + + /* + * The status of the enrollment account. + */ + @JsonProperty(value = "properties.status") + private String status; + + /* + * The start date of the enrollment account. + */ + @JsonProperty(value = "properties.startDate") + private OffsetDateTime startDate; + + /* + * The end date of the enrollment account. + */ + @JsonProperty(value = "properties.endDate") + private OffsetDateTime endDate; + + /* + * Associated department. By default this is not populated, unless it's + * specified in $expand. + */ + @JsonProperty(value = "properties.department") + private Department department; + + /** + * Get the accountName property: The name of the enrollment account. + * + * @return the accountName value. + */ + public String accountName() { + return this.accountName; + } + + /** + * Set the accountName property: The name of the enrollment account. + * + * @param accountName the accountName value to set. + * @return the EnrollmentAccount object itself. + */ + public EnrollmentAccount withAccountName(String accountName) { + this.accountName = accountName; + return this; + } + + /** + * Get the costCenter property: The cost center associated with the enrollment account. + * + * @return the costCenter value. + */ + public String costCenter() { + return this.costCenter; + } + + /** + * Set the costCenter property: The cost center associated with the enrollment account. + * + * @param costCenter the costCenter value to set. + * @return the EnrollmentAccount object itself. + */ + public EnrollmentAccount withCostCenter(String costCenter) { + this.costCenter = costCenter; + return this; + } + + /** + * Get the accountOwner property: The owner of the enrollment account. + * + * @return the accountOwner value. + */ + public String accountOwner() { + return this.accountOwner; + } + + /** + * Set the accountOwner property: The owner of the enrollment account. + * + * @param accountOwner the accountOwner value to set. + * @return the EnrollmentAccount object itself. + */ + public EnrollmentAccount withAccountOwner(String accountOwner) { + this.accountOwner = accountOwner; + return this; + } + + /** + * Get the status property: The status of the enrollment account. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The status of the enrollment account. + * + * @param status the status value to set. + * @return the EnrollmentAccount object itself. + */ + public EnrollmentAccount withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the startDate property: The start date of the enrollment account. + * + * @return the startDate value. + */ + public OffsetDateTime startDate() { + return this.startDate; + } + + /** + * Set the startDate property: The start date of the enrollment account. + * + * @param startDate the startDate value to set. + * @return the EnrollmentAccount object itself. + */ + public EnrollmentAccount withStartDate(OffsetDateTime startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get the endDate property: The end date of the enrollment account. + * + * @return the endDate value. + */ + public OffsetDateTime endDate() { + return this.endDate; + } + + /** + * Set the endDate property: The end date of the enrollment account. + * + * @param endDate the endDate value to set. + * @return the EnrollmentAccount object itself. + */ + public EnrollmentAccount withEndDate(OffsetDateTime endDate) { + this.endDate = endDate; + return this; + } + + /** + * Get the department property: Associated department. By default this is not populated, unless it's specified in + * $expand. + * + * @return the department value. + */ + public Department department() { + return this.department; + } + + /** + * Set the department property: Associated department. By default this is not populated, unless it's specified in + * $expand. + * + * @param department the department value to set. + * @return the EnrollmentAccount object itself. + */ + public EnrollmentAccount withDepartment(Department department) { + this.department = department; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (department() != null) { + department().validate(); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/EnrollmentAccountListResult.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/EnrollmentAccountListResult.java new file mode 100644 index 0000000000000..76252ce9848ab --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/EnrollmentAccountListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.models.EnrollmentAccountSummaryInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of listing enrollment accounts. */ +@Immutable +public final class EnrollmentAccountListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EnrollmentAccountListResult.class); + + /* + * The list of enrollment accounts. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of enrollment accounts. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/EnrollmentAccountSummary.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/EnrollmentAccountSummary.java new file mode 100644 index 0000000000000..d3b01bf1360ec --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/EnrollmentAccountSummary.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.EnrollmentAccountSummaryInner; + +/** An immutable client-side representation of EnrollmentAccountSummary. */ +public interface EnrollmentAccountSummary { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the principalName property: The account owner's principal name. + * + * @return the principalName value. + */ + String principalName(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.EnrollmentAccountSummaryInner object. + * + * @return the inner object. + */ + EnrollmentAccountSummaryInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/EnrollmentAccounts.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/EnrollmentAccounts.java new file mode 100644 index 0000000000000..243221dcb5172 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/EnrollmentAccounts.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of EnrollmentAccounts. */ +public interface EnrollmentAccounts { + /** + * Lists the enrollment accounts the caller has access to. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing enrollment accounts. + */ + PagedIterable list(); + + /** + * Lists the enrollment accounts the caller has access to. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of listing enrollment accounts. + */ + PagedIterable list(Context context); + + /** + * Gets a enrollment account by name. + * + * @param name Enrollment Account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a enrollment account by name. + */ + EnrollmentAccountSummary get(String name); + + /** + * Gets a enrollment account by name. + * + * @param name Enrollment Account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a enrollment account by name. + */ + Response getWithResponse(String name, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/EnrollmentPolicies.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/EnrollmentPolicies.java new file mode 100644 index 0000000000000..48f003b6f7f18 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/EnrollmentPolicies.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The policies for Enterprise Agreement enrollments. */ +@Immutable +public final class EnrollmentPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EnrollmentPolicies.class); + + /* + * The policy that controls whether Account Owners can view charges. + */ + @JsonProperty(value = "accountOwnerViewCharges", access = JsonProperty.Access.WRITE_ONLY) + private Boolean accountOwnerViewCharges; + + /* + * The policy that controls whether Department Administrators can view + * charges. + */ + @JsonProperty(value = "departmentAdminViewCharges", access = JsonProperty.Access.WRITE_ONLY) + private Boolean departmentAdminViewCharges; + + /* + * The policy that controls whether Azure marketplace purchases are allowed + * in the enrollment. + */ + @JsonProperty(value = "marketplacesEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean marketplacesEnabled; + + /* + * The policy that controls whether Azure reservation purchases are allowed + * in the enrollment. + */ + @JsonProperty(value = "reservedInstancesEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean reservedInstancesEnabled; + + /** + * Get the accountOwnerViewCharges property: The policy that controls whether Account Owners can view charges. + * + * @return the accountOwnerViewCharges value. + */ + public Boolean accountOwnerViewCharges() { + return this.accountOwnerViewCharges; + } + + /** + * Get the departmentAdminViewCharges property: The policy that controls whether Department Administrators can view + * charges. + * + * @return the departmentAdminViewCharges value. + */ + public Boolean departmentAdminViewCharges() { + return this.departmentAdminViewCharges; + } + + /** + * Get the marketplacesEnabled property: The policy that controls whether Azure marketplace purchases are allowed in + * the enrollment. + * + * @return the marketplacesEnabled value. + */ + public Boolean marketplacesEnabled() { + return this.marketplacesEnabled; + } + + /** + * Get the reservedInstancesEnabled property: The policy that controls whether Azure reservation purchases are + * allowed in the enrollment. + * + * @return the reservedInstancesEnabled value. + */ + public Boolean reservedInstancesEnabled() { + return this.reservedInstancesEnabled; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ErrorSubDetailsItem.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ErrorSubDetailsItem.java new file mode 100644 index 0000000000000..01bb28f3950c8 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ErrorSubDetailsItem.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ErrorSubDetailsItem model. */ +@Immutable +public final class ErrorSubDetailsItem { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ErrorSubDetailsItem.class); + + /* + * 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 the code property: Error code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Get the message property: Error message indicating why the operation failed. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Get the target property: The target of the particular error. + * + * @return the target value. + */ + public String target() { + return this.target; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/IndirectRelationshipInfo.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/IndirectRelationshipInfo.java new file mode 100644 index 0000000000000..7a7349698cb17 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/IndirectRelationshipInfo.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The billing profile details of the partner of the customer for an indirect motion. */ +@Fluent +public final class IndirectRelationshipInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IndirectRelationshipInfo.class); + + /* + * The billing account name of the partner or the customer for an indirect + * motion. + */ + @JsonProperty(value = "billingAccountName") + private String billingAccountName; + + /* + * The billing profile name of the partner or the customer for an indirect + * motion. + */ + @JsonProperty(value = "billingProfileName") + private String billingProfileName; + + /* + * The display name of the partner or customer for an indirect motion. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Get the billingAccountName property: The billing account name of the partner or the customer for an indirect + * motion. + * + * @return the billingAccountName value. + */ + public String billingAccountName() { + return this.billingAccountName; + } + + /** + * Set the billingAccountName property: The billing account name of the partner or the customer for an indirect + * motion. + * + * @param billingAccountName the billingAccountName value to set. + * @return the IndirectRelationshipInfo object itself. + */ + public IndirectRelationshipInfo withBillingAccountName(String billingAccountName) { + this.billingAccountName = billingAccountName; + return this; + } + + /** + * Get the billingProfileName property: The billing profile name of the partner or the customer for an indirect + * motion. + * + * @return the billingProfileName value. + */ + public String billingProfileName() { + return this.billingProfileName; + } + + /** + * Set the billingProfileName property: The billing profile name of the partner or the customer for an indirect + * motion. + * + * @param billingProfileName the billingProfileName value to set. + * @return the IndirectRelationshipInfo object itself. + */ + public IndirectRelationshipInfo withBillingProfileName(String billingProfileName) { + this.billingProfileName = billingProfileName; + return this; + } + + /** + * Get the displayName property: The display name of the partner or customer for an indirect motion. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name of the partner or customer for an indirect motion. + * + * @param displayName the displayName value to set. + * @return the IndirectRelationshipInfo object itself. + */ + public IndirectRelationshipInfo withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Instruction.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Instruction.java new file mode 100644 index 0000000000000..ea9e72c4c0ff7 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Instruction.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.InstructionInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of Instruction. */ +public interface Instruction { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the amount property: The amount budgeted for this billing instruction. + * + * @return the amount value. + */ + Float amount(); + + /** + * Gets the startDate property: The date this billing instruction goes into effect. + * + * @return the startDate value. + */ + OffsetDateTime startDate(); + + /** + * Gets the endDate property: The date this billing instruction is no longer in effect. + * + * @return the endDate value. + */ + OffsetDateTime endDate(); + + /** + * Gets the creationDate property: The date this billing instruction was created. + * + * @return the creationDate value. + */ + OffsetDateTime creationDate(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.InstructionInner object. + * + * @return the inner object. + */ + InstructionInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InstructionListResult.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InstructionListResult.java new file mode 100644 index 0000000000000..ffa38b2217d03 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InstructionListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.models.InstructionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of billing instructions used during invoice generation. */ +@Immutable +public final class InstructionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InstructionListResult.class); + + /* + * The list of billing instructions used during invoice generation. + */ + @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 value property: The list of billing instructions used during invoice generation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Instructions.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Instructions.java new file mode 100644 index 0000000000000..c103d55aac7b9 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Instructions.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.billing.fluent.models.InstructionInner; + +/** Resource collection API of Instructions. */ +public interface Instructions { + /** + * Lists the instructions by billing profile id. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing instructions used during invoice generation. + */ + PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName); + + /** + * Lists the instructions by billing profile id. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing instructions used during invoice generation. + */ + PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context); + + /** + * Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instruction by name. + */ + Instruction get(String billingAccountName, String billingProfileName, String instructionName); + + /** + * Get the instruction by name. These are custom billing instructions and are only applicable for certain customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the instruction by name. + */ + Response getWithResponse( + String billingAccountName, String billingProfileName, String instructionName, Context context); + + /** + * Creates or updates an instruction. These are custom billing instructions and are only applicable for certain + * customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @param parameters The new instruction. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instruction. + */ + Instruction put( + String billingAccountName, String billingProfileName, String instructionName, InstructionInner parameters); + + /** + * Creates or updates an instruction. These are custom billing instructions and are only applicable for certain + * customers. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param instructionName Instruction Name. + * @param parameters The new instruction. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an instruction. + */ + Response putWithResponse( + String billingAccountName, + String billingProfileName, + String instructionName, + InstructionInner parameters, + Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Invoice.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Invoice.java new file mode 100644 index 0000000000000..2a6232c366666 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Invoice.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.InvoiceInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of Invoice. */ +public interface Invoice { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the dueDate property: The due date for the invoice. + * + * @return the dueDate value. + */ + OffsetDateTime dueDate(); + + /** + * Gets the invoiceDate property: The date when the invoice was generated. + * + * @return the invoiceDate value. + */ + OffsetDateTime invoiceDate(); + + /** + * Gets the status property: The current status of the invoice. + * + * @return the status value. + */ + InvoiceStatus status(); + + /** + * Gets the amountDue property: The amount due as of now. + * + * @return the amountDue value. + */ + Amount amountDue(); + + /** + * Gets the azurePrepaymentApplied property: The amount of Azure prepayment applied to the charges. This field is + * applicable to billing accounts with agreement type Microsoft Customer Agreement. + * + * @return the azurePrepaymentApplied value. + */ + Amount azurePrepaymentApplied(); + + /** + * Gets the billedAmount property: The total charges for the invoice billing period. + * + * @return the billedAmount value. + */ + Amount billedAmount(); + + /** + * Gets the creditAmount property: The total refund for returns and cancellations during the invoice billing period. + * This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. + * + * @return the creditAmount value. + */ + Amount creditAmount(); + + /** + * Gets the freeAzureCreditApplied property: The amount of free Azure credits applied to the charges. This field is + * applicable to billing accounts with agreement type Microsoft Customer Agreement. + * + * @return the freeAzureCreditApplied value. + */ + Amount freeAzureCreditApplied(); + + /** + * Gets the subTotal property: The pre-tax amount due. This field is applicable to billing accounts with agreement + * type Microsoft Customer Agreement. + * + * @return the subTotal value. + */ + Amount subTotal(); + + /** + * Gets the taxAmount property: The amount of tax charged for the billing period. This field is applicable to + * billing accounts with agreement type Microsoft Customer Agreement. + * + * @return the taxAmount value. + */ + Amount taxAmount(); + + /** + * Gets the totalAmount property: The amount due when the invoice was generated. This field is applicable to billing + * accounts with agreement type Microsoft Customer Agreement. + * + * @return the totalAmount value. + */ + Amount totalAmount(); + + /** + * Gets the invoicePeriodStartDate property: The start date of the billing period for which the invoice is + * generated. + * + * @return the invoicePeriodStartDate value. + */ + OffsetDateTime invoicePeriodStartDate(); + + /** + * Gets the invoicePeriodEndDate property: The end date of the billing period for which the invoice is generated. + * + * @return the invoicePeriodEndDate value. + */ + OffsetDateTime invoicePeriodEndDate(); + + /** + * Gets the invoiceType property: Invoice type. + * + * @return the invoiceType value. + */ + InvoiceType invoiceType(); + + /** + * Gets the isMonthlyInvoice property: Specifies if the invoice is generated as part of monthly invoicing cycle or + * not. This field is applicable to billing accounts with agreement type Microsoft Customer Agreement. + * + * @return the isMonthlyInvoice value. + */ + Boolean isMonthlyInvoice(); + + /** + * Gets the billingProfileId property: The ID of the billing profile for which the invoice is generated. + * + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * Gets the billingProfileDisplayName property: The name of the billing profile for which the invoice is generated. + * + * @return the billingProfileDisplayName value. + */ + String billingProfileDisplayName(); + + /** + * Gets the purchaseOrderNumber property: An optional purchase order number for the invoice. + * + * @return the purchaseOrderNumber value. + */ + String purchaseOrderNumber(); + + /** + * Gets the documents property: List of documents available to download such as invoice and tax receipt. + * + * @return the documents value. + */ + List documents(); + + /** + * Gets the payments property: List of payments. + * + * @return the payments value. + */ + List payments(); + + /** + * Gets the rebillDetails property: Rebill details for an invoice. + * + * @return the rebillDetails value. + */ + Map rebillDetails(); + + /** + * Gets the documentType property: The type of the document. + * + * @return the documentType value. + */ + InvoiceDocumentType documentType(); + + /** + * Gets the billedDocumentId property: The Id of the active invoice which is originally billed after this invoice + * was voided. This field is applicable to the void invoices only. + * + * @return the billedDocumentId value. + */ + String billedDocumentId(); + + /** + * Gets the creditForDocumentId property: The Id of the invoice which got voided and this credit note was issued as + * a result. This field is applicable to the credit notes only. + * + * @return the creditForDocumentId value. + */ + String creditForDocumentId(); + + /** + * Gets the subscriptionId property: The ID of the subscription for which the invoice is generated. + * + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.InvoiceInner object. + * + * @return the inner object. + */ + InvoiceInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceDocumentType.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceDocumentType.java new file mode 100644 index 0000000000000..9f0fec604b55f --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceDocumentType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for InvoiceDocumentType. */ +public final class InvoiceDocumentType extends ExpandableStringEnum { + /** Static value Invoice for InvoiceDocumentType. */ + public static final InvoiceDocumentType INVOICE = fromString("Invoice"); + + /** Static value CreditNote for InvoiceDocumentType. */ + public static final InvoiceDocumentType CREDIT_NOTE = fromString("CreditNote"); + + /** + * Creates or finds a InvoiceDocumentType from its string representation. + * + * @param name a name to look for. + * @return the corresponding InvoiceDocumentType. + */ + @JsonCreator + public static InvoiceDocumentType fromString(String name) { + return fromString(name, InvoiceDocumentType.class); + } + + /** @return known InvoiceDocumentType values. */ + public static Collection values() { + return values(InvoiceDocumentType.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceListResult.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceListResult.java new file mode 100644 index 0000000000000..d4b590e7e985f --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.models.InvoiceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of invoices. */ +@Immutable +public final class InvoiceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InvoiceListResult.class); + + /* + * The list of invoices. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of invoices. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSection.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSection.java new file mode 100644 index 0000000000000..134cbbd892ae1 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSection.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.InvoiceSectionInner; +import java.util.Map; + +/** An immutable client-side representation of InvoiceSection. */ +public interface InvoiceSection { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the displayName property: The name of the invoice section. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the labels property: Dictionary of metadata associated with the invoice section. + * + * @return the labels value. + */ + Map labels(); + + /** + * Gets the state property: Identifies the state of an invoice section. + * + * @return the state value. + */ + InvoiceSectionState state(); + + /** + * Gets the systemId property: The system generated unique identifier for an invoice section. + * + * @return the systemId value. + */ + String systemId(); + + /** + * Gets the targetCloud property: Identifies the cloud environments that are associated with an invoice section. + * This is a system managed optional field and gets updated as the invoice section gets associated with accounts in + * various clouds. + * + * @return the targetCloud value. + */ + TargetCloud targetCloud(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.InvoiceSectionInner object. + * + * @return the inner object. + */ + InvoiceSectionInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionListResult.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionListResult.java new file mode 100644 index 0000000000000..135f8e9ee1137 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.models.InvoiceSectionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of invoice sections. */ +@Immutable +public final class InvoiceSectionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InvoiceSectionListResult.class); + + /* + * 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 value property: The list of invoice sections. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionListWithCreateSubPermissionResult.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionListWithCreateSubPermissionResult.java new file mode 100644 index 0000000000000..b08686544b67b --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionListWithCreateSubPermissionResult.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.models.InvoiceSectionWithCreateSubPermissionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of invoice section properties with create subscription permission. */ +@Fluent +public final class InvoiceSectionListWithCreateSubPermissionResult { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(InvoiceSectionListWithCreateSubPermissionResult.class); + + /* + * The list of invoice section properties with create subscription + * permission. + */ + @JsonProperty(value = "value") + 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 value property: The list of invoice section properties with create subscription permission. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of invoice section properties with create subscription permission. + * + * @param value the value value to set. + * @return the InvoiceSectionListWithCreateSubPermissionResult object itself. + */ + public InvoiceSectionListWithCreateSubPermissionResult withValue( + List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionState.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionState.java new file mode 100644 index 0000000000000..cf4620ae22945 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionState.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for InvoiceSectionState. */ +public final class InvoiceSectionState extends ExpandableStringEnum { + /** Static value Active for InvoiceSectionState. */ + public static final InvoiceSectionState ACTIVE = fromString("Active"); + + /** Static value Restricted for InvoiceSectionState. */ + public static final InvoiceSectionState RESTRICTED = fromString("Restricted"); + + /** + * Creates or finds a InvoiceSectionState from its string representation. + * + * @param name a name to look for. + * @return the corresponding InvoiceSectionState. + */ + @JsonCreator + public static InvoiceSectionState fromString(String name) { + return fromString(name, InvoiceSectionState.class); + } + + /** @return known InvoiceSectionState values. */ + public static Collection values() { + return values(InvoiceSectionState.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionWithCreateSubPermission.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionWithCreateSubPermission.java new file mode 100644 index 0000000000000..0ec3115c1bcc3 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionWithCreateSubPermission.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.InvoiceSectionWithCreateSubPermissionInner; +import java.util.List; + +/** An immutable client-side representation of InvoiceSectionWithCreateSubPermission. */ +public interface InvoiceSectionWithCreateSubPermission { + /** + * Gets the invoiceSectionId property: The ID of the invoice section. + * + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * Gets the invoiceSectionDisplayName property: The name of the invoice section. + * + * @return the invoiceSectionDisplayName value. + */ + String invoiceSectionDisplayName(); + + /** + * Gets the invoiceSectionSystemId property: The system generated unique identifier for an invoice section. + * + * @return the invoiceSectionSystemId value. + */ + String invoiceSectionSystemId(); + + /** + * Gets the billingProfileId property: The ID of the billing profile for the invoice section. + * + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * Gets the billingProfileDisplayName property: The name of the billing profile for the invoice section. + * + * @return the billingProfileDisplayName value. + */ + String billingProfileDisplayName(); + + /** + * Gets the billingProfileStatus property: The status of the billing profile. + * + * @return the billingProfileStatus value. + */ + BillingProfileStatus billingProfileStatus(); + + /** + * Gets the billingProfileStatusReasonCode property: Reason for the specified billing profile status. + * + * @return the billingProfileStatusReasonCode value. + */ + StatusReasonCodeForBillingProfile billingProfileStatusReasonCode(); + + /** + * Gets the billingProfileSpendingLimit property: The billing profile spending limit. + * + * @return the billingProfileSpendingLimit value. + */ + SpendingLimitForBillingProfile billingProfileSpendingLimit(); + + /** + * Gets the billingProfileSystemId property: The system generated unique identifier for a billing profile. + * + * @return the billingProfileSystemId value. + */ + String billingProfileSystemId(); + + /** + * Gets the enabledAzurePlans property: Enabled azure plans for the associated billing profile. + * + * @return the enabledAzurePlans value. + */ + List enabledAzurePlans(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.InvoiceSectionWithCreateSubPermissionInner object. + * + * @return the inner object. + */ + InvoiceSectionWithCreateSubPermissionInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSections.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSections.java new file mode 100644 index 0000000000000..b76e9dad4aed1 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSections.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.billing.fluent.models.InvoiceSectionInner; + +/** Resource collection API of InvoiceSections. */ +public interface InvoiceSections { + /** + * Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice sections. + */ + PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName); + + /** + * Lists the invoice sections that a user has access to. The operation is supported only for billing accounts with + * agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoice sections. + */ + PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, Context context); + + /** + * Gets an invoice section by its ID. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section by its ID. + */ + InvoiceSection get(String billingAccountName, String billingProfileName, String invoiceSectionName); + + /** + * Gets an invoice section by its ID. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section by its ID. + */ + Response getWithResponse( + String billingAccountName, String billingProfileName, String invoiceSectionName, Context context); + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section. + */ + InvoiceSection createOrUpdate( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + InvoiceSectionInner parameters); + + /** + * Creates or updates an invoice section. The operation is supported only for billing accounts with agreement type + * Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param parameters The new or updated invoice section. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice section. + */ + InvoiceSection createOrUpdate( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + InvoiceSectionInner parameters, + Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionsCreateOrUpdateHeaders.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionsCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..393d88051acad --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionsCreateOrUpdateHeaders.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The InvoiceSectionsCreateOrUpdateHeaders model. */ +@Fluent +public final class InvoiceSectionsCreateOrUpdateHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InvoiceSectionsCreateOrUpdateHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the InvoiceSectionsCreateOrUpdateHeaders object itself. + */ + public InvoiceSectionsCreateOrUpdateHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the InvoiceSectionsCreateOrUpdateHeaders object itself. + */ + public InvoiceSectionsCreateOrUpdateHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionsCreateOrUpdateResponse.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionsCreateOrUpdateResponse.java new file mode 100644 index 0000000000000..d340d6d03edac --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionsCreateOrUpdateResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.billing.fluent.models.InvoiceSectionInner; + +/** Contains all response data for the createOrUpdate operation. */ +public final class InvoiceSectionsCreateOrUpdateResponse + extends ResponseBase { + /** + * Creates an instance of InvoiceSectionsCreateOrUpdateResponse. + * + * @param request the request which resulted in this InvoiceSectionsCreateOrUpdateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public InvoiceSectionsCreateOrUpdateResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + InvoiceSectionInner value, + InvoiceSectionsCreateOrUpdateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public InvoiceSectionInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionsOnExpand.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionsOnExpand.java new file mode 100644 index 0000000000000..fe8e65e1c1653 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceSectionsOnExpand.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.models.InvoiceSectionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The invoice sections associated to the billing profile. By default this is not populated, unless it's specified in + * $expand. + */ +@Fluent +public final class InvoiceSectionsOnExpand { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InvoiceSectionsOnExpand.class); + + /* + * Indicates whether there are more invoice sections than the ones listed + * in this collection. The collection lists a maximum of 50 invoice + * sections. To get all invoice sections, use the list invoice sections + * API. + */ + @JsonProperty(value = "hasMoreResults", access = JsonProperty.Access.WRITE_ONLY) + private Boolean hasMoreResults; + + /* + * The invoice sections associated to the billing profile. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the hasMoreResults property: Indicates whether there are more invoice sections than the ones listed in this + * collection. The collection lists a maximum of 50 invoice sections. To get all invoice sections, use the list + * invoice sections API. + * + * @return the hasMoreResults value. + */ + public Boolean hasMoreResults() { + return this.hasMoreResults; + } + + /** + * Get the value property: The invoice sections associated to the billing profile. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The invoice sections associated to the billing profile. + * + * @param value the value value to set. + * @return the InvoiceSectionsOnExpand object itself. + */ + public InvoiceSectionsOnExpand withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceStatus.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceStatus.java new file mode 100644 index 0000000000000..0bed6fdc47493 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceStatus.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for InvoiceStatus. */ +public final class InvoiceStatus extends ExpandableStringEnum { + /** Static value Due for InvoiceStatus. */ + public static final InvoiceStatus DUE = fromString("Due"); + + /** Static value OverDue for InvoiceStatus. */ + public static final InvoiceStatus OVER_DUE = fromString("OverDue"); + + /** Static value Paid for InvoiceStatus. */ + public static final InvoiceStatus PAID = fromString("Paid"); + + /** Static value Void for InvoiceStatus. */ + public static final InvoiceStatus VOID = fromString("Void"); + + /** + * Creates or finds a InvoiceStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding InvoiceStatus. + */ + @JsonCreator + public static InvoiceStatus fromString(String name) { + return fromString(name, InvoiceStatus.class); + } + + /** @return known InvoiceStatus values. */ + public static Collection values() { + return values(InvoiceStatus.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceType.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceType.java new file mode 100644 index 0000000000000..b548529d1392a --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoiceType.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for InvoiceType. */ +public final class InvoiceType extends ExpandableStringEnum { + /** Static value AzureService for InvoiceType. */ + public static final InvoiceType AZURE_SERVICE = fromString("AzureService"); + + /** Static value AzureMarketplace for InvoiceType. */ + public static final InvoiceType AZURE_MARKETPLACE = fromString("AzureMarketplace"); + + /** Static value AzureSupport for InvoiceType. */ + public static final InvoiceType AZURE_SUPPORT = fromString("AzureSupport"); + + /** + * Creates or finds a InvoiceType from its string representation. + * + * @param name a name to look for. + * @return the corresponding InvoiceType. + */ + @JsonCreator + public static InvoiceType fromString(String name) { + return fromString(name, InvoiceType.class); + } + + /** @return known InvoiceType values. */ + public static Collection values() { + return values(InvoiceType.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Invoices.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Invoices.java new file mode 100644 index 0000000000000..a505ffbd0fba1 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Invoices.java @@ -0,0 +1,288 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.List; + +/** Resource collection API of Invoices. */ +public interface Invoices { + /** + * Lists the invoices for a billing account for a given start date and end date. The operation is supported for + * billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + PagedIterable listByBillingAccount( + String billingAccountName, String periodStartDate, String periodEndDate); + + /** + * Lists the invoices for a billing account for a given start date and end date. The operation is supported for + * billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + PagedIterable listByBillingAccount( + String billingAccountName, String periodStartDate, String periodEndDate, Context context); + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for + * billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, String periodStartDate, String periodEndDate); + + /** + * Lists the invoices for a billing profile for a given start date and end date. The operation is supported for + * billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param periodEndDate The end date to fetch the invoices. The date should be specified in MM-DD-YYYY format. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + PagedIterable listByBillingProfile( + String billingAccountName, + String billingProfileName, + String periodStartDate, + String periodEndDate, + Context context); + + /** + * Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by billing account name and ID. + */ + Invoice get(String billingAccountName, String invoiceName); + + /** + * Gets an invoice by billing account name and ID. The operation is supported for billing accounts with agreement + * type Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by billing account name and ID. + */ + Response getWithResponse(String billingAccountName, String invoiceName, Context context); + + /** + * Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner + * Agreement or Microsoft Customer Agreement. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by ID. + */ + Invoice getById(String invoiceName); + + /** + * Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner + * Agreement or Microsoft Customer Agreement. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by ID. + */ + Response getByIdWithResponse(String invoiceName, Context context); + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft + * Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + DownloadUrl downloadInvoice(String billingAccountName, String invoiceName, String downloadToken); + + /** + * Gets a URL to download an invoice. The operation is supported for billing accounts with agreement type Microsoft + * Partner Agreement or Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + DownloadUrl downloadInvoice(String billingAccountName, String invoiceName, String downloadToken, Context context); + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The + * operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + DownloadUrl downloadMultipleBillingProfileInvoices(String billingAccountName, List downloadUrls); + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. The + * operation is supported for billing accounts with agreement type Microsoft Partner Agreement or Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param downloadUrls An array of download urls for individual documents. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + DownloadUrl downloadMultipleBillingProfileInvoices( + String billingAccountName, List downloadUrls, Context context); + + /** + * Lists the invoices for a subscription. + * + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + PagedIterable listByBillingSubscription(String periodStartDate, String periodEndDate); + + /** + * Lists the invoices for a subscription. + * + * @param periodStartDate Invoice period start date. + * @param periodEndDate Invoice period end date. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of invoices. + */ + PagedIterable listByBillingSubscription(String periodStartDate, String periodEndDate, Context context); + + /** + * Gets an invoice by subscription ID and invoice ID. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by subscription ID and invoice ID. + */ + Invoice getBySubscriptionAndInvoiceId(String invoiceName); + + /** + * Gets an invoice by subscription ID and invoice ID. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an invoice by subscription ID and invoice ID. + */ + Response getBySubscriptionAndInvoiceIdWithResponse(String invoiceName, Context context); + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + DownloadUrl downloadBillingSubscriptionInvoice(String invoiceName, String downloadToken); + + /** + * Gets a URL to download an invoice. + * + * @param invoiceName The ID that uniquely identifies an invoice. + * @param downloadToken Download token with document source and document ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download an invoice. + */ + DownloadUrl downloadBillingSubscriptionInvoice(String invoiceName, String downloadToken, Context context); + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + DownloadUrl downloadMultipleBillingSubscriptionInvoices(List downloadUrls); + + /** + * Gets a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + * + * @param downloadUrls An array of download urls for individual documents. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file. + */ + DownloadUrl downloadMultipleBillingSubscriptionInvoices(List downloadUrls, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadBillingSubscriptionInvoiceHeaders.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadBillingSubscriptionInvoiceHeaders.java new file mode 100644 index 0000000000000..8fc84163d9a30 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadBillingSubscriptionInvoiceHeaders.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The InvoicesDownloadBillingSubscriptionInvoiceHeaders model. */ +@Fluent +public final class InvoicesDownloadBillingSubscriptionInvoiceHeaders { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(InvoicesDownloadBillingSubscriptionInvoiceHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the InvoicesDownloadBillingSubscriptionInvoiceHeaders object itself. + */ + public InvoicesDownloadBillingSubscriptionInvoiceHeaders withRetryAfter(String retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the InvoicesDownloadBillingSubscriptionInvoiceHeaders object itself. + */ + public InvoicesDownloadBillingSubscriptionInvoiceHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadBillingSubscriptionInvoiceResponse.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadBillingSubscriptionInvoiceResponse.java new file mode 100644 index 0000000000000..6962b97d010c8 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadBillingSubscriptionInvoiceResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.billing.fluent.models.DownloadUrlInner; + +/** Contains all response data for the downloadBillingSubscriptionInvoice operation. */ +public final class InvoicesDownloadBillingSubscriptionInvoiceResponse + extends ResponseBase { + /** + * Creates an instance of InvoicesDownloadBillingSubscriptionInvoiceResponse. + * + * @param request the request which resulted in this InvoicesDownloadBillingSubscriptionInvoiceResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public InvoicesDownloadBillingSubscriptionInvoiceResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + DownloadUrlInner value, + InvoicesDownloadBillingSubscriptionInvoiceHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public DownloadUrlInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadInvoiceHeaders.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadInvoiceHeaders.java new file mode 100644 index 0000000000000..80bc52a4bc68a --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadInvoiceHeaders.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The InvoicesDownloadInvoiceHeaders model. */ +@Fluent +public final class InvoicesDownloadInvoiceHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InvoicesDownloadInvoiceHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the InvoicesDownloadInvoiceHeaders object itself. + */ + public InvoicesDownloadInvoiceHeaders withRetryAfter(String retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the InvoicesDownloadInvoiceHeaders object itself. + */ + public InvoicesDownloadInvoiceHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadInvoiceResponse.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadInvoiceResponse.java new file mode 100644 index 0000000000000..f188f1e503a7c --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadInvoiceResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.billing.fluent.models.DownloadUrlInner; + +/** Contains all response data for the downloadInvoice operation. */ +public final class InvoicesDownloadInvoiceResponse + extends ResponseBase { + /** + * Creates an instance of InvoicesDownloadInvoiceResponse. + * + * @param request the request which resulted in this InvoicesDownloadInvoiceResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public InvoicesDownloadInvoiceResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + DownloadUrlInner value, + InvoicesDownloadInvoiceHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public DownloadUrlInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadMultipleBillingProfileInvoicesHeaders.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadMultipleBillingProfileInvoicesHeaders.java new file mode 100644 index 0000000000000..cff7c6478db0a --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadMultipleBillingProfileInvoicesHeaders.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The InvoicesDownloadMultipleBillingProfileInvoicesHeaders model. */ +@Fluent +public final class InvoicesDownloadMultipleBillingProfileInvoicesHeaders { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(InvoicesDownloadMultipleBillingProfileInvoicesHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the InvoicesDownloadMultipleBillingProfileInvoicesHeaders object itself. + */ + public InvoicesDownloadMultipleBillingProfileInvoicesHeaders withRetryAfter(String retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the InvoicesDownloadMultipleBillingProfileInvoicesHeaders object itself. + */ + public InvoicesDownloadMultipleBillingProfileInvoicesHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadMultipleBillingProfileInvoicesResponse.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadMultipleBillingProfileInvoicesResponse.java new file mode 100644 index 0000000000000..8338b78302549 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadMultipleBillingProfileInvoicesResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.billing.fluent.models.DownloadUrlInner; + +/** Contains all response data for the downloadMultipleBillingProfileInvoices operation. */ +public final class InvoicesDownloadMultipleBillingProfileInvoicesResponse + extends ResponseBase { + /** + * Creates an instance of InvoicesDownloadMultipleBillingProfileInvoicesResponse. + * + * @param request the request which resulted in this InvoicesDownloadMultipleBillingProfileInvoicesResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public InvoicesDownloadMultipleBillingProfileInvoicesResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + DownloadUrlInner value, + InvoicesDownloadMultipleBillingProfileInvoicesHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public DownloadUrlInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders.java new file mode 100644 index 0000000000000..4e6063d83b429 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders model. */ +@Fluent +public final class InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders { + @JsonIgnore + private final ClientLogger logger = + new ClientLogger(InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private String retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public String retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders object itself. + */ + public InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders withRetryAfter(String retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders object itself. + */ + public InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadMultipleBillingSubscriptionInvoicesResponse.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadMultipleBillingSubscriptionInvoicesResponse.java new file mode 100644 index 0000000000000..42e5dd1cffe65 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/InvoicesDownloadMultipleBillingSubscriptionInvoicesResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.billing.fluent.models.DownloadUrlInner; + +/** Contains all response data for the downloadMultipleBillingSubscriptionInvoices operation. */ +public final class InvoicesDownloadMultipleBillingSubscriptionInvoicesResponse + extends ResponseBase { + /** + * Creates an instance of InvoicesDownloadMultipleBillingSubscriptionInvoicesResponse. + * + * @param request the request which resulted in this InvoicesDownloadMultipleBillingSubscriptionInvoicesResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public InvoicesDownloadMultipleBillingSubscriptionInvoicesResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + DownloadUrlInner value, + InvoicesDownloadMultipleBillingSubscriptionInvoicesHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public DownloadUrlInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/MarketplacePurchasesPolicy.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/MarketplacePurchasesPolicy.java new file mode 100644 index 0000000000000..6ab3dbfabc315 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/MarketplacePurchasesPolicy.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for MarketplacePurchasesPolicy. */ +public final class MarketplacePurchasesPolicy extends ExpandableStringEnum { + /** Static value AllAllowed for MarketplacePurchasesPolicy. */ + public static final MarketplacePurchasesPolicy ALL_ALLOWED = fromString("AllAllowed"); + + /** Static value OnlyFreeAllowed for MarketplacePurchasesPolicy. */ + public static final MarketplacePurchasesPolicy ONLY_FREE_ALLOWED = fromString("OnlyFreeAllowed"); + + /** Static value NotAllowed for MarketplacePurchasesPolicy. */ + public static final MarketplacePurchasesPolicy NOT_ALLOWED = fromString("NotAllowed"); + + /** + * Creates or finds a MarketplacePurchasesPolicy from its string representation. + * + * @param name a name to look for. + * @return the corresponding MarketplacePurchasesPolicy. + */ + @JsonCreator + public static MarketplacePurchasesPolicy fromString(String name) { + return fromString(name, MarketplacePurchasesPolicy.class); + } + + /** @return known MarketplacePurchasesPolicy values. */ + public static Collection values() { + return values(MarketplacePurchasesPolicy.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Operation.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Operation.java new file mode 100644 index 0000000000000..1b689b7eebdea --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Operation.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The object that represents the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/OperationDisplay.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/OperationDisplay.java new file mode 100644 index 0000000000000..58968f4b45eb5 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/OperationDisplay.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The object that represents the operation. */ +@Immutable +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * Service provider: Microsoft.Billing. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * Resource on which the operation is performed such as invoice and billing + * subscription. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * Operation type such as read, write and delete. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get the provider property: Service provider: Microsoft.Billing. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: Resource on which the operation is performed such as invoice and billing subscription. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: Operation type such as read, write and delete. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/OperationListResult.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/OperationListResult.java new file mode 100644 index 0000000000000..f6e3f2abf305c --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/OperationListResult.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of billing operations and a URL link to get the next set of results. */ +@Immutable +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * The list of billing operations supported by the Microsoft.Billing + * resource provider. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of billing operations supported by the Microsoft.Billing resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Operations.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Operations.java new file mode 100644 index 0000000000000..92c83f2661d8c --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists the available billing REST API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing operations and a URL link to get the next set of results. + */ + PagedIterable list(); + + /** + * Lists the available billing REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of billing operations and a URL link to get the next set of results. + */ + PagedIterable list(Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Participants.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Participants.java new file mode 100644 index 0000000000000..520774a3bb4ba --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Participants.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The details about a participant. */ +@Immutable +public final class Participants { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Participants.class); + + /* + * The acceptance status of the participant. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * The date when the status got changed. + */ + @JsonProperty(value = "statusDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime statusDate; + + /* + * The email address of the participant. + */ + @JsonProperty(value = "email", access = JsonProperty.Access.WRITE_ONLY) + private String email; + + /** + * Get the status property: The acceptance status of the participant. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the statusDate property: The date when the status got changed. + * + * @return the statusDate value. + */ + public OffsetDateTime statusDate() { + return this.statusDate; + } + + /** + * Get the email property: The email address of the participant. + * + * @return the email value. + */ + public String email() { + return this.email; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/PaymentMethodFamily.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/PaymentMethodFamily.java new file mode 100644 index 0000000000000..d7626062ca7ec --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/PaymentMethodFamily.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PaymentMethodFamily. */ +public final class PaymentMethodFamily extends ExpandableStringEnum { + /** Static value Credits for PaymentMethodFamily. */ + public static final PaymentMethodFamily CREDITS = fromString("Credits"); + + /** Static value CheckWire for PaymentMethodFamily. */ + public static final PaymentMethodFamily CHECK_WIRE = fromString("CheckWire"); + + /** Static value CreditCard for PaymentMethodFamily. */ + public static final PaymentMethodFamily CREDIT_CARD = fromString("CreditCard"); + + /** Static value None for PaymentMethodFamily. */ + public static final PaymentMethodFamily NONE = fromString("None"); + + /** + * Creates or finds a PaymentMethodFamily from its string representation. + * + * @param name a name to look for. + * @return the corresponding PaymentMethodFamily. + */ + @JsonCreator + public static PaymentMethodFamily fromString(String name) { + return fromString(name, PaymentMethodFamily.class); + } + + /** @return known PaymentMethodFamily values. */ + public static Collection values() { + return values(PaymentMethodFamily.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/PaymentProperties.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/PaymentProperties.java new file mode 100644 index 0000000000000..c8fc84a8640dc --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/PaymentProperties.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The properties of a payment. */ +@Fluent +public final class PaymentProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PaymentProperties.class); + + /* + * The type of payment. + */ + @JsonProperty(value = "paymentType", access = JsonProperty.Access.WRITE_ONLY) + private String paymentType; + + /* + * The paid amount. + */ + @JsonProperty(value = "amount", access = JsonProperty.Access.WRITE_ONLY) + private Amount amount; + + /* + * The date when the payment was made. + */ + @JsonProperty(value = "date", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime date; + + /* + * The family of payment method. + */ + @JsonProperty(value = "paymentMethodFamily") + private PaymentMethodFamily paymentMethodFamily; + + /* + * The type of payment method. + */ + @JsonProperty(value = "paymentMethodType", access = JsonProperty.Access.WRITE_ONLY) + private String paymentMethodType; + + /** + * Get the paymentType property: The type of payment. + * + * @return the paymentType value. + */ + public String paymentType() { + return this.paymentType; + } + + /** + * Get the amount property: The paid amount. + * + * @return the amount value. + */ + public Amount amount() { + return this.amount; + } + + /** + * Get the date property: The date when the payment was made. + * + * @return the date value. + */ + public OffsetDateTime date() { + return this.date; + } + + /** + * Get the paymentMethodFamily property: The family of payment method. + * + * @return the paymentMethodFamily value. + */ + public PaymentMethodFamily paymentMethodFamily() { + return this.paymentMethodFamily; + } + + /** + * Set the paymentMethodFamily property: The family of payment method. + * + * @param paymentMethodFamily the paymentMethodFamily value to set. + * @return the PaymentProperties object itself. + */ + public PaymentProperties withPaymentMethodFamily(PaymentMethodFamily paymentMethodFamily) { + this.paymentMethodFamily = paymentMethodFamily; + return this; + } + + /** + * Get the paymentMethodType property: The type of payment method. + * + * @return the paymentMethodType value. + */ + public String paymentMethodType() { + return this.paymentMethodType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (amount() != null) { + amount().validate(); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Policies.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Policies.java new file mode 100644 index 0000000000000..fa5e41f1795e6 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Policies.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.billing.fluent.models.CustomerPolicyInner; +import com.azure.resourcemanager.billing.fluent.models.PolicyInner; + +/** Resource collection API of Policies. */ +public interface Policies { + /** + * Lists the policies for a billing profile. This operation is supported only for billing accounts with agreement + * type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a policy. + */ + Policy getByBillingProfile(String billingAccountName, String billingProfileName); + + /** + * Lists the policies for a billing profile. This operation is supported only for billing accounts with agreement + * type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a policy. + */ + Response getByBillingProfileWithResponse( + String billingAccountName, String billingProfileName, Context context); + + /** + * Updates the policies for a billing profile. This operation is supported only for billing accounts with agreement + * type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters Request parameters that are provided to the update policies operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a policy. + */ + Policy update(String billingAccountName, String billingProfileName, PolicyInner parameters); + + /** + * Updates the policies for a billing profile. This operation is supported only for billing accounts with agreement + * type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param parameters Request parameters that are provided to the update policies operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a policy. + */ + Response updateWithResponse( + String billingAccountName, String billingProfileName, PolicyInner parameters, Context context); + + /** + * Lists the policies for a customer. This operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the customer's Policy. + */ + CustomerPolicy getByCustomer(String billingAccountName, String customerName); + + /** + * Lists the policies for a customer. This operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the customer's Policy. + */ + Response getByCustomerWithResponse(String billingAccountName, String customerName, Context context); + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param parameters Request parameters that are provided to the update policies operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the customer's Policy. + */ + CustomerPolicy updateCustomer(String billingAccountName, String customerName, CustomerPolicyInner parameters); + + /** + * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param parameters Request parameters that are provided to the update policies operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the customer's Policy. + */ + Response updateCustomerWithResponse( + String billingAccountName, String customerName, CustomerPolicyInner parameters, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Policy.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Policy.java new file mode 100644 index 0000000000000..d8060551acf79 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Policy.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.PolicyInner; + +/** An immutable client-side representation of Policy. */ +public interface Policy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the marketplacePurchases property: The policy that controls whether Azure marketplace purchases are allowed + * for a billing profile. + * + * @return the marketplacePurchases value. + */ + MarketplacePurchasesPolicy marketplacePurchases(); + + /** + * Gets the reservationPurchases property: The policy that controls whether Azure reservation purchases are allowed + * for a billing profile. + * + * @return the reservationPurchases value. + */ + ReservationPurchasesPolicy reservationPurchases(); + + /** + * Gets the viewCharges property: The policy that controls whether users with Azure RBAC access to a subscription + * can view its charges. + * + * @return the viewCharges value. + */ + ViewChargesPolicy viewCharges(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.PolicyInner object. + * + * @return the inner object. + */ + PolicyInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Product.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Product.java new file mode 100644 index 0000000000000..ee20cf0f24130 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Product.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.ProductInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of Product. */ +public interface Product { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the autoRenew property: Indicates whether auto renewal is turned on or off for a product. + * + * @return the autoRenew value. + */ + AutoRenew autoRenew(); + + /** + * Gets the displayName property: The display name of the product. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the purchaseDate property: The date when the product was purchased. + * + * @return the purchaseDate value. + */ + OffsetDateTime purchaseDate(); + + /** + * Gets the productTypeId property: The ID of the type of product. + * + * @return the productTypeId value. + */ + String productTypeId(); + + /** + * Gets the productType property: The description of the type of product. + * + * @return the productType value. + */ + String productType(); + + /** + * Gets the status property: The current status of the product. + * + * @return the status value. + */ + ProductStatusType status(); + + /** + * Gets the endDate property: The date when the product will be renewed or canceled. + * + * @return the endDate value. + */ + OffsetDateTime endDate(); + + /** + * Gets the billingFrequency property: The frequency at which the product will be billed. + * + * @return the billingFrequency value. + */ + BillingFrequency billingFrequency(); + + /** + * Gets the lastCharge property: The last month charges. + * + * @return the lastCharge value. + */ + Amount lastCharge(); + + /** + * Gets the lastChargeDate property: The date of the last charge. + * + * @return the lastChargeDate value. + */ + OffsetDateTime lastChargeDate(); + + /** + * Gets the quantity property: The quantity purchased for the product. + * + * @return the quantity value. + */ + Float quantity(); + + /** + * Gets the skuId property: The sku ID of the product. + * + * @return the skuId value. + */ + String skuId(); + + /** + * Gets the skuDescription property: The sku description of the product. + * + * @return the skuDescription value. + */ + String skuDescription(); + + /** + * Gets the tenantId property: The id of the tenant in which the product is used. + * + * @return the tenantId value. + */ + String tenantId(); + + /** + * Gets the availabilityId property: The availability of the product. + * + * @return the availabilityId value. + */ + String availabilityId(); + + /** + * Gets the invoiceSectionId property: The ID of the invoice section to which the product is billed. + * + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * Gets the invoiceSectionDisplayName property: The name of the invoice section to which the product is billed. + * + * @return the invoiceSectionDisplayName value. + */ + String invoiceSectionDisplayName(); + + /** + * Gets the billingProfileId property: The ID of the billing profile to which the product is billed. + * + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * Gets the billingProfileDisplayName property: The name of the billing profile to which the product is billed. + * + * @return the billingProfileDisplayName value. + */ + String billingProfileDisplayName(); + + /** + * Gets the customerId property: The ID of the customer for whom the product was purchased. The field is applicable + * only for Microsoft Partner Agreement billing account. + * + * @return the customerId value. + */ + String customerId(); + + /** + * Gets the customerDisplayName property: The name of the customer for whom the product was purchased. The field is + * applicable only for Microsoft Partner Agreement billing account. + * + * @return the customerDisplayName value. + */ + String customerDisplayName(); + + /** + * Gets the reseller property: Reseller for this product. + * + * @return the reseller value. + */ + Reseller reseller(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.ProductInner object. + * + * @return the inner object. + */ + ProductInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductStatusType.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductStatusType.java new file mode 100644 index 0000000000000..a103a0b37b6a6 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductStatusType.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** 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/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductTransferValidationErrorCode.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductTransferValidationErrorCode.java new file mode 100644 index 0000000000000..8ab5ce76a292c --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductTransferValidationErrorCode.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** 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/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Products.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Products.java new file mode 100644 index 0000000000000..5b39cb0ec326c --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Products.java @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.billing.fluent.models.ProductInner; + +/** Resource collection API of Products. */ +public interface Products { + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported + * only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + PagedIterable listByCustomer(String billingAccountName, String customerName); + + /** + * Lists the products for a customer. These don't include products billed based on usage.The operation is supported + * only for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param customerName The ID that uniquely identifies a customer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + PagedIterable listByCustomer(String billingAccountName, String customerName, Context context); + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is + * supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + PagedIterable listByBillingAccount(String billingAccountName); + + /** + * Lists the products for a billing account. These don't include products billed based on usage. The operation is + * supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. + * It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value + * are separated by a colon (:). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + PagedIterable listByBillingAccount(String billingAccountName, String filter, Context context); + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is + * supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName); + + /** + * Lists the products for a billing profile. These don't include products billed based on usage. The operation is + * supported for billing accounts with agreement type Microsoft Customer Agreement or Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. + * It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value + * are separated by a colon (:). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + PagedIterable listByBillingProfile( + String billingAccountName, String billingProfileName, String filter, Context context); + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + PagedIterable listByInvoiceSection( + String billingAccountName, String billingProfileName, String invoiceSectionName); + + /** + * Lists the products for an invoice section. These don't include products billed based on usage. The operation is + * supported only for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param invoiceSectionName The ID that uniquely identifies an invoice section. + * @param filter May be used to filter by product type. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. + * It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key and value + * are separated by a colon (:). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of products. + */ + PagedIterable listByInvoiceSection( + String billingAccountName, + String billingProfileName, + String invoiceSectionName, + String filter, + Context context); + + /** + * Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product by ID. + */ + Product get(String billingAccountName, String productName); + + /** + * Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Customer + * Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product by ID. + */ + Response getWithResponse(String billingAccountName, String productName, Context context); + + /** + * Updates the properties of a Product. Currently, auto renew can be updated. The operation is supported only for + * billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the update product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product. + */ + Product update(String billingAccountName, String productName, ProductInner parameters); + + /** + * Updates the properties of a Product. Currently, auto renew can be updated. The operation is supported only for + * billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the update product operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product. + */ + Response updateWithResponse( + String billingAccountName, String productName, ProductInner parameters, Context context); + + /** + * Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported only for products that are purchased with a + * recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the move product operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product. + */ + Product move(String billingAccountName, String productName, TransferProductRequestProperties parameters); + + /** + * Moves a product's charges to a new invoice section. The new invoice section must belong to the same billing + * profile as the existing invoice section. This operation is supported only for products that are purchased with a + * recurring charge and for billing accounts with agreement type Microsoft Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the move product operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a product. + */ + Response moveWithResponse( + String billingAccountName, String productName, TransferProductRequestProperties parameters, Context context); + + /** + * Validates if a product's charges can be moved to a new invoice section. This operation is supported only for + * products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft + * Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the validate move eligibility operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the product transfer eligibility validation. + */ + ValidateProductTransferEligibilityResult validateMove( + String billingAccountName, String productName, TransferProductRequestProperties parameters); + + /** + * Validates if a product's charges can be moved to a new invoice section. This operation is supported only for + * products that are purchased with a recurring charge and for billing accounts with agreement type Microsoft + * Customer Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param productName The ID that uniquely identifies a product. + * @param parameters Request parameters that are provided to the validate move eligibility operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the product transfer eligibility validation. + */ + Response validateMoveWithResponse( + String billingAccountName, String productName, TransferProductRequestProperties parameters, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductsListResult.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductsListResult.java new file mode 100644 index 0000000000000..1d0be47d40806 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductsListResult.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.models.ProductInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * The list of products. It contains a list of available product summaries in reverse chronological order by purchase + * date. + */ +@Immutable +public final class ProductsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProductsListResult.class); + + /* + * The list of products. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of products. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductsMoveHeaders.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductsMoveHeaders.java new file mode 100644 index 0000000000000..e2c92545cc572 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductsMoveHeaders.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ProductsMoveHeaders model. */ +@Fluent +public final class ProductsMoveHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProductsMoveHeaders.class); + + /* + * The Retry-After property. + */ + @JsonProperty(value = "Retry-After") + private Integer retryAfter; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the retryAfter property: The Retry-After property. + * + * @return the retryAfter value. + */ + public Integer retryAfter() { + return this.retryAfter; + } + + /** + * Set the retryAfter property: The Retry-After property. + * + * @param retryAfter the retryAfter value to set. + * @return the ProductsMoveHeaders object itself. + */ + public ProductsMoveHeaders withRetryAfter(Integer retryAfter) { + this.retryAfter = retryAfter; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the ProductsMoveHeaders object itself. + */ + public ProductsMoveHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductsMoveResponse.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductsMoveResponse.java new file mode 100644 index 0000000000000..3ebd7863dfc0b --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ProductsMoveResponse.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.billing.fluent.models.ProductInner; + +/** Contains all response data for the move operation. */ +public final class ProductsMoveResponse extends ResponseBase { + /** + * Creates an instance of ProductsMoveResponse. + * + * @param request the request which resulted in this ProductsMoveResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public ProductsMoveResponse( + HttpRequest request, int statusCode, HttpHeaders rawHeaders, ProductInner value, ProductsMoveHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public ProductInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/RebillDetails.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/RebillDetails.java new file mode 100644 index 0000000000000..ff65fc0830b24 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/RebillDetails.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The rebill details of an invoice. */ +@Immutable +public final class RebillDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RebillDetails.class); + + /* + * The ID of credit note. + */ + @JsonProperty(value = "creditNoteDocumentId", access = JsonProperty.Access.WRITE_ONLY) + private String creditNoteDocumentId; + + /* + * The ID of invoice. + */ + @JsonProperty(value = "invoiceDocumentId", access = JsonProperty.Access.WRITE_ONLY) + private String invoiceDocumentId; + + /* + * Rebill details for an invoice. + */ + @JsonProperty(value = "rebillDetails", access = JsonProperty.Access.WRITE_ONLY) + private Map rebillDetails; + + /** + * Get the creditNoteDocumentId property: The ID of credit note. + * + * @return the creditNoteDocumentId value. + */ + public String creditNoteDocumentId() { + return this.creditNoteDocumentId; + } + + /** + * Get the invoiceDocumentId property: The ID of invoice. + * + * @return the invoiceDocumentId value. + */ + public String invoiceDocumentId() { + return this.invoiceDocumentId; + } + + /** + * Get the rebillDetails property: Rebill details for an invoice. + * + * @return the rebillDetails value. + */ + public Map rebillDetails() { + return this.rebillDetails; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (rebillDetails() != null) { + rebillDetails() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Reseller.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Reseller.java new file mode 100644 index 0000000000000..3d925897ed347 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Reseller.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Details of the reseller. */ +@Immutable +public final class Reseller { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Reseller.class); + + /* + * The MPN ID of the reseller. + */ + @JsonProperty(value = "resellerId", access = JsonProperty.Access.WRITE_ONLY) + private String resellerId; + + /* + * The name of the reseller. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the resellerId property: The MPN ID of the reseller. + * + * @return the resellerId value. + */ + public String resellerId() { + return this.resellerId; + } + + /** + * Get the description property: The name of the reseller. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Reservation.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Reservation.java new file mode 100644 index 0000000000000..fd38fb9c0dbac --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Reservation.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.ReservationInner; +import java.util.List; + +/** An immutable client-side representation of Reservation. */ +public interface Reservation { + /** + * Gets the id property: The id of the reservation. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the reservation. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the reservation. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The location of the reservation. + * + * @return the location value. + */ + String location(); + + /** + * Gets the sku property: The sku information associated to this reservation. + * + * @return the sku value. + */ + ReservationSkuProperty sku(); + + /** + * Gets the appliedScopes property: The array of applied scopes of a reservation. Will be null if the reservation is + * in Shared scope. + * + * @return the appliedScopes value. + */ + List appliedScopes(); + + /** + * Gets the appliedScopeType property: The applied scope type of the reservation. + * + * @return the appliedScopeType value. + */ + String appliedScopeType(); + + /** + * Gets the reservedResourceType property: The reserved source type of the reservation, e.g. virtual machine. + * + * @return the reservedResourceType value. + */ + String reservedResourceType(); + + /** + * Gets the quantity property: The number of the reservation. + * + * @return the quantity value. + */ + Float quantity(); + + /** + * Gets the provisioningState property: The provisioning state of the reservation, e.g. Succeeded. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the expiryDate property: The expiry date of the reservation. + * + * @return the expiryDate value. + */ + String expiryDate(); + + /** + * Gets the provisioningSubState property: The provisioning state of the reservation, e.g. Succeeded. + * + * @return the provisioningSubState value. + */ + String provisioningSubState(); + + /** + * Gets the displayName property: The display name of the reservation. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the displayProvisioningState property: The provisioning state of the reservation for display, e.g. + * Succeeded. + * + * @return the displayProvisioningState value. + */ + String displayProvisioningState(); + + /** + * Gets the userFriendlyRenewState property: The renew state of the reservation for display, e.g. On. + * + * @return the userFriendlyRenewState value. + */ + String userFriendlyRenewState(); + + /** + * Gets the userFriendlyAppliedScopeType property: The applied scope type of the reservation for display, e.g. + * Shared. + * + * @return the userFriendlyAppliedScopeType value. + */ + String userFriendlyAppliedScopeType(); + + /** + * Gets the effectiveDateTime property: The effective date time of the reservation. + * + * @return the effectiveDateTime value. + */ + String effectiveDateTime(); + + /** + * Gets the skuDescription property: The sku description of the reservation. + * + * @return the skuDescription value. + */ + String skuDescription(); + + /** + * Gets the term property: The term of the reservation, e.g. P1Y. + * + * @return the term value. + */ + String term(); + + /** + * Gets the renew property: The renew state of the reservation. + * + * @return the renew value. + */ + Boolean renew(); + + /** + * Gets the renewSource property: The renew source of the reservation. + * + * @return the renewSource value. + */ + String renewSource(); + + /** + * Gets the utilization property: Reservation utilization. + * + * @return the utilization value. + */ + ReservationPropertyUtilization utilization(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.ReservationInner object. + * + * @return the inner object. + */ + ReservationInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationPropertyUtilization.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationPropertyUtilization.java new file mode 100644 index 0000000000000..4091bbaa950ca --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationPropertyUtilization.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Reservation utilization. */ +@Fluent +public final class ReservationPropertyUtilization { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReservationPropertyUtilization.class); + + /* + * The number of days trend for a reservation + */ + @JsonProperty(value = "trend", access = JsonProperty.Access.WRITE_ONLY) + private String trend; + + /* + * The array of aggregates of a reservation's utilization + */ + @JsonProperty(value = "aggregates") + private List aggregates; + + /** + * Get the trend property: The number of days trend for a reservation. + * + * @return the trend value. + */ + public String trend() { + return this.trend; + } + + /** + * Get the aggregates property: The array of aggregates of a reservation's utilization. + * + * @return the aggregates value. + */ + public List aggregates() { + return this.aggregates; + } + + /** + * Set the aggregates property: The array of aggregates of a reservation's utilization. + * + * @param aggregates the aggregates value to set. + * @return the ReservationPropertyUtilization object itself. + */ + public ReservationPropertyUtilization withAggregates(List aggregates) { + this.aggregates = aggregates; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (aggregates() != null) { + aggregates().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationPurchasesPolicy.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationPurchasesPolicy.java new file mode 100644 index 0000000000000..3db5dd97924f3 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationPurchasesPolicy.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ReservationPurchasesPolicy. */ +public final class ReservationPurchasesPolicy extends ExpandableStringEnum { + /** Static value Allowed for ReservationPurchasesPolicy. */ + public static final ReservationPurchasesPolicy ALLOWED = fromString("Allowed"); + + /** Static value NotAllowed for ReservationPurchasesPolicy. */ + public static final ReservationPurchasesPolicy NOT_ALLOWED = fromString("NotAllowed"); + + /** + * Creates or finds a ReservationPurchasesPolicy from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReservationPurchasesPolicy. + */ + @JsonCreator + public static ReservationPurchasesPolicy fromString(String name) { + return fromString(name, ReservationPurchasesPolicy.class); + } + + /** @return known ReservationPurchasesPolicy values. */ + public static Collection values() { + return values(ReservationPurchasesPolicy.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationSkuProperty.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationSkuProperty.java new file mode 100644 index 0000000000000..656bbf653299c --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationSkuProperty.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The property of reservation sku object. */ +@Immutable +public final class ReservationSkuProperty { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReservationSkuProperty.class); + + /* + * The name of the reservation sku. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Get the name property: The name of the reservation sku. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationSummary.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationSummary.java new file mode 100644 index 0000000000000..67eb6ee38b7ef --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationSummary.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The roll up count summary of reservations in each state. */ +@Immutable +public final class ReservationSummary { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReservationSummary.class); + + /* + * The number of reservation in Succeeded state + */ + @JsonProperty(value = "succeededCount", access = JsonProperty.Access.WRITE_ONLY) + private Float succeededCount; + + /* + * The number of reservation in Failed state + */ + @JsonProperty(value = "failedCount", access = JsonProperty.Access.WRITE_ONLY) + private Float failedCount; + + /* + * The number of reservation in Expiring state + */ + @JsonProperty(value = "expiringCount", access = JsonProperty.Access.WRITE_ONLY) + private Float expiringCount; + + /* + * The number of reservation in Expired state + */ + @JsonProperty(value = "expiredCount", access = JsonProperty.Access.WRITE_ONLY) + private Float expiredCount; + + /* + * The number of reservation in Pending state + */ + @JsonProperty(value = "pendingCount", access = JsonProperty.Access.WRITE_ONLY) + private Float pendingCount; + + /* + * The number of reservation in Cancelled state + */ + @JsonProperty(value = "cancelledCount", access = JsonProperty.Access.WRITE_ONLY) + private Float cancelledCount; + + /** + * Get the succeededCount property: The number of reservation in Succeeded state. + * + * @return the succeededCount value. + */ + public Float succeededCount() { + return this.succeededCount; + } + + /** + * Get the failedCount property: The number of reservation in Failed state. + * + * @return the failedCount value. + */ + public Float failedCount() { + return this.failedCount; + } + + /** + * Get the expiringCount property: The number of reservation in Expiring state. + * + * @return the expiringCount value. + */ + public Float expiringCount() { + return this.expiringCount; + } + + /** + * Get the expiredCount property: The number of reservation in Expired state. + * + * @return the expiredCount value. + */ + public Float expiredCount() { + return this.expiredCount; + } + + /** + * Get the pendingCount property: The number of reservation in Pending state. + * + * @return the pendingCount value. + */ + public Float pendingCount() { + return this.pendingCount; + } + + /** + * Get the cancelledCount property: The number of reservation in Cancelled state. + * + * @return the cancelledCount value. + */ + public Float cancelledCount() { + return this.cancelledCount; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationType.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationType.java new file mode 100644 index 0000000000000..3aae730572aae --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** 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/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationUtilizationAggregates.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationUtilizationAggregates.java new file mode 100644 index 0000000000000..d6db26851bf21 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationUtilizationAggregates.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The aggregate values of reservation utilization. */ +@Immutable +public final class ReservationUtilizationAggregates { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReservationUtilizationAggregates.class); + + /* + * The grain of the aggregate + */ + @JsonProperty(value = "grain", access = JsonProperty.Access.WRITE_ONLY) + private Float grain; + + /* + * The grain unit of the aggregate + */ + @JsonProperty(value = "grainUnit", access = JsonProperty.Access.WRITE_ONLY) + private String grainUnit; + + /* + * The aggregate value + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private Float value; + + /* + * The aggregate value unit + */ + @JsonProperty(value = "valueUnit", access = JsonProperty.Access.WRITE_ONLY) + private String valueUnit; + + /** + * Get the grain property: The grain of the aggregate. + * + * @return the grain value. + */ + public Float grain() { + return this.grain; + } + + /** + * Get the grainUnit property: The grain unit of the aggregate. + * + * @return the grainUnit value. + */ + public String grainUnit() { + return this.grainUnit; + } + + /** + * Get the value property: The aggregate value. + * + * @return the value value. + */ + public Float value() { + return this.value; + } + + /** + * Get the valueUnit property: The aggregate value unit. + * + * @return the valueUnit value. + */ + public String valueUnit() { + return this.valueUnit; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Reservations.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Reservations.java new file mode 100644 index 0000000000000..70245b451db71 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Reservations.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Reservations. */ +public interface Reservations { + /** + * Lists the reservations for a billing account and the roll up counts of reservations group by provisioning states. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + PagedIterable listByBillingAccount(String billingAccountName); + + /** + * Lists the reservations for a billing account and the roll up counts of reservations group by provisioning states. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does + * not currently support 'ne', 'gt', 'le', 'ge', or 'not'. + * @param orderby May be used to sort order by reservation properties. + * @param refreshsummary To indicate whether to refresh the roll up counts of the reservations group by provisioning + * states. + * @param selectedState The selected provisioning state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + PagedIterable listByBillingAccount( + String billingAccountName, + String filter, + String orderby, + String refreshsummary, + String selectedState, + Context context); + + /** + * Lists the reservations for a billing profile and the roll up counts of reservations group by provisioning state. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName); + + /** + * Lists the reservations for a billing profile and the roll up counts of reservations group by provisioning state. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does + * not currently support 'ne', 'gt', 'le', 'ge', or 'not'. + * @param orderby May be used to sort order by reservation properties. + * @param refreshsummary To indicate whether to refresh the roll up counts of the reservations group by provisioning + * state. + * @param selectedState The selected provisioning state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state. + */ + PagedIterable listByBillingProfile( + String billingAccountName, + String billingProfileName, + String filter, + String orderby, + String refreshsummary, + String selectedState, + Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationsListResult.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationsListResult.java new file mode 100644 index 0000000000000..3ee6e25ecaea3 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ReservationsListResult.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.models.ReservationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of reservations and summary of roll out count of reservations in each state. */ +@Fluent +public final class ReservationsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReservationsListResult.class); + + /* + * The list of reservations. + */ + @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; + + /* + * The roll out count summary of the reservations + */ + @JsonProperty(value = "summary") + private ReservationSummary summary; + + /** + * Get the value property: The list of reservations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the summary property: The roll out count summary of the reservations. + * + * @return the summary value. + */ + public ReservationSummary summary() { + return this.summary; + } + + /** + * Set the summary property: The roll out count summary of the reservations. + * + * @param summary the summary value to set. + * @return the ReservationsListResult object itself. + */ + public ReservationsListResult withSummary(ReservationSummary summary) { + this.summary = summary; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + if (summary() != null) { + summary().validate(); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/SpendingLimit.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/SpendingLimit.java new file mode 100644 index 0000000000000..bc2eefb4089f1 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/SpendingLimit.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SpendingLimit. */ +public final class SpendingLimit extends ExpandableStringEnum { + /** Static value Off for SpendingLimit. */ + public static final SpendingLimit OFF = fromString("Off"); + + /** Static value On for SpendingLimit. */ + public static final SpendingLimit ON = fromString("On"); + + /** + * Creates or finds a SpendingLimit from its string representation. + * + * @param name a name to look for. + * @return the corresponding SpendingLimit. + */ + @JsonCreator + public static SpendingLimit fromString(String name) { + return fromString(name, SpendingLimit.class); + } + + /** @return known SpendingLimit values. */ + public static Collection values() { + return values(SpendingLimit.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/SpendingLimitForBillingProfile.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/SpendingLimitForBillingProfile.java new file mode 100644 index 0000000000000..736007d66636e --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/SpendingLimitForBillingProfile.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SpendingLimitForBillingProfile. */ +public final class SpendingLimitForBillingProfile extends ExpandableStringEnum { + /** Static value Off for SpendingLimitForBillingProfile. */ + public static final SpendingLimitForBillingProfile OFF = fromString("Off"); + + /** Static value On for SpendingLimitForBillingProfile. */ + public static final SpendingLimitForBillingProfile ON = fromString("On"); + + /** + * Creates or finds a SpendingLimitForBillingProfile from its string representation. + * + * @param name a name to look for. + * @return the corresponding SpendingLimitForBillingProfile. + */ + @JsonCreator + public static SpendingLimitForBillingProfile fromString(String name) { + return fromString(name, SpendingLimitForBillingProfile.class); + } + + /** @return known SpendingLimitForBillingProfile values. */ + public static Collection values() { + return values(SpendingLimitForBillingProfile.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/StatusReasonCode.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/StatusReasonCode.java new file mode 100644 index 0000000000000..19e9b366d610e --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/StatusReasonCode.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for StatusReasonCode. */ +public final class StatusReasonCode extends ExpandableStringEnum { + /** Static value PastDue for StatusReasonCode. */ + public static final StatusReasonCode PAST_DUE = fromString("PastDue"); + + /** Static value SpendingLimitReached for StatusReasonCode. */ + public static final StatusReasonCode SPENDING_LIMIT_REACHED = fromString("SpendingLimitReached"); + + /** Static value SpendingLimitExpired for StatusReasonCode. */ + public static final StatusReasonCode SPENDING_LIMIT_EXPIRED = fromString("SpendingLimitExpired"); + + /** + * Creates or finds a StatusReasonCode from its string representation. + * + * @param name a name to look for. + * @return the corresponding StatusReasonCode. + */ + @JsonCreator + public static StatusReasonCode fromString(String name) { + return fromString(name, StatusReasonCode.class); + } + + /** @return known StatusReasonCode values. */ + public static Collection values() { + return values(StatusReasonCode.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/StatusReasonCodeForBillingProfile.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/StatusReasonCodeForBillingProfile.java new file mode 100644 index 0000000000000..c09ba125b96c3 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/StatusReasonCodeForBillingProfile.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for StatusReasonCodeForBillingProfile. */ +public final class StatusReasonCodeForBillingProfile extends ExpandableStringEnum { + /** Static value PastDue for StatusReasonCodeForBillingProfile. */ + public static final StatusReasonCodeForBillingProfile PAST_DUE = fromString("PastDue"); + + /** Static value SpendingLimitReached for StatusReasonCodeForBillingProfile. */ + public static final StatusReasonCodeForBillingProfile SPENDING_LIMIT_REACHED = fromString("SpendingLimitReached"); + + /** Static value SpendingLimitExpired for StatusReasonCodeForBillingProfile. */ + public static final StatusReasonCodeForBillingProfile SPENDING_LIMIT_EXPIRED = fromString("SpendingLimitExpired"); + + /** + * Creates or finds a StatusReasonCodeForBillingProfile from its string representation. + * + * @param name a name to look for. + * @return the corresponding StatusReasonCodeForBillingProfile. + */ + @JsonCreator + public static StatusReasonCodeForBillingProfile fromString(String name) { + return fromString(name, StatusReasonCodeForBillingProfile.class); + } + + /** @return known StatusReasonCodeForBillingProfile values. */ + public static Collection values() { + return values(StatusReasonCodeForBillingProfile.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/SubscriptionTransferValidationErrorCode.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/SubscriptionTransferValidationErrorCode.java new file mode 100644 index 0000000000000..1ef1a25c36117 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/SubscriptionTransferValidationErrorCode.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SubscriptionTransferValidationErrorCode. */ +public final class SubscriptionTransferValidationErrorCode + extends ExpandableStringEnum { + /** Static value BillingAccountInactive for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode BILLING_ACCOUNT_INACTIVE = + fromString("BillingAccountInactive"); + + /** Static value CrossBillingAccountNotAllowed for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode CROSS_BILLING_ACCOUNT_NOT_ALLOWED = + fromString("CrossBillingAccountNotAllowed"); + + /** Static value DestinationBillingProfileInactive for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode DESTINATION_BILLING_PROFILE_INACTIVE = + fromString("DestinationBillingProfileInactive"); + + /** Static value DestinationBillingProfileNotFound for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode DESTINATION_BILLING_PROFILE_NOT_FOUND = + fromString("DestinationBillingProfileNotFound"); + + /** Static value DestinationBillingProfilePastDue for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode DESTINATION_BILLING_PROFILE_PAST_DUE = + fromString("DestinationBillingProfilePastDue"); + + /** Static value DestinationInvoiceSectionInactive for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode DESTINATION_INVOICE_SECTION_INACTIVE = + fromString("DestinationInvoiceSectionInactive"); + + /** Static value DestinationInvoiceSectionNotFound for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode DESTINATION_INVOICE_SECTION_NOT_FOUND = + fromString("DestinationInvoiceSectionNotFound"); + + /** Static value InsufficientPermissionOnDestination for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode INSUFFICIENT_PERMISSION_ON_DESTINATION = + fromString("InsufficientPermissionOnDestination"); + + /** Static value InsufficientPermissionOnSource for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode INSUFFICIENT_PERMISSION_ON_SOURCE = + fromString("InsufficientPermissionOnSource"); + + /** Static value InvalidDestination for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode INVALID_DESTINATION = fromString("InvalidDestination"); + + /** Static value InvalidSource for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode INVALID_SOURCE = fromString("InvalidSource"); + + /** Static value MarketplaceNotEnabledOnDestination for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode MARKETPLACE_NOT_ENABLED_ON_DESTINATION = + fromString("MarketplaceNotEnabledOnDestination"); + + /** Static value NotAvailableForDestinationMarket for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode NOT_AVAILABLE_FOR_DESTINATION_MARKET = + fromString("NotAvailableForDestinationMarket"); + + /** Static value ProductInactive for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode PRODUCT_INACTIVE = fromString("ProductInactive"); + + /** Static value ProductNotFound for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode PRODUCT_NOT_FOUND = fromString("ProductNotFound"); + + /** Static value ProductTypeNotSupported for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode PRODUCT_TYPE_NOT_SUPPORTED = + fromString("ProductTypeNotSupported"); + + /** Static value SourceBillingProfilePastDue for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode SOURCE_BILLING_PROFILE_PAST_DUE = + fromString("SourceBillingProfilePastDue"); + + /** Static value SourceInvoiceSectionInactive for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode SOURCE_INVOICE_SECTION_INACTIVE = + fromString("SourceInvoiceSectionInactive"); + + /** Static value SubscriptionNotActive for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode SUBSCRIPTION_NOT_ACTIVE = + fromString("SubscriptionNotActive"); + + /** Static value SubscriptionTypeNotSupported for SubscriptionTransferValidationErrorCode. */ + public static final SubscriptionTransferValidationErrorCode SUBSCRIPTION_TYPE_NOT_SUPPORTED = + fromString("SubscriptionTypeNotSupported"); + + /** + * 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/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TargetCloud.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TargetCloud.java new file mode 100644 index 0000000000000..1ce20b9cfb7ce --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TargetCloud.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for TargetCloud. */ +public final class TargetCloud extends ExpandableStringEnum { + /** Static value USGov for TargetCloud. */ + public static final TargetCloud USGOV = fromString("USGov"); + + /** Static value USNat for TargetCloud. */ + public static final TargetCloud USNAT = fromString("USNat"); + + /** Static value USSec for TargetCloud. */ + public static final TargetCloud USSEC = fromString("USSec"); + + /** + * Creates or finds a TargetCloud from its string representation. + * + * @param name a name to look for. + * @return the corresponding TargetCloud. + */ + @JsonCreator + public static TargetCloud fromString(String name) { + return fromString(name, TargetCloud.class); + } + + /** @return known TargetCloud values. */ + public static Collection values() { + return values(TargetCloud.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Transaction.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Transaction.java new file mode 100644 index 0000000000000..0da0e3d3afe9e --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Transaction.java @@ -0,0 +1,305 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.TransactionInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of Transaction. */ +public interface Transaction { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the kind property: The kind of transaction. Options are all or reservation. + * + * @return the kind value. + */ + TransactionTypeKind kind(); + + /** + * Gets the date property: The date of transaction. + * + * @return the date value. + */ + OffsetDateTime date(); + + /** + * Gets the invoice property: Invoice on which the transaction was billed or 'pending' if the transaction is not + * billed. + * + * @return the invoice value. + */ + String invoice(); + + /** + * Gets the invoiceId property: The ID of the invoice on which the transaction was billed. This field is only + * applicable for transactions which are billed. + * + * @return the invoiceId value. + */ + String invoiceId(); + + /** + * Gets the orderId property: The order ID of the reservation. The field is only applicable for transaction of kind + * reservation. + * + * @return the orderId value. + */ + String orderId(); + + /** + * Gets the orderName property: The name of the reservation order. The field is only applicable for transactions of + * kind reservation. + * + * @return the orderName value. + */ + String orderName(); + + /** + * Gets the productFamily property: The family of the product for which the transaction took place. + * + * @return the productFamily value. + */ + String productFamily(); + + /** + * Gets the productTypeId property: The ID of the product type for which the transaction took place. + * + * @return the productTypeId value. + */ + String productTypeId(); + + /** + * Gets the productType property: The type of the product for which the transaction took place. + * + * @return the productType value. + */ + String productType(); + + /** + * Gets the productDescription property: The description of the product for which the transaction took place. + * + * @return the productDescription value. + */ + String productDescription(); + + /** + * Gets the transactionType property: The type of transaction. + * + * @return the transactionType value. + */ + ReservationType transactionType(); + + /** + * Gets the transactionAmount property: The charge associated with the transaction. + * + * @return the transactionAmount value. + */ + Amount transactionAmount(); + + /** + * Gets the quantity property: The quantity purchased in the transaction. + * + * @return the quantity value. + */ + Integer quantity(); + + /** + * Gets the invoiceSectionId property: The ID of the invoice section which will be billed for the transaction. + * + * @return the invoiceSectionId value. + */ + String invoiceSectionId(); + + /** + * Gets the invoiceSectionDisplayName property: The name of the invoice section which will be billed for the + * transaction. + * + * @return the invoiceSectionDisplayName value. + */ + String invoiceSectionDisplayName(); + + /** + * Gets the billingProfileId property: The ID of the billing profile which will be billed for the transaction. + * + * @return the billingProfileId value. + */ + String billingProfileId(); + + /** + * Gets the billingProfileDisplayName property: The name of the billing profile which will be billed for the + * transaction. + * + * @return the billingProfileDisplayName value. + */ + String billingProfileDisplayName(); + + /** + * Gets the customerId property: The ID of the customer for which the transaction took place. The field is + * applicable only for Microsoft Partner Agreement billing account. + * + * @return the customerId value. + */ + String customerId(); + + /** + * Gets the customerDisplayName property: The name of the customer for which the transaction took place. The field + * is applicable only for Microsoft Partner Agreement billing account. + * + * @return the customerDisplayName value. + */ + String customerDisplayName(); + + /** + * Gets the subscriptionId property: The ID of the subscription that was used for the transaction. The field is only + * applicable for transaction of kind reservation. + * + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * Gets the subscriptionName property: The name of the subscription that was used for the transaction. The field is + * only applicable for transaction of kind reservation. + * + * @return the subscriptionName value. + */ + String subscriptionName(); + + /** + * Gets the azurePlan property: The type of azure plan of the subscription that was used for the transaction. + * + * @return the azurePlan value. + */ + String azurePlan(); + + /** + * Gets the azureCreditApplied property: The amount of any Azure credits automatically applied to this transaction. + * + * @return the azureCreditApplied value. + */ + Amount azureCreditApplied(); + + /** + * Gets the billingCurrency property: The ISO 4217 code for the currency in which this transaction is billed. + * + * @return the billingCurrency value. + */ + String billingCurrency(); + + /** + * Gets the discount property: The percentage discount, if any, applied to this transaction. + * + * @return the discount value. + */ + Float discount(); + + /** + * Gets the effectivePrice property: The price of the product after applying any discounts. + * + * @return the effectivePrice value. + */ + Amount effectivePrice(); + + /** + * Gets the exchangeRate property: The exchange rate used to convert charged amount to billing currency, if + * applicable. + * + * @return the exchangeRate value. + */ + Float exchangeRate(); + + /** + * Gets the marketPrice property: The retail price of the product. + * + * @return the marketPrice value. + */ + Amount marketPrice(); + + /** + * Gets the pricingCurrency property: The ISO 4217 code for the currency in which the product is priced. + * + * @return the pricingCurrency value. + */ + String pricingCurrency(); + + /** + * Gets the servicePeriodStartDate property: The date of the purchase of the product, or the start date of the month + * in which usage started. + * + * @return the servicePeriodStartDate value. + */ + OffsetDateTime servicePeriodStartDate(); + + /** + * Gets the servicePeriodEndDate property: The end date of the product term, or the end date of the month in which + * usage ended. + * + * @return the servicePeriodEndDate value. + */ + OffsetDateTime servicePeriodEndDate(); + + /** + * Gets the subTotal property: The pre-tax charged amount for the transaction. + * + * @return the subTotal value. + */ + Amount subTotal(); + + /** + * Gets the tax property: The tax amount applied to the transaction. + * + * @return the tax value. + */ + Amount tax(); + + /** + * Gets the unitOfMeasure property: The unit of measure used to bill for the product. For example, compute services + * are billed per hour. + * + * @return the unitOfMeasure value. + */ + String unitOfMeasure(); + + /** + * Gets the units property: The number of units used for a given product. + * + * @return the units value. + */ + Float units(); + + /** + * Gets the unitType property: The description for the unit of measure for a given product. + * + * @return the unitType value. + */ + String unitType(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.TransactionInner object. + * + * @return the inner object. + */ + TransactionInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransactionListResult.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransactionListResult.java new file mode 100644 index 0000000000000..78454f612843e --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransactionListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.billing.fluent.models.TransactionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of transactions. */ +@Immutable +public final class TransactionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TransactionListResult.class); + + /* + * The list of transactions. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of transactions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransactionTypeKind.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransactionTypeKind.java new file mode 100644 index 0000000000000..1690605d16dc5 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransactionTypeKind.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** 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/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Transactions.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Transactions.java new file mode 100644 index 0000000000000..8b2a1f219b40a --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/Transactions.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Transactions. */ +public interface Transactions { + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of transactions. + */ + PagedIterable listByInvoice(String billingAccountName, String invoiceName); + + /** + * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of transactions. + */ + PagedIterable listByInvoice(String billingAccountName, String invoiceName, Context context); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransferBillingSubscriptionRequestProperties.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransferBillingSubscriptionRequestProperties.java new file mode 100644 index 0000000000000..5c9d8529cd715 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransferBillingSubscriptionRequestProperties.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Request parameters to transfer billing subscription. */ +@Fluent +public final class TransferBillingSubscriptionRequestProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(TransferBillingSubscriptionRequestProperties.class); + + /* + * The destination invoice section id. + */ + @JsonProperty(value = "destinationInvoiceSectionId", required = true) + private String destinationInvoiceSectionId; + + /** + * Get the destinationInvoiceSectionId property: The destination invoice section id. + * + * @return the destinationInvoiceSectionId value. + */ + public String destinationInvoiceSectionId() { + return this.destinationInvoiceSectionId; + } + + /** + * Set the destinationInvoiceSectionId property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (destinationInvoiceSectionId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property destinationInvoiceSectionId in model" + + " TransferBillingSubscriptionRequestProperties")); + } + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransferProductRequestProperties.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransferProductRequestProperties.java new file mode 100644 index 0000000000000..eec0db1652f8a --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransferProductRequestProperties.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of the product to initiate a transfer. */ +@Fluent +public final class TransferProductRequestProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TransferProductRequestProperties.class); + + /* + * The destination invoice section id. + */ + @JsonProperty(value = "destinationInvoiceSectionId") + private String destinationInvoiceSectionId; + + /** + * Get the destinationInvoiceSectionId property: The destination invoice section id. + * + * @return the destinationInvoiceSectionId value. + */ + public String destinationInvoiceSectionId() { + return this.destinationInvoiceSectionId; + } + + /** + * Set the destinationInvoiceSectionId property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ValidateAddressResponse.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ValidateAddressResponse.java new file mode 100644 index 0000000000000..3568073aac16b --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ValidateAddressResponse.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.ValidateAddressResponseInner; +import java.util.List; + +/** An immutable client-side representation of ValidateAddressResponse. */ +public interface ValidateAddressResponse { + /** + * Gets the status property: status of the address validation. + * + * @return the status value. + */ + AddressValidationStatus status(); + + /** + * Gets the suggestedAddresses property: The list of suggested addresses. + * + * @return the suggestedAddresses value. + */ + List suggestedAddresses(); + + /** + * Gets the validationMessage property: Validation error message. + * + * @return the validationMessage value. + */ + String validationMessage(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.ValidateAddressResponseInner object. + * + * @return the inner object. + */ + ValidateAddressResponseInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ValidateProductTransferEligibilityError.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ValidateProductTransferEligibilityError.java new file mode 100644 index 0000000000000..4791cff63ce65 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ValidateProductTransferEligibilityError.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Error details of the product transfer eligibility validation. */ +@Fluent +public final class ValidateProductTransferEligibilityError { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ValidateProductTransferEligibilityError.class); + + /* + * Error code for the product transfer validation. + */ + @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 the code property: Error code for the product transfer validation. + * + * @return the code value. + */ + public ProductTransferValidationErrorCode code() { + return this.code; + } + + /** + * Set the code property: Error code for the product transfer validation. + * + * @param code the code value to set. + * @return the ValidateProductTransferEligibilityError object itself. + */ + public ValidateProductTransferEligibilityError withCode(ProductTransferValidationErrorCode code) { + this.code = code; + return this; + } + + /** + * Get the message property: The error message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: 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 the details property: Detailed error message explaining the error. + * + * @return the details value. + */ + public String details() { + return this.details; + } + + /** + * Set the details property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ValidateProductTransferEligibilityResult.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ValidateProductTransferEligibilityResult.java new file mode 100644 index 0000000000000..57f3bc3485652 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ValidateProductTransferEligibilityResult.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.ValidateProductTransferEligibilityResultInner; + +/** An immutable client-side representation of ValidateProductTransferEligibilityResult. */ +public interface ValidateProductTransferEligibilityResult { + /** + * Gets the isMoveEligible property: Specifies whether the transfer is eligible or not. + * + * @return the isMoveEligible value. + */ + Boolean isMoveEligible(); + + /** + * Gets the errorDetails property: Validation error details. + * + * @return the errorDetails value. + */ + ValidateProductTransferEligibilityError errorDetails(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.ValidateProductTransferEligibilityResultInner + * object. + * + * @return the inner object. + */ + ValidateProductTransferEligibilityResultInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ValidateSubscriptionTransferEligibilityError.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ValidateSubscriptionTransferEligibilityError.java new file mode 100644 index 0000000000000..e1453c963477b --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ValidateSubscriptionTransferEligibilityError.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Error details of the transfer eligibility validation. */ +@Fluent +public final class ValidateSubscriptionTransferEligibilityError { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ValidateSubscriptionTransferEligibilityError.class); + + /* + * Error code for the product transfer validation. + */ + @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 the code property: Error code for the product transfer validation. + * + * @return the code value. + */ + public SubscriptionTransferValidationErrorCode code() { + return this.code; + } + + /** + * Set the code property: Error code for the product transfer validation. + * + * @param code the code value to set. + * @return the ValidateSubscriptionTransferEligibilityError object itself. + */ + public ValidateSubscriptionTransferEligibilityError withCode(SubscriptionTransferValidationErrorCode code) { + this.code = code; + return this; + } + + /** + * Get the message property: The error message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: 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 the details property: Detailed error message explaining the error. + * + * @return the details value. + */ + public String details() { + return this.details; + } + + /** + * Set the details property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ValidateSubscriptionTransferEligibilityResult.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ValidateSubscriptionTransferEligibilityResult.java new file mode 100644 index 0000000000000..a090986d8003f --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ValidateSubscriptionTransferEligibilityResult.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.resourcemanager.billing.fluent.models.ValidateSubscriptionTransferEligibilityResultInner; + +/** An immutable client-side representation of ValidateSubscriptionTransferEligibilityResult. */ +public interface ValidateSubscriptionTransferEligibilityResult { + /** + * Gets the isMoveEligible property: Specifies whether the subscription is eligible to be transferred. + * + * @return the isMoveEligible value. + */ + Boolean isMoveEligible(); + + /** + * Gets the errorDetails property: Validation error details. + * + * @return the errorDetails value. + */ + ValidateSubscriptionTransferEligibilityError errorDetails(); + + /** + * Gets the inner com.azure.resourcemanager.billing.fluent.models.ValidateSubscriptionTransferEligibilityResultInner + * object. + * + * @return the inner object. + */ + ValidateSubscriptionTransferEligibilityResultInner innerModel(); +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ViewCharges.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ViewCharges.java new file mode 100644 index 0000000000000..bb7d5614f78ca --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ViewCharges.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ViewCharges. */ +public final class ViewCharges extends ExpandableStringEnum { + /** Static value Allowed for ViewCharges. */ + public static final ViewCharges ALLOWED = fromString("Allowed"); + + /** Static value NotAllowed for ViewCharges. */ + public static final ViewCharges NOT_ALLOWED = fromString("NotAllowed"); + + /** + * Creates or finds a ViewCharges from its string representation. + * + * @param name a name to look for. + * @return the corresponding ViewCharges. + */ + @JsonCreator + public static ViewCharges fromString(String name) { + return fromString(name, ViewCharges.class); + } + + /** @return known ViewCharges values. */ + public static Collection values() { + return values(ViewCharges.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ViewChargesPolicy.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ViewChargesPolicy.java new file mode 100644 index 0000000000000..1d1c67748f39f --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/ViewChargesPolicy.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.billing.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ViewChargesPolicy. */ +public final class ViewChargesPolicy extends ExpandableStringEnum { + /** Static value Allowed for ViewChargesPolicy. */ + public static final ViewChargesPolicy ALLOWED = fromString("Allowed"); + + /** Static value NotAllowed for ViewChargesPolicy. */ + public static final ViewChargesPolicy NOT_ALLOWED = fromString("NotAllowed"); + + /** + * Creates or finds a ViewChargesPolicy from its string representation. + * + * @param name a name to look for. + * @return the corresponding ViewChargesPolicy. + */ + @JsonCreator + public static ViewChargesPolicy fromString(String name) { + return fromString(name, ViewChargesPolicy.class); + } + + /** @return known ViewChargesPolicy values. */ + public static Collection values() { + return values(ViewChargesPolicy.class); + } +} diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/package-info.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/package-info.java new file mode 100644 index 0000000000000..5bd18ba909787 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for BillingManagementClient. Billing client provides access to billing resources + * for Azure subscriptions. + */ +package com.azure.resourcemanager.billing.models; diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/package-info.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/package-info.java new file mode 100644 index 0000000000000..85bcbed59250f --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for BillingManagementClient. Billing client provides access to billing resources for + * Azure subscriptions. + */ +package com.azure.resourcemanager.billing; diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/module-info.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/module-info.java new file mode 100644 index 0000000000000..30adadf3320f4 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.billing { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.billing; + exports com.azure.resourcemanager.billing.fluent; + exports com.azure.resourcemanager.billing.fluent.models; + exports com.azure.resourcemanager.billing.models; + + opens com.azure.resourcemanager.billing.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.billing.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/billing/ci.yml b/sdk/billing/ci.yml new file mode 100644 index 0000000000000..5e872b3d5c546 --- /dev/null +++ b/sdk/billing/ci.yml @@ -0,0 +1,33 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - main + - hotfix/* + - release/* + paths: + include: + - sdk/billing/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/billing/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: billing + Artifacts: + - name: azure-resourcemanager-billing + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerbilling diff --git a/sdk/billing/pom.xml b/sdk/billing/pom.xml new file mode 100644 index 0000000000000..587a94fd566c8 --- /dev/null +++ b/sdk/billing/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-billing-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-billing + + + +