From da88be4c4630c4506c698b1e85b32b9e915f7b2f Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 13 May 2025 10:21:46 +0000 Subject: [PATCH] CodeGen from PR 33749 in Azure/azure-rest-api-specs Merge 0f71353bdcdef5322e920d13cb940506e0127339 into a19648565889eaae019e531c15f3045d1244c7ce --- .../CHANGELOG.md | 10 +- .../azure-resourcemanager-billing/README.md | 6 +- .../azure-resourcemanager-billing/SAMPLE.md | 5058 ++++++++--------- .../azure-resourcemanager-billing/pom.xml | 11 +- .../billing/BillingManager.java | 17 +- .../models/BillingSubscriptionAliasInner.java | 2 +- .../BillingSubscriptionAliasProperties.java | 4 +- .../models/BillingSubscriptionInner.java | 2 +- .../models/BillingSubscriptionProperties.java | 6 +- .../implementation/AddressClientImpl.java | 53 +- .../implementation/AgreementsClientImpl.java | 207 +- .../AssociatedTenantsClientImpl.java | 467 +- .../AvailableBalancesClientImpl.java | 117 +- .../BillingAccountsClientImpl.java | 880 +-- .../BillingManagementClientImpl.java | 24 +- .../BillingPermissionsClientImpl.java | 1558 +++-- .../BillingProfilesClientImpl.java | 530 +- .../BillingPropertiesClientImpl.java | 120 +- .../BillingRequestsClientImpl.java | 1125 ++-- .../BillingRoleAssignmentsClientImpl.java | 3460 ++++++----- .../BillingRoleDefinitionsClientImpl.java | 1441 +++-- ...BillingSubscriptionsAliasesClientImpl.java | 363 +- .../BillingSubscriptionsClientImpl.java | 2193 ++++--- .../BillingSubscriptionsImpl.java | 2 +- .../implementation/CustomersClientImpl.java | 524 +- .../implementation/DepartmentsClientImpl.java | 237 +- .../EnrollmentAccountsClientImpl.java | 515 +- .../InvoiceSectionsClientImpl.java | 600 +- .../implementation/InvoicesClientImpl.java | 1459 +++-- .../implementation/OperationsClientImpl.java | 122 +- .../PartnerTransfersClientImpl.java | 417 +- .../PaymentMethodsClientImpl.java | 646 ++- .../implementation/PoliciesClientImpl.java | 779 +-- .../implementation/ProductsClientImpl.java | 1119 ++-- .../RecipientTransfersClientImpl.java | 336 +- .../ReservationOrdersClientImpl.java | 230 +- .../ReservationsClientImpl.java | 746 ++- .../SavingsPlanOrdersClientImpl.java | 225 +- .../SavingsPlanValidateResponseImpl.java | 2 +- .../SavingsPlansClientImpl.java | 622 +- .../implementation/SavingsPlansImpl.java | 2 +- .../TransactionsClientImpl.java | 1199 ++-- .../implementation/TransactionsImpl.java | 2 +- .../implementation/TransfersClientImpl.java | 420 +- .../billing/models/BillingSubscription.java | 2 +- .../models/BillingSubscriptionAlias.java | 2 +- .../models/BillingSubscriptionPatch.java | 2 +- .../billing/models/TransactionProperties.java | 4 +- .../azure-resourcemanager-billing.properties | 1 + .../BillingSubscriptionsCancelSamples.java | 2 +- .../AcceptTransferPropertiesTests.java | 34 - .../generated/AcceptTransferRequestTests.java | 33 - .../generated/AgreementInnerTests.java | 42 - .../generated/AgreementListResultTests.java | 23 - .../generated/AgreementPropertiesTests.java | 23 - .../AgreementsGetWithResponseMockTests.java | 39 - ...reementsListByBillingAccountMockTests.java | 39 - .../billing/generated/AmountTests.java | 22 - .../AppliedScopePropertiesTests.java | 38 - .../generated/AssociatedTenantInnerTests.java | 55 - .../AssociatedTenantListResultTests.java | 23 - .../AssociatedTenantPropertiesTests.java | 37 - ...ociatedTenantsCreateOrUpdateMockTests.java | 69 - ...ciatedTenantsGetWithResponseMockTests.java | 45 - ...dTenantsListByBillingAccountMockTests.java | 48 - .../generated/AvailableBalanceInnerTests.java | 45 - ...AvailableBalancePropertiesAmountTests.java | 22 - .../AvailableBalancePropertiesTests.java | 27 - ...PropertiesTotalPaymentsOnAccountTests.java | 23 - ...ByBillingAccountWithResponseMockTests.java | 39 - ...ByBillingProfileWithResponseMockTests.java | 39 - .../billing/generated/AzurePlanTests.java | 30 - .../billing/generated/BeneficiaryTests.java | 27 - .../BillingAccountPolicyInnerTests.java | 94 - ...rtiesEnterpriseAgreementPoliciesTests.java | 39 - .../BillingAccountPolicyPropertiesTests.java | 76 - ...ountPropertiesRegistrationNumberTests.java | 27 - ...onfirmTransitionWithResponseMockTests.java | 36 - .../BillingPermissionInnerTests.java | 23 - .../BillingPermissionListResultTests.java | 23 - ...ByBillingAccountWithResponseMockTests.java | 42 - ...ByBillingProfileWithResponseMockTests.java | 41 - ...AccessByCustomerWithResponseMockTests.java | 40 - ...cessByDepartmentWithResponseMockTests.java | 43 - ...nrollmentAccountWithResponseMockTests.java | 40 - ...ByInvoiceSectionWithResponseMockTests.java | 42 - ...missionsListByBillingAccountMockTests.java | 37 - ...missionsListByBillingProfileMockTests.java | 37 - ...stByCustomerAtBillingAccountMockTests.java | 36 - ...ingPermissionsListByCustomerMockTests.java | 37 - ...gPermissionsListByDepartmentMockTests.java | 37 - ...sionsListByEnrollmentAccountMockTests.java | 36 - ...missionsListByInvoiceSectionMockTests.java | 37 - .../generated/BillingProfileInfoTests.java | 38 - .../BillingProfilePolicyInnerTests.java | 109 - ...rtiesEnterpriseAgreementPoliciesTests.java | 37 - .../BillingProfilePolicyPropertiesTests.java | 88 - ...filePropertiesCurrentPaymentTermTests.java | 34 - ...opertiesIndirectRelationshipInfoTests.java | 34 - ...pertyPropertiesEnrollmentDetailsTests.java | 39 - .../generated/BillingRequestInnerTests.java | 106 - .../BillingRequestListResultTests.java | 23 - ...illingRequestPropertiesCreatedByTests.java | 33 - ...ngRequestPropertiesLastUpdatedByTests.java | 33 - ...llingRequestPropertiesReviewedByTests.java | 32 - .../BillingRequestPropertiesTests.java | 97 - ...illingRequestsCreateOrUpdateMockTests.java | 100 - ...llingRequestsGetWithResponseMockTests.java | 58 - ...RequestsListByBillingAccountMockTests.java | 62 - ...RequestsListByBillingProfileMockTests.java | 61 - ...illingRequestsListByCustomerMockTests.java | 60 - ...RequestsListByInvoiceSectionMockTests.java | 61 - .../BillingRequestsListByUserMockTests.java | 60 - .../BillingRoleAssignmentInnerTests.java | 63 - ...ingRoleAssignmentListResultInnerTests.java | 23 - .../BillingRoleAssignmentPropertiesTests.java | 45 - ...nmentsCreateByBillingAccountMockTests.java | 54 - ...nmentsCreateByBillingProfileMockTests.java | 54 - ...eAssignmentsCreateByCustomerMockTests.java | 54 - ...nmentsCreateByInvoiceSectionMockTests.java | 54 - ...eateOrUpdateByBillingAccountMockTests.java | 71 - ...tsCreateOrUpdateByDepartmentMockTests.java | 70 - ...eOrUpdateByEnrollmentAccountMockTests.java | 70 - ...ByBillingAccountWithResponseMockTests.java | 34 - ...ByBillingProfileWithResponseMockTests.java | 34 - ...DeleteByCustomerWithResponseMockTests.java | 35 - ...leteByDepartmentWithResponseMockTests.java | 34 - ...nrollmentAccountWithResponseMockTests.java | 35 - ...ByInvoiceSectionWithResponseMockTests.java | 34 - ...ByBillingAccountWithResponseMockTests.java | 46 - ...ByBillingProfileWithResponseMockTests.java | 46 - ...ntsGetByCustomerWithResponseMockTests.java | 47 - ...sGetByDepartmentWithResponseMockTests.java | 46 - ...nrollmentAccountWithResponseMockTests.java | 46 - ...ByInvoiceSectionWithResponseMockTests.java | 47 - ...ignmentsListByBillingAccountMockTests.java | 47 - ...ignmentsListByBillingProfileMockTests.java | 47 - ...oleAssignmentsListByCustomerMockTests.java | 47 - ...eAssignmentsListByDepartmentMockTests.java | 46 - ...mentsListByEnrollmentAccountMockTests.java | 46 - ...ignmentsListByInvoiceSectionMockTests.java | 47 - ...mentsResolveByBillingAccountMockTests.java | 36 - ...mentsResolveByBillingProfileMockTests.java | 36 - ...AssignmentsResolveByCustomerMockTests.java | 36 - ...mentsResolveByInvoiceSectionMockTests.java | 37 - .../BillingRoleDefinitionInnerTests.java | 44 - .../BillingRoleDefinitionListResultTests.java | 23 - .../BillingRoleDefinitionPropertiesTests.java | 26 - ...ByBillingAccountWithResponseMockTests.java | 40 - ...ByBillingProfileWithResponseMockTests.java | 40 - ...onsGetByCustomerWithResponseMockTests.java | 41 - ...sGetByDepartmentWithResponseMockTests.java | 40 - ...nrollmentAccountWithResponseMockTests.java | 40 - ...ByInvoiceSectionWithResponseMockTests.java | 41 - ...initionsListByBillingAccountMockTests.java | 40 - ...initionsListByBillingProfileMockTests.java | 40 - ...oleDefinitionsListByCustomerMockTests.java | 40 - ...eDefinitionsListByDepartmentMockTests.java | 40 - ...tionsListByEnrollmentAccountMockTests.java | 40 - ...initionsListByInvoiceSectionMockTests.java | 40 - .../BillingSubscriptionAliasInnerTests.java | 90 - ...llingSubscriptionAliasListResultTests.java | 23 - ...llingSubscriptionAliasPropertiesTests.java | 71 - .../BillingSubscriptionInnerTests.java | 89 - .../BillingSubscriptionListResultTests.java | 23 - .../BillingSubscriptionMergeRequestTests.java | 29 - .../BillingSubscriptionPatchTests.java | 89 - .../BillingSubscriptionPropertiesTests.java | 71 - .../BillingSubscriptionSplitRequestTests.java | 38 - ...BillingSubscriptionStatusDetailsTests.java | 23 - ...iptionsAliasesCreateOrUpdateMockTests.java | 89 - ...ptionsAliasesGetWithResponseMockTests.java | 55 - ...sAliasesListByBillingAccountMockTests.java | 56 - ...ByBillingProfileWithResponseMockTests.java | 56 - ...SubscriptionsGetWithResponseMockTests.java | 55 - ...riptionsListByBillingAccountMockTests.java | 56 - ...riptionsListByBillingProfileMockTests.java | 56 - ...stByCustomerAtBillingAccountMockTests.java | 56 - ...gSubscriptionsListByCustomerMockTests.java | 56 - ...tionsListByEnrollmentAccountMockTests.java | 56 - ...riptionsListByInvoiceSectionMockTests.java | 56 - .../BillingSubscriptionsMergeMockTests.java | 57 - .../BillingSubscriptionsMoveMockTests.java | 58 - .../BillingSubscriptionsSplitMockTests.java | 61 - .../BillingSubscriptionsUpdateMockTests.java | 90 - .../CancelSubscriptionRequestTests.java | 30 - .../generated/CheckAccessRequestTests.java | 27 - .../CheckAccessResponseInnerTests.java | 23 - .../billing/generated/CustomerInnerTests.java | 62 - .../generated/CustomerListResultTests.java | 23 - .../generated/CustomerPolicyInnerTests.java | 65 - .../CustomerPolicyPropertiesTests.java | 47 - .../generated/CustomerPropertiesTests.java | 55 - ...ByBillingAccountWithResponseMockTests.java | 43 - .../CustomersGetWithResponseMockTests.java | 43 - ...ustomersListByBillingAccountMockTests.java | 45 - ...ustomersListByBillingProfileMockTests.java | 46 - .../generated/DepartmentInnerTests.java | 46 - .../generated/DepartmentListResultTests.java | 23 - .../generated/DepartmentPropertiesTests.java | 29 - .../DepartmentsGetWithResponseMockTests.java | 40 - ...artmentsListByBillingAccountMockTests.java | 42 - .../DocumentDownloadRequestTests.java | 29 - .../DocumentDownloadResultInnerTests.java | 23 - .../EnrollmentAccountInnerTests.java | 50 - .../EnrollmentAccountListResultTests.java | 23 - .../EnrollmentAccountPropertiesTests.java | 32 - ...llmentAccountSubscriptionDetailsTests.java | 23 - ...sGetByDepartmentWithResponseMockTests.java | 42 - ...lmentAccountsGetWithResponseMockTests.java | 42 - ...AccountsListByBillingAccountMockTests.java | 43 - ...mentAccountsListByDepartmentMockTests.java | 43 - ...tDetailsIndirectRelationshipInfoTests.java | 33 - .../EnterpriseAgreementPoliciesTests.java | 36 - ...tendedStatusDefinitionPropertiesTests.java | 26 - .../ExtendedStatusInfoPropertiesTests.java | 25 - .../billing/generated/FailedPaymentTests.java | 23 - .../IndirectRelationshipInfoTests.java | 32 - .../InitiateTransferPropertiesTests.java | 25 - .../InitiateTransferRequestTests.java | 25 - .../generated/InvoiceDocumentTests.java | 23 - .../billing/generated/InvoiceInnerTests.java | 66 - .../generated/InvoiceListResultTests.java | 23 - .../InvoicePropertiesAmountDueTests.java | 22 - ...PropertiesAzurePrepaymentAppliedTests.java | 23 - .../InvoicePropertiesBilledAmountTests.java | 22 - .../InvoicePropertiesCreditAmountTests.java | 22 - ...PropertiesFreeAzureCreditAppliedTests.java | 23 - .../InvoicePropertiesRebillDetailsTests.java | 23 - .../InvoicePropertiesRefundDetailsTests.java | 27 - .../InvoicePropertiesSubTotalTests.java | 22 - .../InvoicePropertiesTaxAmountTests.java | 22 - .../generated/InvoicePropertiesTests.java | 46 - .../InvoicePropertiesTotalAmountTests.java | 23 - ...icesDownloadByBillingAccountMockTests.java | 35 - ...ownloadByBillingSubscriptionMockTests.java | 35 - ...oadDocumentsByBillingAccountMockTests.java | 43 - ...cumentsByBillingSubscriptionMockTests.java | 41 - ...nloadSummaryByBillingAccountMockTests.java | 35 - ...ByBillingAccountWithResponseMockTests.java | 39 - ...lingSubscriptionWithResponseMockTests.java | 39 - .../InvoicesGetWithResponseMockTests.java | 38 - ...InvoicesListByBillingAccountMockTests.java | 40 - ...InvoicesListByBillingProfileMockTests.java | 40 - ...cesListByBillingSubscriptionMockTests.java | 40 - .../MoveBillingSubscriptionRequestTests.java | 30 - .../generated/MoveProductRequestTests.java | 25 - .../NextBillingCycleDetailsTests.java | 22 - .../generated/OperationDisplayTests.java | 23 - .../generated/OperationInnerTests.java | 24 - .../generated/OperationListResultTests.java | 23 - .../generated/OperationsListMockTests.java | 36 - .../billing/generated/ParticipantTests.java | 23 - ...artnerInitiateTransferPropertiesTests.java | 29 - .../PartnerInitiateTransferRequestTests.java | 30 - ...PartnerTransferDetailsListResultTests.java | 23 - .../billing/generated/PatchModelTests.java | 133 - .../PatchPropertiesRenewPropertiesTests.java | 84 - .../generated/PatchPropertiesTests.java | 113 - .../billing/generated/PaymentAmountTests.java | 22 - .../generated/PaymentMethodInnerTests.java | 52 - .../PaymentMethodLinkInnerTests.java | 56 - .../PaymentMethodLinkPropertiesTests.java | 39 - .../PaymentMethodLinksListResultTests.java | 23 - .../generated/PaymentMethodLogoTests.java | 22 - .../PaymentMethodPropertiesTests.java | 34 - ...hodsDeleteByUserWithResponseMockTests.java | 33 - ...ByBillingAccountWithResponseMockTests.java | 43 - ...ByBillingProfileWithResponseMockTests.java | 45 - ...MethodsGetByUserWithResponseMockTests.java | 43 - ...tMethodsListByBillingAccountMockTests.java | 43 - ...tMethodsListByBillingProfileMockTests.java | 44 - .../PaymentMethodsListByUserMockTests.java | 42 - .../PaymentMethodsListResultTests.java | 23 - .../PaymentOnAccountAmountTests.java | 22 - .../generated/PaymentOnAccountTests.java | 24 - .../billing/generated/PaymentTermTests.java | 33 - .../billing/generated/PaymentTests.java | 24 - ...eateOrUpdateByBillingAccountMockTests.java | 100 - ...eateOrUpdateByBillingProfileMockTests.java | 113 - ...teByCustomerAtBillingAccountMockTests.java | 80 - ...ciesCreateOrUpdateByCustomerMockTests.java | 76 - ...ByBillingAccountWithResponseMockTests.java | 60 - ...ByBillingProfileWithResponseMockTests.java | 64 - ...AtBillingAccountWithResponseMockTests.java | 46 - ...iesGetByCustomerWithResponseMockTests.java | 48 - ...etBySubscriptionWithResponseMockTests.java | 43 - .../billing/generated/PolicySummaryTests.java | 37 - .../billing/generated/PrincipalTests.java | 30 - .../generated/ProductDetailsTests.java | 28 - .../billing/generated/ProductInnerTests.java | 50 - .../generated/ProductListResultTests.java | 23 - .../billing/generated/ProductPatchTests.java | 51 - .../ProductPropertiesLastChargeTests.java | 22 - .../ProductPropertiesResellerTests.java | 22 - .../generated/ProductPropertiesTests.java | 31 - .../ProductsGetWithResponseMockTests.java | 41 - ...ProductsListByBillingAccountMockTests.java | 42 - ...ProductsListByBillingProfileMockTests.java | 42 - .../ProductsListByCustomerMockTests.java | 42 - ...ProductsListByInvoiceSectionMockTests.java | 42 - .../generated/ProductsMoveMockTests.java | 42 - .../ProductsUpdateWithResponseMockTests.java | 64 - .../generated/ProxyResourceWithTagsTests.java | 40 - .../billing/generated/RebillDetailsTests.java | 23 - ...cipientTransferDetailsListResultTests.java | 23 - ...ransfersValidateWithResponseMockTests.java | 44 - ...fundDetailsSummaryAmountRefundedTests.java | 22 - ...undDetailsSummaryAmountRequestedTests.java | 23 - .../generated/RefundDetailsSummaryTests.java | 27 - ...TransactionDetailsAmountRefundedTests.java | 23 - ...ransactionDetailsAmountRequestedTests.java | 23 - .../RefundTransactionDetailsTests.java | 31 - .../generated/RegistrationNumberTests.java | 26 - .../generated/RenewalTermDetailsTests.java | 26 - .../billing/generated/ResellerTests.java | 22 - ...eservationAppliedScopePropertiesTests.java | 38 - .../ReservationMergePropertiesTests.java | 30 - .../ReservationPropertyUtilizationTests.java | 27 - ...ertiesReservedResourcePropertiesTests.java | 30 - ...rvationPurchaseRequestPropertiesTests.java | 74 - .../ReservationPurchaseRequestTests.java | 81 - .../ReservationSkuPropertyTests.java | 22 - .../ReservationSplitPropertiesTests.java | 31 - .../generated/ReservationSummaryTests.java | 23 - .../ReservationSwapPropertiesTests.java | 29 - ...ReservationUtilizationAggregatesTests.java | 23 - .../SavingsPlanSummaryCountTests.java | 23 - ...SavingsPlanUpdateValidateRequestTests.java | 131 - .../billing/generated/SkuNameTests.java | 24 - .../billing/generated/SkuTests.java | 24 - .../generated/SpendingLimitDetailsTests.java | 44 - .../SubscriptionEnrollmentDetailsTests.java | 38 - .../SubscriptionPolicyInnerTests.java | 70 - .../SubscriptionPolicyPropertiesTests.java | 47 - .../generated/SystemOverridesTests.java | 23 - .../billing/generated/TaxIdentifierTests.java | 40 - ...tionPropertiesAzureCreditAppliedTests.java | 23 - ...ConsumptionCommitmentDecrementedTests.java | 24 - ...nsactionPropertiesEffectivePriceTests.java | 23 - ...TransactionPropertiesMarketPriceTests.java | 23 - ...opertiesRefundTransactionDetailsTests.java | 31 - .../TransactionPropertiesSubTotalTests.java | 23 - .../TransactionPropertiesTaxTests.java | 23 - ...ctionPropertiesTransactionAmountTests.java | 23 - .../TransactionSummaryInnerTests.java | 23 - ...SummaryByInvoiceWithResponseMockTests.java | 38 - ...ransactionsDownloadByInvoiceMockTests.java | 35 - .../TransferDetailsListResultTests.java | 23 - .../TransitionDetailsInnerTests.java | 23 - .../generated/UtilizationAggregatesTests.java | 23 - .../billing/generated/UtilizationTests.java | 25 - 352 files changed, 15911 insertions(+), 24479 deletions(-) create mode 100644 sdk/billing/azure-resourcemanager-billing/src/main/resources/azure-resourcemanager-billing.properties delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AcceptTransferPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AcceptTransferRequestTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AgreementInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AgreementListResultTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AgreementPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AgreementsGetWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AgreementsListByBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AmountTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AppliedScopePropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantListResultTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantsCreateOrUpdateMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantsGetWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantsListByBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalanceInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalancePropertiesAmountTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalancePropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalancePropertiesTotalPaymentsOnAccountTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalancesGetByBillingAccountWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalancesGetByBillingProfileWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AzurePlanTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BeneficiaryTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingAccountPolicyInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingAccountPolicyPropertiesEnterpriseAgreementPoliciesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingAccountPolicyPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingAccountPropertiesRegistrationNumberTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingAccountsConfirmTransitionWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionListResultTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByBillingAccountWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByBillingProfileWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByCustomerWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByDepartmentWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByEnrollmentAccountWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByInvoiceSectionWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByBillingProfileMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByCustomerAtBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByCustomerMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByDepartmentMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByEnrollmentAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByInvoiceSectionMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfileInfoTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfilePolicyInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfilePolicyPropertiesEnterpriseAgreementPoliciesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfilePolicyPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfilePropertiesCurrentPaymentTermTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfilePropertiesIndirectRelationshipInfoTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPropertyPropertiesEnrollmentDetailsTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestListResultTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestPropertiesCreatedByTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestPropertiesLastUpdatedByTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestPropertiesReviewedByTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsCreateOrUpdateMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsGetWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsListByBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsListByBillingProfileMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsListByCustomerMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsListByInvoiceSectionMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsListByUserMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentListResultInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateByBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateByBillingProfileMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateByCustomerMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateByInvoiceSectionMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateOrUpdateByBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateOrUpdateByDepartmentMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateOrUpdateByEnrollmentAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByBillingAccountWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByBillingProfileWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByCustomerWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByDepartmentWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByEnrollmentAccountWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByInvoiceSectionWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByBillingAccountWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByBillingProfileWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByCustomerWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByDepartmentWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByEnrollmentAccountWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByInvoiceSectionWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByBillingProfileMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByCustomerMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByDepartmentMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByEnrollmentAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByInvoiceSectionMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsResolveByBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsResolveByBillingProfileMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsResolveByCustomerMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsResolveByInvoiceSectionMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionListResultTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByBillingAccountWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByBillingProfileWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByCustomerWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByDepartmentWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByEnrollmentAccountWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByInvoiceSectionWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByBillingProfileMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByCustomerMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByDepartmentMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByEnrollmentAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByInvoiceSectionMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionAliasInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionAliasListResultTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionAliasPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionListResultTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionMergeRequestTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionPatchTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionSplitRequestTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionStatusDetailsTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsAliasesCreateOrUpdateMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsAliasesGetWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsAliasesListByBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsGetByBillingProfileWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsGetWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByBillingProfileMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByCustomerAtBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByCustomerMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByEnrollmentAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByInvoiceSectionMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsMergeMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsMoveMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsSplitMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsUpdateMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CancelSubscriptionRequestTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CheckAccessRequestTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CheckAccessResponseInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomerInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomerListResultTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomerPolicyInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomerPolicyPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomerPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomersGetByBillingAccountWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomersGetWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomersListByBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomersListByBillingProfileMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DepartmentInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DepartmentListResultTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DepartmentPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DepartmentsGetWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DepartmentsListByBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DocumentDownloadRequestTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DocumentDownloadResultInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountListResultTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountSubscriptionDetailsTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountsGetByDepartmentWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountsGetWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountsListByBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountsListByDepartmentMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentDetailsIndirectRelationshipInfoTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnterpriseAgreementPoliciesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ExtendedStatusDefinitionPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ExtendedStatusInfoPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/FailedPaymentTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/IndirectRelationshipInfoTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InitiateTransferPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InitiateTransferRequestTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoiceDocumentTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoiceInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoiceListResultTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesAmountDueTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesAzurePrepaymentAppliedTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesBilledAmountTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesCreditAmountTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesFreeAzureCreditAppliedTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesRebillDetailsTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesRefundDetailsTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesSubTotalTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesTaxAmountTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesTotalAmountTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesDownloadByBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesDownloadByBillingSubscriptionMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesDownloadDocumentsByBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesDownloadDocumentsByBillingSubscriptionMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesDownloadSummaryByBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesGetByBillingAccountWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesGetByBillingSubscriptionWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesGetWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesListByBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesListByBillingProfileMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesListByBillingSubscriptionMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/MoveBillingSubscriptionRequestTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/MoveProductRequestTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/NextBillingCycleDetailsTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/OperationDisplayTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/OperationInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/OperationListResultTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/OperationsListMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ParticipantTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PartnerInitiateTransferPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PartnerInitiateTransferRequestTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PartnerTransferDetailsListResultTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PatchModelTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PatchPropertiesRenewPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PatchPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentAmountTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodLinkInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodLinkPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodLinksListResultTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodLogoTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsDeleteByUserWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsGetByBillingAccountWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsGetByBillingProfileWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsGetByUserWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsListByBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsListByBillingProfileMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsListByUserMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsListResultTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentOnAccountAmountTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentOnAccountTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentTermTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesCreateOrUpdateByBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesCreateOrUpdateByBillingProfileMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesCreateOrUpdateByCustomerAtBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesCreateOrUpdateByCustomerMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesGetByBillingAccountWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesGetByBillingProfileWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesGetByCustomerAtBillingAccountWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesGetByCustomerWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesGetBySubscriptionWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PolicySummaryTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PrincipalTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductDetailsTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductListResultTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductPatchTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductPropertiesLastChargeTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductPropertiesResellerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsGetWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsListByBillingAccountMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsListByBillingProfileMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsListByCustomerMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsListByInvoiceSectionMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsMoveMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsUpdateWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProxyResourceWithTagsTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RebillDetailsTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RecipientTransferDetailsListResultTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RecipientTransfersValidateWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundDetailsSummaryAmountRefundedTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundDetailsSummaryAmountRequestedTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundDetailsSummaryTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundTransactionDetailsAmountRefundedTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundTransactionDetailsAmountRequestedTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundTransactionDetailsTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RegistrationNumberTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RenewalTermDetailsTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ResellerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationAppliedScopePropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationMergePropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationPropertyUtilizationTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationPurchaseRequestPropertiesReservedResourcePropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationPurchaseRequestPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationPurchaseRequestTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationSkuPropertyTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationSplitPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationSummaryTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationSwapPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationUtilizationAggregatesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SavingsPlanSummaryCountTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SavingsPlanUpdateValidateRequestTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SkuNameTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SkuTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SpendingLimitDetailsTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SubscriptionEnrollmentDetailsTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SubscriptionPolicyInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SubscriptionPolicyPropertiesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SystemOverridesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TaxIdentifierTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesAzureCreditAppliedTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesConsumptionCommitmentDecrementedTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesEffectivePriceTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesMarketPriceTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesRefundTransactionDetailsTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesSubTotalTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesTaxTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesTransactionAmountTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionSummaryInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionsGetTransactionSummaryByInvoiceWithResponseMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionsTransactionsDownloadByInvoiceMockTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransferDetailsListResultTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransitionDetailsInnerTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/UtilizationAggregatesTests.java delete mode 100644 sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/UtilizationTests.java diff --git a/sdk/billing/azure-resourcemanager-billing/CHANGELOG.md b/sdk/billing/azure-resourcemanager-billing/CHANGELOG.md index e47113838da6..ccef179a67a2 100644 --- a/sdk/billing/azure-resourcemanager-billing/CHANGELOG.md +++ b/sdk/billing/azure-resourcemanager-billing/CHANGELOG.md @@ -1,14 +1,8 @@ # Release History -## 1.1.0-beta.1 (Unreleased) +## 1.0.0-beta.1 (2025-05-13) -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes +- Azure Resource Manager Billing client library for Java. This package contains Microsoft Azure SDK for Billing Management SDK. Billing Client. Package tag package-2024-04. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## 1.0.0 (2024-09-05) diff --git a/sdk/billing/azure-resourcemanager-billing/README.md b/sdk/billing/azure-resourcemanager-billing/README.md index 216541da39d8..efaf58adecdd 100644 --- a/sdk/billing/azure-resourcemanager-billing/README.md +++ b/sdk/billing/azure-resourcemanager-billing/README.md @@ -52,7 +52,7 @@ Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: ```java -AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); TokenCredential credential = new DefaultAzureCredentialBuilder() .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) .build(); @@ -60,7 +60,7 @@ BillingManager manager = BillingManager .authenticate(credential, profile); ``` -The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` variable if otherwise. See [Authentication][authenticate] for more options. @@ -100,5 +100,3 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ - - diff --git a/sdk/billing/azure-resourcemanager-billing/SAMPLE.md b/sdk/billing/azure-resourcemanager-billing/SAMPLE.md index d9058aca61c8..0124cad4382d 100644 --- a/sdk/billing/azure-resourcemanager-billing/SAMPLE.md +++ b/sdk/billing/azure-resourcemanager-billing/SAMPLE.md @@ -281,46 +281,29 @@ ### Address_Validate ```java -import com.azure.resourcemanager.billing.models.AddressDetails; +import com.azure.resourcemanager.billing.models.CheckAccessRequest; +import java.util.Arrays; /** - * Samples for Address Validate. + * Samples for BillingPermissions CheckAccessByDepartment. */ -public final class AddressValidateSamples { - /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/addressValidateInvalid.json - */ - /** - * Sample code: AddressValidateInvalid. - * - * @param manager Entry point to BillingManager. - */ - public static void addressValidateInvalid(com.azure.resourcemanager.billing.BillingManager manager) { - manager.address() - .validateWithResponse(new AddressDetails().withAddressLine1("1 Test") - .withCity("bellevue") - .withCountry("us") - .withPostalCode("fakeTokenPlaceholder") - .withRegion("wa"), com.azure.core.util.Context.NONE); - } - +public final class BillingPermissionsCheckAccessByDepartmentSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/addressValidateValid.json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/checkAccessByDepartment.json */ /** - * Sample code: AddressValidateValid. + * Sample code: CheckAccessByDepartment. * * @param manager Entry point to BillingManager. */ - public static void addressValidateValid(com.azure.resourcemanager.billing.BillingManager manager) { - manager.address() - .validateWithResponse(new AddressDetails().withAddressLine1("1 Test") - .withCity("bellevue") - .withCountry("us") - .withPostalCode("fakeTokenPlaceholder") - .withRegion("wa"), com.azure.core.util.Context.NONE); + public static void checkAccessByDepartment(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingPermissions() + .checkAccessByDepartmentWithResponse( + "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "12345", + new CheckAccessRequest().withActions(Arrays.asList("Microsoft.Billing/billingAccounts/read", + "Microsoft.Subscription/subscriptions/write")), + com.azure.core.util.Context.NONE); } } ``` @@ -328,23 +311,64 @@ public final class AddressValidateSamples { ### Agreements_Get ```java +import com.azure.resourcemanager.billing.fluent.models.BillingProfileInner; +import com.azure.resourcemanager.billing.models.AzurePlan; +import com.azure.resourcemanager.billing.models.BillingProfileProperties; +import com.azure.resourcemanager.billing.models.BillingProfilePropertiesBillTo; +import com.azure.resourcemanager.billing.models.BillingProfilePropertiesShipTo; +import java.util.Arrays; + /** - * Samples for Agreements Get. + * Samples for BillingProfiles CreateOrUpdate. */ -public final class AgreementsGetSamples { +public final class BillingProfilesCreateOrUpdateSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/agreementByName.json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingProfilesCreateOrUpdate + * .json */ /** - * Sample code: AgreementByName. + * Sample code: BillingProfilesCreateOrUpdate. * * @param manager Entry point to BillingManager. */ - public static void agreementByName(com.azure.resourcemanager.billing.BillingManager manager) { - manager.agreements() - .getWithResponse("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "ABC123", com.azure.core.util.Context.NONE); + public static void billingProfilesCreateOrUpdate(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingProfiles() + .createOrUpdate("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", + new BillingProfileInner().withProperties(new BillingProfileProperties() + .withBillTo(new BillingProfilePropertiesBillTo().withAddressLine1("Test Address1") + .withAddressLine2("Test Address2") + .withAddressLine3("Test Address3") + .withCity("City") + .withCompanyName("Contoso") + .withCountry("US") + .withEmail("abc@contoso.com") + .withFirstName("Test") + .withLastName("User") + .withPhoneNumber("000-000-0000") + .withPostalCode("fakeTokenPlaceholder") + .withRegion("WA") + .withIsValidAddress(true)) + .withDisplayName("Billing Profile 1") + .withEnabledAzurePlans( + Arrays.asList(new AzurePlan().withSkuId("0001"), new AzurePlan().withSkuId("0002"))) + .withInvoiceEmailOptIn(true) + .withPoNumber("ABC12345") + .withShipTo(new BillingProfilePropertiesShipTo().withAddressLine1("Test Address1") + .withAddressLine2("Test Address2") + .withAddressLine3("Test Address3") + .withCity("City") + .withCompanyName("Contoso") + .withCountry("US") + .withEmail("abc@contoso.com") + .withFirstName("Test") + .withLastName("User") + .withPhoneNumber("000-000-0000") + .withPostalCode("fakeTokenPlaceholder") + .withRegion("WA") + .withIsValidAddress(true))), + com.azure.core.util.Context.NONE); } } ``` @@ -352,23 +376,29 @@ public final class AgreementsGetSamples { ### Agreements_ListByBillingAccount ```java +import com.azure.resourcemanager.billing.models.CancelSubscriptionRequest; +import com.azure.resourcemanager.billing.models.CancellationReason; + /** - * Samples for Agreements ListByBillingAccount. + * Samples for BillingSubscriptions Cancel. */ -public final class AgreementsListByBillingAccountSamples { +public final class BillingSubscriptionsCancelSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * agreementsListByBillingAccount.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionsCancel. + * json */ /** - * Sample code: AgreementsListByBillingAccount. + * Sample code: BillingSubscriptionsCancel. * * @param manager Entry point to BillingManager. */ - public static void agreementsListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.agreements() - .listByBillingAccount( - "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "Participants", + public static void billingSubscriptionsCancel(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingSubscriptions() + .cancel("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "11111111-1111-1111-1111-111111111111", + new CancelSubscriptionRequest().withCancellationReason(CancellationReason.COMPROMISE) + .withCustomerId("11111111-1111-1111-1111-111111111111"), com.azure.core.util.Context.NONE); } } @@ -377,32 +407,29 @@ public final class AgreementsListByBillingAccountSamples { ### AssociatedTenants_CreateOrUpdate ```java -import com.azure.resourcemanager.billing.fluent.models.AssociatedTenantInner; -import com.azure.resourcemanager.billing.models.AssociatedTenantProperties; -import com.azure.resourcemanager.billing.models.BillingManagementTenantState; -import com.azure.resourcemanager.billing.models.ProvisioningTenantState; +import com.azure.resourcemanager.billing.models.DocumentDownloadRequest; +import java.util.Arrays; /** - * Samples for AssociatedTenants CreateOrUpdate. + * Samples for Invoices DownloadDocumentsByBillingAccount. */ -public final class AssociatedTenantsCreateOrUpdateSamples { +public final class InvoicesDownloadDocumentsByBillingAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * associatedTenantsCreateOrUpdate.json + * invoicesDownloadDocumentsByBillingAccount.json */ /** - * Sample code: AssociatedTenantsCreateOrUpdate. + * Sample code: InvoicesDownloadDocumentsByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void associatedTenantsCreateOrUpdate(com.azure.resourcemanager.billing.BillingManager manager) { - manager.associatedTenants() - .createOrUpdate("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "11111111-1111-1111-1111-111111111111", - new AssociatedTenantInner() - .withProperties(new AssociatedTenantProperties().withDisplayName("Contoso Finance") - .withBillingManagementState(BillingManagementTenantState.ACTIVE) - .withProvisioningManagementState(ProvisioningTenantState.PENDING)), + public static void + invoicesDownloadDocumentsByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.invoices() + .downloadDocumentsByBillingAccount( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + Arrays.asList(new DocumentDownloadRequest().withDocumentName("12345678").withInvoiceName("G123456789"), + new DocumentDownloadRequest().withDocumentName("12345678").withInvoiceName("G987654321")), com.azure.core.util.Context.NONE); } } @@ -411,23 +438,28 @@ public final class AssociatedTenantsCreateOrUpdateSamples { ### AssociatedTenants_Delete ```java +import com.azure.resourcemanager.billing.models.MoveProductRequest; + /** - * Samples for AssociatedTenants Delete. + * Samples for Products Move. */ -public final class AssociatedTenantsDeleteSamples { +public final class ProductsMoveSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/associatedTenantsDelete.json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/productMove.json */ /** - * Sample code: AssociatedTenantsDelete. + * Sample code: ProductMove. * * @param manager Entry point to BillingManager. */ - public static void associatedTenantsDelete(com.azure.resourcemanager.billing.BillingManager manager) { - manager.associatedTenants() - .delete("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "11111111-1111-1111-1111-111111111111", com.azure.core.util.Context.NONE); + public static void productMove(com.azure.resourcemanager.billing.BillingManager manager) { + manager.products() + .move("a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", + "6b96d3f2-9008-4a9d-912f-f87744185aa3", + new MoveProductRequest().withDestinationInvoiceSectionId( + "/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), + com.azure.core.util.Context.NONE); } } ``` @@ -436,22 +468,22 @@ public final class AssociatedTenantsDeleteSamples { ```java /** - * Samples for AssociatedTenants Get. + * Samples for Transfers Get. */ -public final class AssociatedTenantsGetSamples { +public final class TransfersGetSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/associatedTenantsGet.json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/transfersGet.json */ /** - * Sample code: AssociatedTenantsGet. + * Sample code: TransferGet. * * @param manager Entry point to BillingManager. */ - public static void associatedTenantsGet(com.azure.resourcemanager.billing.BillingManager manager) { - manager.associatedTenants() - .getWithResponse("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "11111111-1111-1111-1111-111111111111", com.azure.core.util.Context.NONE); + public static void transferGet(com.azure.resourcemanager.billing.BillingManager manager) { + manager.transfers() + .getWithResponse("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", "aabb123", com.azure.core.util.Context.NONE); } } ``` @@ -460,23 +492,24 @@ public final class AssociatedTenantsGetSamples { ```java /** - * Samples for AssociatedTenants ListByBillingAccount. + * Samples for BillingPermissions ListByInvoiceSection. */ -public final class AssociatedTenantsListByBillingAccountSamples { +public final class BillingPermissionsListByInvoiceSectionSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * associatedTenantsListByBillingAccount.json + * billingPermissionsListByInvoiceSection.json */ /** - * Sample code: AssociatedTenantsListByBillingAccount. + * Sample code: BillingPermissionsListByInvoiceSection. * * @param manager Entry point to BillingManager. */ - public static void associatedTenantsListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.associatedTenants() - .listByBillingAccount( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", null, null, - null, null, null, null, null, com.azure.core.util.Context.NONE); + public static void + billingPermissionsListByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingPermissions() + .listByInvoiceSection( + "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", "XXXX-XXXX-XXX-XXX", com.azure.core.util.Context.NONE); } } ``` @@ -485,23 +518,24 @@ public final class AssociatedTenantsListByBillingAccountSamples { ```java /** - * Samples for AvailableBalances GetByBillingAccount. + * Samples for BillingRoleAssignments ResolveByInvoiceSection. */ -public final class AvailableBalancesGetByBillingAccountSamples { +public final class BillingRoleAssignmentsResolveByInvoiceSectionSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * availableBalanceGetByBillingAccount.json + * resolveBillingRoleAssignmentByInvoiceSection.json */ /** - * Sample code: AvailableBalanceGetByBillingAccount. + * Sample code: ResolveBillingRoleAssignmentByInvoiceSection. * * @param manager Entry point to BillingManager. */ - public static void availableBalanceGetByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.availableBalances() - .getByBillingAccountWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - com.azure.core.util.Context.NONE); + public static void + resolveBillingRoleAssignmentByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .resolveByInvoiceSection( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", + "BKM6-54VH-BG7-PGB", "xxxx-xxxx-xxx-xxx", null, null, com.azure.core.util.Context.NONE); } } ``` @@ -509,24 +543,25 @@ public final class AvailableBalancesGetByBillingAccountSamples { ### AvailableBalances_GetByBillingProfile ```java +import java.time.OffsetDateTime; + /** - * Samples for AvailableBalances GetByBillingProfile. + * Samples for BillingAccounts CancelPaymentTerms. */ -public final class AvailableBalancesGetByBillingProfileSamples { +public final class BillingAccountsCancelPaymentTermsSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * availableBalanceGetByBillingProfile.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentTermsCancel.json */ /** - * Sample code: AvailableBalanceGetByBillingProfile. + * Sample code: PaymentTermsCancel. * * @param manager Entry point to BillingManager. */ - public static void availableBalanceGetByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { - manager.availableBalances() - .getByBillingProfileWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", com.azure.core.util.Context.NONE); + public static void paymentTermsCancel(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingAccounts() + .cancelPaymentTerms("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + OffsetDateTime.parse("2023-01-05T22:39:34.2606750Z"), com.azure.core.util.Context.NONE); } } ``` @@ -534,29 +569,24 @@ public final class AvailableBalancesGetByBillingProfileSamples { ### BillingAccounts_AddPaymentTerms ```java -import com.azure.resourcemanager.billing.models.PaymentTerm; -import java.time.OffsetDateTime; -import java.util.Arrays; - /** - * Samples for BillingAccounts AddPaymentTerms. + * Samples for Invoices GetByBillingAccount. */ -public final class BillingAccountsAddPaymentTermsSamples { +public final class InvoicesGetByBillingAccountSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentTermsAdd.json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoicesGetByBillingAccount. + * json */ /** - * Sample code: PaymentTermsAdd. + * Sample code: InvoicesGetByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void paymentTermsAdd(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingAccounts() - .addPaymentTerms("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - Arrays.asList(new PaymentTerm().withTerm("net10") - .withStartDate(OffsetDateTime.parse("2023-01-05T22:39:34.2606750Z")) - .withEndDate(OffsetDateTime.parse("2023-01-25T22:39:34.2606750Z"))), + public static void invoicesGetByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.invoices() + .getByBillingAccountWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "G123456789", com.azure.core.util.Context.NONE); } } @@ -565,25 +595,26 @@ public final class BillingAccountsAddPaymentTermsSamples { ### BillingAccounts_CancelPaymentTerms ```java -import java.time.OffsetDateTime; - /** - * Samples for BillingAccounts CancelPaymentTerms. + * Samples for BillingRoleDefinition GetByInvoiceSection. */ -public final class BillingAccountsCancelPaymentTermsSamples { +public final class BillingRoleDefinitionGetByInvoiceSectionSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentTermsCancel.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingRoleDefinitionGetByInvoiceSection.json */ /** - * Sample code: PaymentTermsCancel. + * Sample code: BillingRoleDefinitionGetByInvoiceSection. * * @param manager Entry point to BillingManager. */ - public static void paymentTermsCancel(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingAccounts() - .cancelPaymentTerms("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - OffsetDateTime.parse("2023-01-05T22:39:34.2606750Z"), com.azure.core.util.Context.NONE); + public static void + billingRoleDefinitionGetByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleDefinitions() + .getByInvoiceSectionWithResponse( + "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", "30000000-aaaa-bbbb-cccc-100000000000", + com.azure.core.util.Context.NONE); } } ``` @@ -591,23 +622,37 @@ public final class BillingAccountsCancelPaymentTermsSamples { ### BillingAccounts_ConfirmTransition ```java +import com.azure.resourcemanager.billing.fluent.models.BillingAccountPolicyInner; +import com.azure.resourcemanager.billing.models.BillingAccountPolicyProperties; +import com.azure.resourcemanager.billing.models.BillingAccountPolicyPropertiesEnterpriseAgreementPolicies; +import com.azure.resourcemanager.billing.models.EnrollmentAuthLevelState; +import com.azure.resourcemanager.billing.models.MarketplacePurchasesPolicy; +import com.azure.resourcemanager.billing.models.ReservationPurchasesPolicy; +import com.azure.resourcemanager.billing.models.SavingsPlanPurchasesPolicy; + /** - * Samples for BillingAccounts ConfirmTransition. + * Samples for Policies CreateOrUpdateByBillingAccount. */ -public final class BillingAccountsConfirmTransitionSamples { +public final class PoliciesCreateOrUpdateByBillingAccountSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingAccountsConfirmTransition.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/policiesPutByBillingAccount. + * json */ /** - * Sample code: BillingAccountsConfirmTransition. + * Sample code: PoliciesPutByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void billingAccountsConfirmTransition(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingAccounts() - .confirmTransitionWithResponse( - "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + public static void policiesPutByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.policies() + .createOrUpdateByBillingAccount("1234567", + new BillingAccountPolicyInner().withProperties(new BillingAccountPolicyProperties() + .withEnterpriseAgreementPolicies(new BillingAccountPolicyPropertiesEnterpriseAgreementPolicies() + .withAuthenticationType(EnrollmentAuthLevelState.ORGANIZATIONAL_ACCOUNT_ONLY)) + .withMarketplacePurchases(MarketplacePurchasesPolicy.ALL_ALLOWED) + .withReservationPurchases(ReservationPurchasesPolicy.ALLOWED) + .withSavingsPlanPurchases(SavingsPlanPurchasesPolicy.NOT_ALLOWED)), com.azure.core.util.Context.NONE); } } @@ -617,487 +662,466 @@ public final class BillingAccountsConfirmTransitionSamples { ```java /** - * Samples for BillingAccounts Get. + * Samples for Transactions TransactionsDownloadByInvoice. */ -public final class BillingAccountsGetSamples { +public final class TransactionsTransactionsDownloadByInvoiceSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGetWithExpand. - * json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/transactionsDownloadByInvoice + * .json */ /** - * Sample code: BillingAccountsGetWithExpand. + * Sample code: TransactionsDownloadByInvoice. * * @param manager Entry point to BillingManager. */ - public static void billingAccountsGetWithExpand(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingAccounts() - .getWithResponse("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + public static void transactionsDownloadByInvoice(com.azure.resourcemanager.billing.BillingManager manager) { + manager.transactions() + .transactionsDownloadByInvoice( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "G123456789", com.azure.core.util.Context.NONE); } +} +``` - /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingAccountWithExpandForPONumber.json - */ - /** - * Sample code: BillingAccountWithExpandForPONumber. - * - * @param manager Entry point to BillingManager. - */ - public static void billingAccountWithExpandForPONumber(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingAccounts().getWithResponse("8608480", com.azure.core.util.Context.NONE); - } +### BillingAccounts_List - /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGetEA.json - */ - /** - * Sample code: BillingAccountsGetEA. - * - * @param manager Entry point to BillingManager. - */ - public static void billingAccountsGetEA(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingAccounts().getWithResponse("6575495", com.azure.core.util.Context.NONE); - } +```java +import com.azure.resourcemanager.billing.models.AppliedScopeProperties; +import com.azure.resourcemanager.billing.models.AppliedScopeType; +import com.azure.resourcemanager.billing.models.BillingPlan; +import com.azure.resourcemanager.billing.models.Commitment; +import com.azure.resourcemanager.billing.models.CommitmentGrain; +import com.azure.resourcemanager.billing.models.PurchaseRequest; +import com.azure.resourcemanager.billing.models.RenewProperties; +import com.azure.resourcemanager.billing.models.SavingsPlanTerm; +import com.azure.resourcemanager.billing.models.SavingsPlanUpdateRequest; +import com.azure.resourcemanager.billing.models.SavingsPlanUpdateRequestProperties; +import com.azure.resourcemanager.billing.models.Sku; +/** + * Samples for SavingsPlans UpdateByBillingAccount. + */ +public final class SavingsPlansUpdateByBillingAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingAccountWithRegistrationNumberWithType.json + * savingsPlanUpdateByBillingAccount.json */ /** - * Sample code: BillingAccountWithRegistrationNumberWithType. + * Sample code: SavingsPlanUpdate. * * @param manager Entry point to BillingManager. */ - public static void - billingAccountWithRegistrationNumberWithType(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingAccounts() - .getWithResponse("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + public static void savingsPlanUpdate(com.azure.resourcemanager.billing.BillingManager manager) { + manager.savingsPlans() + .updateByBillingAccount( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", + new SavingsPlanUpdateRequest() + .withProperties( + new SavingsPlanUpdateRequestProperties().withDisplayName("sp_newName") + .withAppliedScopeType(AppliedScopeType.MANAGEMENT_GROUP) + .withAppliedScopeProperties(new AppliedScopeProperties() + .withTenantId("80000000-0000-0000-0000-000000000000") + .withManagementGroupId("/providers/Microsoft.Management/managementGroups/mg1")) + .withRenew(true) + .withRenewProperties(new RenewProperties().withPurchaseProperties(new PurchaseRequest() + .withSku(new Sku().withName("Compute_Savings_Plan")) + .withDisplayName("sp_newName_renewed") + .withBillingScopeId("/subscriptions/50000000-0000-0000-0000-000000000000") + .withTerm(SavingsPlanTerm.P3Y) + .withBillingPlan(BillingPlan.P1M) + .withAppliedScopeType(AppliedScopeType.MANAGEMENT_GROUP) + .withCommitment(new Commitment().withCurrencyCode("fakeTokenPlaceholder") + .withAmount(0.001D) + .withGrain(CommitmentGrain.HOURLY)) + .withAppliedScopeProperties(new AppliedScopeProperties() + .withTenantId("80000000-0000-0000-0000-000000000000") + .withManagementGroupId("/providers/Microsoft.Management/managementGroups/mg1"))))), com.azure.core.util.Context.NONE); } +} +``` + +### BillingAccounts_ListInvoiceSectionsByCreateSubscriptionPermission +```java +import com.azure.resourcemanager.billing.models.BillingSubscriptionSplitRequest; + +/** + * Samples for BillingSubscriptions Split. + */ +public final class BillingSubscriptionsSplitSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGet.json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionsSplit. + * json */ /** - * Sample code: BillingAccountsGet. + * Sample code: BillingSubscriptionsSplit. * * @param manager Entry point to BillingManager. */ - public static void billingAccountsGet(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingAccounts() - .getWithResponse("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + public static void billingSubscriptionsSplit(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingSubscriptions() + .split("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "11111111-1111-1111-1111-111111111111", + new BillingSubscriptionSplitRequest().withTargetProductTypeId("XYZ56789") + .withTargetSkuId("0001") + .withQuantity(1) + .withTermDuration("P1M") + .withBillingFrequency("P1M"), com.azure.core.util.Context.NONE); } +} +``` + +### BillingAccounts_Update +```java +/** + * Samples for EnrollmentAccounts ListByDepartment. + */ +public final class EnrollmentAccountsListByDepartmentSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingAccountWithRegistrationNumberWithDefaultType.json + * enrollmentAccountsListByDepartment.json */ /** - * Sample code: BillingAccountWithRegistrationNumberWithDefaultType. + * Sample code: EnrollmentAccountsListByDepartment. * * @param manager Entry point to BillingManager. */ - public static void - billingAccountWithRegistrationNumberWithDefaultType(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingAccounts() - .getWithResponse("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + public static void enrollmentAccountsListByDepartment(com.azure.resourcemanager.billing.BillingManager manager) { + manager.enrollmentAccounts() + .listByDepartment("6564892", "164821", null, null, null, null, null, null, com.azure.core.util.Context.NONE); } } ``` -### BillingAccounts_List +### BillingAccounts_ValidatePaymentTerms ```java /** - * Samples for BillingAccounts List. + * Samples for BillingRoleAssignments GetByEnrollmentAccount. */ -public final class BillingAccountsListSamples { +public final class BillingRoleAssignmentsGetByEnrollmentAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingAccountForLegacyAccountDetails.json + * billingRoleAssignmentGetByEnrollmentAccount.json */ /** - * Sample code: BillingAccountForLegacyAccountDetails. + * Sample code: BillingRoleAssignmentGetByEnrollmentAccount. * * @param manager Entry point to BillingManager. */ - public static void billingAccountForLegacyAccountDetails(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingAccounts() - .list(null, null, null, null, null, null, null, null, null, null, null, null, + public static void + billingRoleAssignmentGetByEnrollmentAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .getByEnrollmentAccountWithResponse("7898901", "225314", "9dfd08c2-62a3-4d47-85bd-1cdba1408402", com.azure.core.util.Context.NONE); } +} +``` - /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsList.json - */ - /** - * Sample code: BillingAccountsList. - * - * @param manager Entry point to BillingManager. - */ - public static void billingAccountsList(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingAccounts() - .list(null, null, null, null, null, null, null, null, null, null, null, null, - com.azure.core.util.Context.NONE); - } +### BillingPermissions_CheckAccessByBillingAccount +```java +import com.azure.resourcemanager.billing.models.AutoRenew; +import com.azure.resourcemanager.billing.models.ProductPatch; +import com.azure.resourcemanager.billing.models.ProductProperties; + +/** + * Samples for Products Update. + */ +public final class ProductsUpdateSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingAccountsListWithExpandForPONumber.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/productsUpdate.json */ /** - * Sample code: BillingAccountsListWithExpandForPONumber. + * Sample code: ProductsUpdate. * * @param manager Entry point to BillingManager. */ - public static void - billingAccountsListWithExpandForPONumber(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingAccounts() - .list(null, null, null, null, null, null, null, null, "soldTo,enrollmentDetails/poNumber", null, null, null, + public static void productsUpdate(com.azure.resourcemanager.billing.BillingManager manager) { + manager.products() + .updateWithResponse("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "11111111-1111-1111-1111-111111111111", + new ProductPatch().withProperties(new ProductProperties().withAutoRenew(AutoRenew.ON)), com.azure.core.util.Context.NONE); } } ``` -### BillingAccounts_ListInvoiceSectionsByCreateSubscriptionPermission +### BillingPermissions_CheckAccessByBillingProfile ```java /** - * Samples for BillingAccounts ListInvoiceSectionsByCreateSubscriptionPermission. + * Samples for Invoices Get. */ -public final class BillingAccountsListInvoiceSectionsByCreateSubscriptionPermissionSamples { +public final class InvoicesGetSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * invoiceSectionsWithCreateSubscriptionPermissionList.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoicesGet.json */ /** - * Sample code: InvoiceSectionsWithCreateSubscriptionPermissionList. + * Sample code: InvoicesGet. * * @param manager Entry point to BillingManager. */ - public static void - invoiceSectionsWithCreateSubscriptionPermissionList(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingAccounts() - .listInvoiceSectionsByCreateSubscriptionPermission( - "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", null, - com.azure.core.util.Context.NONE); + public static void invoicesGet(com.azure.resourcemanager.billing.BillingManager manager) { + manager.invoices().getWithResponse("G123456789", com.azure.core.util.Context.NONE); } } ``` -### BillingAccounts_Update +### BillingPermissions_CheckAccessByCustomer ```java -import com.azure.resourcemanager.billing.models.BillingAccountPatch; -import com.azure.resourcemanager.billing.models.BillingAccountProperties; -import com.azure.resourcemanager.billing.models.BillingAccountPropertiesEnrollmentDetails; -import com.azure.resourcemanager.billing.models.BillingAccountPropertiesSoldTo; - /** - * Samples for BillingAccounts Update. + * Samples for SavingsPlans GetByBillingAccount. */ -public final class BillingAccountsUpdateSamples { +public final class SavingsPlansGetByBillingAccountSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsUpdate.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * savingsPlanGetByBillingAccount.json */ /** - * Sample code: BillingAccountsUpdate. + * Sample code: SavingsPlanGet. * * @param manager Entry point to BillingManager. */ - public static void billingAccountsUpdate(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingAccounts() - .update("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - new BillingAccountPatch().withProperties(new BillingAccountProperties().withDisplayName("Test Account") - .withSoldTo(new BillingAccountPropertiesSoldTo().withAddressLine1("1 Microsoft Way") - .withCity("Redmond") - .withCompanyName("Contoso") - .withCountry("US") - .withPostalCode("fakeTokenPlaceholder") - .withRegion("WA"))), + public static void savingsPlanGet(com.azure.resourcemanager.billing.BillingManager manager) { + manager.savingsPlans() + .getByBillingAccountWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", null, com.azure.core.util.Context.NONE); } /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingAccountUpdateWithPONumber.json + * savingsPlanGetExpandRenewPropertiesByBillingAccount.json */ /** - * Sample code: BillingAccountUpdateWithPONumber. + * Sample code: SavingsPlanGetExpandRenewProperties. * * @param manager Entry point to BillingManager. */ - public static void billingAccountUpdateWithPONumber(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingAccounts() - .update("6575495", - new BillingAccountPatch().withProperties(new BillingAccountProperties().withEnrollmentDetails( - new BillingAccountPropertiesEnrollmentDetails().withPoNumber("poNumber123"))), + public static void savingsPlanGetExpandRenewProperties(com.azure.resourcemanager.billing.BillingManager manager) { + manager.savingsPlans() + .getByBillingAccountWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", null, com.azure.core.util.Context.NONE); } } ``` -### BillingAccounts_ValidatePaymentTerms +### BillingPermissions_CheckAccessByDepartment ```java -import com.azure.resourcemanager.billing.models.PaymentTerm; -import java.time.OffsetDateTime; -import java.util.Arrays; +import com.azure.resourcemanager.billing.models.TransactionType; +import java.time.LocalDate; /** - * Samples for BillingAccounts ValidatePaymentTerms. + * Samples for Transactions ListByInvoiceSection. */ -public final class BillingAccountsValidatePaymentTermsSamples { - /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentTermInvalid.json - */ - /** - * Sample code: PaymentTermInvalid. - * - * @param manager Entry point to BillingManager. - */ - public static void paymentTermInvalid(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingAccounts() - .validatePaymentTermsWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - Arrays.asList(new PaymentTerm().withTerm("net10") - .withStartDate(OffsetDateTime.parse("2023-02-05T22:39:34.2606750Z")) - .withEndDate(OffsetDateTime.parse("2023-01-25T22:39:34.2606750Z"))), - com.azure.core.util.Context.NONE); - } - +public final class TransactionsListByInvoiceSectionSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentTermValid.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * transactionsListByInvoiceSection.json */ /** - * Sample code: PaymentTermValid. + * Sample code: TransactionsListByInvoiceSection. * * @param manager Entry point to BillingManager. */ - public static void paymentTermValid(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingAccounts() - .validatePaymentTermsWithResponse( + public static void transactionsListByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { + manager.transactions() + .listByInvoiceSection( "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - Arrays.asList(new PaymentTerm().withTerm("net10") - .withStartDate(OffsetDateTime.parse("2023-01-05T22:39:34.2606750Z")) - .withEndDate(OffsetDateTime.parse("2023-01-25T22:39:34.2606750Z"))), - com.azure.core.util.Context.NONE); + "xxxx-xxxx-xxx-xxx", "22000000-0000-0000-0000-000000000000", LocalDate.parse("2024-04-01"), + LocalDate.parse("2023-05-30"), TransactionType.BILLED, "properties/date gt '2020-10-01'", + "properties/date", null, null, null, "storage", com.azure.core.util.Context.NONE); } } ``` -### BillingPermissions_CheckAccessByBillingAccount +### BillingPermissions_CheckAccessByEnrollmentAccount ```java -import com.azure.resourcemanager.billing.models.CheckAccessRequest; -import java.util.Arrays; - /** - * Samples for BillingPermissions CheckAccessByBillingAccount. + * Samples for BillingAccounts ConfirmTransition. */ -public final class BillingPermissionsCheckAccessByBillingAccountSamples { +public final class BillingAccountsConfirmTransitionSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/checkAccessByBillingAccount. - * json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingAccountsConfirmTransition.json */ /** - * Sample code: CheckAccessByBillingAccount. + * Sample code: BillingAccountsConfirmTransition. * * @param manager Entry point to BillingManager. */ - public static void checkAccessByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingPermissions() - .checkAccessByBillingAccountWithResponse( + public static void billingAccountsConfirmTransition(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingAccounts() + .confirmTransitionWithResponse( "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - new CheckAccessRequest().withActions(Arrays.asList("Microsoft.Billing/billingAccounts/read", - "Microsoft.Subscription/subscriptions/write")), com.azure.core.util.Context.NONE); } } ``` -### BillingPermissions_CheckAccessByBillingProfile +### BillingPermissions_CheckAccessByInvoiceSection ```java -import com.azure.resourcemanager.billing.models.CheckAccessRequest; -import java.util.Arrays; +import com.azure.resourcemanager.billing.models.AddressDetails; /** - * Samples for BillingPermissions CheckAccessByBillingProfile. + * Samples for Address Validate. */ -public final class BillingPermissionsCheckAccessByBillingProfileSamples { +public final class AddressValidateSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/checkAccessByBillingProfile. - * json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/addressValidateInvalid.json */ /** - * Sample code: CheckAccessByBillingProfile. + * Sample code: AddressValidateInvalid. * * @param manager Entry point to BillingManager. */ - public static void checkAccessByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingPermissions() - .checkAccessByBillingProfileWithResponse( - "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", new CheckAccessRequest().withActions(Arrays - .asList("Microsoft.Billing/billingAccounts/read", "Microsoft.Subscription/subscriptions/write")), - com.azure.core.util.Context.NONE); + public static void addressValidateInvalid(com.azure.resourcemanager.billing.BillingManager manager) { + manager.address() + .validateWithResponse(new AddressDetails().withAddressLine1("1 Test") + .withCity("bellevue") + .withCountry("us") + .withPostalCode("fakeTokenPlaceholder") + .withRegion("wa"), com.azure.core.util.Context.NONE); } -} -``` - -### BillingPermissions_CheckAccessByCustomer - -```java -import com.azure.resourcemanager.billing.models.CheckAccessRequest; -import java.util.Arrays; -/** - * Samples for BillingPermissions CheckAccessByCustomer. - */ -public final class BillingPermissionsCheckAccessByCustomerSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/checkAccessByCustomer.json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/addressValidateValid.json */ /** - * Sample code: CheckAccessByCustomer. + * Sample code: AddressValidateValid. * * @param manager Entry point to BillingManager. */ - public static void checkAccessByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingPermissions() - .checkAccessByCustomerWithResponse( - "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "703ab484-dda2-4402-827b-a74513b61e2d", new CheckAccessRequest().withActions(Arrays - .asList("Microsoft.Billing/billingAccounts/read", "Microsoft.Subscription/subscriptions/write")), - com.azure.core.util.Context.NONE); + public static void addressValidateValid(com.azure.resourcemanager.billing.BillingManager manager) { + manager.address() + .validateWithResponse(new AddressDetails().withAddressLine1("1 Test") + .withCity("bellevue") + .withCountry("us") + .withPostalCode("fakeTokenPlaceholder") + .withRegion("wa"), com.azure.core.util.Context.NONE); } } ``` -### BillingPermissions_CheckAccessByDepartment +### BillingPermissions_ListByBillingAccount ```java -import com.azure.resourcemanager.billing.models.CheckAccessRequest; -import java.util.Arrays; +import com.azure.resourcemanager.billing.fluent.models.BillingPropertyInner; +import com.azure.resourcemanager.billing.models.BillingPropertyProperties; +import com.azure.resourcemanager.billing.models.BillingPropertyPropertiesSubscriptionServiceUsageAddress; /** - * Samples for BillingPermissions CheckAccessByDepartment. + * Samples for BillingProperty Update. */ -public final class BillingPermissionsCheckAccessByDepartmentSamples { +public final class BillingPropertyUpdateSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/checkAccessByDepartment.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingPropertyPatchSubscriptionServiceUsageAddress.json */ /** - * Sample code: CheckAccessByDepartment. + * Sample code: BillingPropertyPatchSubscriptionServiceUsageAddress. * * @param manager Entry point to BillingManager. */ - public static void checkAccessByDepartment(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingPermissions() - .checkAccessByDepartmentWithResponse( - "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "12345", - new CheckAccessRequest().withActions(Arrays.asList("Microsoft.Billing/billingAccounts/read", - "Microsoft.Subscription/subscriptions/write")), + public static void + billingPropertyPatchSubscriptionServiceUsageAddress(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingProperties() + .updateWithResponse(new BillingPropertyInner() + .withProperties(new BillingPropertyProperties().withSubscriptionServiceUsageAddress( + new BillingPropertyPropertiesSubscriptionServiceUsageAddress().withAddressLine1("Address line 1") + .withAddressLine2("Address line 2") + .withCity("City") + .withCountry("US") + .withFirstName("Jenny") + .withLastName("Doe") + .withMiddleName("Ann") + .withPostalCode("fakeTokenPlaceholder") + .withRegion("State"))), com.azure.core.util.Context.NONE); } -} -``` - -### BillingPermissions_CheckAccessByEnrollmentAccount - -```java -import com.azure.resourcemanager.billing.models.CheckAccessRequest; -import java.util.Arrays; -/** - * Samples for BillingPermissions CheckAccessByEnrollmentAccount. - */ -public final class BillingPermissionsCheckAccessByEnrollmentAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * checkAccessByEnrollmentAccount.json + * billingPropertyPatchCostCenter.json */ /** - * Sample code: CheckAccessByEnrollmentAccount. + * Sample code: BillingPropertyPatchCostCenter. * * @param manager Entry point to BillingManager. */ - public static void checkAccessByEnrollmentAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingPermissions() - .checkAccessByEnrollmentAccountWithResponse( - "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "123456", - new CheckAccessRequest().withActions(Arrays.asList("Microsoft.Billing/billingAccounts/read", - "Microsoft.Subscription/subscriptions/write")), + public static void billingPropertyPatchCostCenter(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingProperties() + .updateWithResponse( + new BillingPropertyInner().withProperties(new BillingPropertyProperties().withCostCenter("1010")), com.azure.core.util.Context.NONE); } } ``` -### BillingPermissions_CheckAccessByInvoiceSection +### BillingPermissions_ListByBillingProfile ```java -import com.azure.resourcemanager.billing.models.CheckAccessRequest; -import java.util.Arrays; - /** - * Samples for BillingPermissions CheckAccessByInvoiceSection. + * Samples for BillingRoleAssignments ListByBillingProfile. */ -public final class BillingPermissionsCheckAccessByInvoiceSectionSamples { +public final class BillingRoleAssignmentsListByBillingProfileSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/checkAccessByInvoiceSection. - * json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingRoleAssignmentListByBillingProfile.json */ /** - * Sample code: CheckAccessByInvoiceSection. + * Sample code: BillingRoleAssignmentListByBillingProfile. * * @param manager Entry point to BillingManager. */ - public static void checkAccessByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingPermissions() - .checkAccessByInvoiceSectionWithResponse( - "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "Q7GV-UUVA-PJA-TGB", new CheckAccessRequest().withActions(Arrays - .asList("Microsoft.Billing/billingAccounts/read", "Microsoft.Subscription/subscriptions/write")), - com.azure.core.util.Context.NONE); + public static void + billingRoleAssignmentListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .listByBillingProfile( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", + "xxxx-xxxx-xxx-xxx", null, null, null, com.azure.core.util.Context.NONE); } } ``` -### BillingPermissions_ListByBillingAccount +### BillingPermissions_ListByCustomer ```java /** - * Samples for BillingPermissions ListByBillingAccount. + * Samples for BillingRoleDefinition ListByBillingAccount. */ -public final class BillingPermissionsListByBillingAccountSamples { +public final class BillingRoleDefinitionListByBillingAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingPermissionsListByBillingAccount.json + * billingRoleDefinitionListByBillingAccount.json */ /** - * Sample code: BillingPermissionsListByBillingAccount. + * Sample code: BillingRoleDefinitionListByBillingAccount. * * @param manager Entry point to BillingManager. */ public static void - billingPermissionsListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingPermissions() + billingRoleDefinitionListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleDefinitions() .listByBillingAccount( "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", com.azure.core.util.Context.NONE); @@ -1105,149 +1129,172 @@ public final class BillingPermissionsListByBillingAccountSamples { } ``` -### BillingPermissions_ListByBillingProfile +### BillingPermissions_ListByCustomerAtBillingAccount ```java /** - * Samples for BillingPermissions ListByBillingProfile. + * Samples for BillingRoleDefinition ListByCustomer. */ -public final class BillingPermissionsListByBillingProfileSamples { +public final class BillingRoleDefinitionListByCustomerSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingPermissionsListByBillingProfile.json + * billingRoleDefinitionListByCustomer.json */ /** - * Sample code: BillingPermissionsListByBillingProfile. + * Sample code: BillingRoleDefinitionListByCustomer. * * @param manager Entry point to BillingManager. */ - public static void - billingPermissionsListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingPermissions() - .listByBillingProfile( - "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", com.azure.core.util.Context.NONE); + public static void billingRoleDefinitionListByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleDefinitions() + .listByCustomer("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", com.azure.core.util.Context.NONE); } } ``` -### BillingPermissions_ListByCustomer +### BillingPermissions_ListByDepartment ```java /** - * Samples for BillingPermissions ListByCustomer. + * Samples for RecipientTransfers Get. */ -public final class BillingPermissionsListByCustomerSamples { +public final class RecipientTransfersGetSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingPermissionsListByCustomer.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/recipientTransfersGet.json */ /** - * Sample code: BillingPermissionsListByCustomer. + * Sample code: RecipientTransferGet. * * @param manager Entry point to BillingManager. */ - public static void billingPermissionsListByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingPermissions() - .listByCustomer("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "BKM6-54VH-BG7-PGB", "11111111-1111-1111-1111-111111111111", com.azure.core.util.Context.NONE); + public static void recipientTransferGet(com.azure.resourcemanager.billing.BillingManager manager) { + manager.recipientTransfers().getWithResponse("aabb123", com.azure.core.util.Context.NONE); } } ``` -### BillingPermissions_ListByCustomerAtBillingAccount +### BillingPermissions_ListByEnrollmentAccount ```java /** - * Samples for BillingPermissions ListByCustomerAtBillingAccount. + * Samples for Reservations ListByReservationOrder. */ -public final class BillingPermissionsListByCustomerAtBillingAccountSamples { +public final class ReservationsListByReservationOrderSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingPermissionsListByCustomerAtBillingAccount.json + * reservationsGetFromOrderByBillingAccount.json */ /** - * Sample code: BillingPermissionsListByCustomerAtBillingAccount. + * Sample code: reservationsGetFromOrderByBillingAccount. * * @param manager Entry point to BillingManager. */ public static void - billingPermissionsListByCustomerAtBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingPermissions() - .listByCustomerAtBillingAccount( - "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "11111111-1111-1111-1111-111111111111", com.azure.core.util.Context.NONE); + reservationsGetFromOrderByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.reservations() + .listByReservationOrder( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "20000000-0000-0000-0000-000000000000", com.azure.core.util.Context.NONE); } } ``` -### BillingPermissions_ListByDepartment +### BillingPermissions_ListByInvoiceSection ```java /** - * Samples for BillingPermissions ListByDepartment. + * Samples for BillingAccounts Get. */ -public final class BillingPermissionsListByDepartmentSamples { +public final class BillingAccountsGetSamples { + /* + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGetWithExpand. + * json + */ + /** + * Sample code: BillingAccountsGetWithExpand. + * + * @param manager Entry point to BillingManager. + */ + public static void billingAccountsGetWithExpand(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingAccounts() + .getWithResponse("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + com.azure.core.util.Context.NONE); + } + /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingPermissionsListByDepartment.json + * billingAccountWithExpandForPONumber.json */ /** - * Sample code: BillingPermissionsListByDepartment. + * Sample code: BillingAccountWithExpandForPONumber. * * @param manager Entry point to BillingManager. */ - public static void billingPermissionsListByDepartment(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingPermissions().listByDepartment("6100092", "123456", com.azure.core.util.Context.NONE); + public static void billingAccountWithExpandForPONumber(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingAccounts().getWithResponse("8608480", com.azure.core.util.Context.NONE); } -} -``` -### BillingPermissions_ListByEnrollmentAccount + /* + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGetEA.json + */ + /** + * Sample code: BillingAccountsGetEA. + * + * @param manager Entry point to BillingManager. + */ + public static void billingAccountsGetEA(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingAccounts().getWithResponse("6575495", com.azure.core.util.Context.NONE); + } -```java -/** - * Samples for BillingPermissions ListByEnrollmentAccount. - */ -public final class BillingPermissionsListByEnrollmentAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingPermissionsListByEnrollmentAccount.json + * billingAccountWithRegistrationNumberWithType.json */ /** - * Sample code: BillingPermissionsListByEnrollmentAccount. + * Sample code: BillingAccountWithRegistrationNumberWithType. * * @param manager Entry point to BillingManager. */ public static void - billingPermissionsListByEnrollmentAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingPermissions().listByEnrollmentAccount("6100092", "123456", com.azure.core.util.Context.NONE); + billingAccountWithRegistrationNumberWithType(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingAccounts() + .getWithResponse("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsGet.json + */ + /** + * Sample code: BillingAccountsGet. + * + * @param manager Entry point to BillingManager. + */ + public static void billingAccountsGet(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingAccounts() + .getWithResponse("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + com.azure.core.util.Context.NONE); } -} -``` - -### BillingPermissions_ListByInvoiceSection -```java -/** - * Samples for BillingPermissions ListByInvoiceSection. - */ -public final class BillingPermissionsListByInvoiceSectionSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingPermissionsListByInvoiceSection.json + * billingAccountWithRegistrationNumberWithDefaultType.json */ /** - * Sample code: BillingPermissionsListByInvoiceSection. + * Sample code: BillingAccountWithRegistrationNumberWithDefaultType. * * @param manager Entry point to BillingManager. */ public static void - billingPermissionsListByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingPermissions() - .listByInvoiceSection( - "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "XXXX-XXXX-XXX-XXX", com.azure.core.util.Context.NONE); + billingAccountWithRegistrationNumberWithDefaultType(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingAccounts() + .getWithResponse("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + com.azure.core.util.Context.NONE); } } ``` @@ -1255,63 +1302,24 @@ public final class BillingPermissionsListByInvoiceSectionSamples { ### BillingProfiles_CreateOrUpdate ```java -import com.azure.resourcemanager.billing.fluent.models.BillingProfileInner; -import com.azure.resourcemanager.billing.models.AzurePlan; -import com.azure.resourcemanager.billing.models.BillingProfileProperties; -import com.azure.resourcemanager.billing.models.BillingProfilePropertiesBillTo; -import com.azure.resourcemanager.billing.models.BillingProfilePropertiesShipTo; -import java.util.Arrays; - /** - * Samples for BillingProfiles CreateOrUpdate. + * Samples for BillingRequests ListByCustomer. */ -public final class BillingProfilesCreateOrUpdateSamples { +public final class BillingRequestsListByCustomerSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingProfilesCreateOrUpdate + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRequestsListByCustomer * .json */ /** - * Sample code: BillingProfilesCreateOrUpdate. + * Sample code: BillingRequestsListByCustomer. * * @param manager Entry point to BillingManager. */ - public static void billingProfilesCreateOrUpdate(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingProfiles() - .createOrUpdate("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", - new BillingProfileInner().withProperties(new BillingProfileProperties() - .withBillTo(new BillingProfilePropertiesBillTo().withAddressLine1("Test Address1") - .withAddressLine2("Test Address2") - .withAddressLine3("Test Address3") - .withCity("City") - .withCompanyName("Contoso") - .withCountry("US") - .withEmail("abc@contoso.com") - .withFirstName("Test") - .withLastName("User") - .withPhoneNumber("000-000-0000") - .withPostalCode("fakeTokenPlaceholder") - .withRegion("WA") - .withIsValidAddress(true)) - .withDisplayName("Billing Profile 1") - .withEnabledAzurePlans( - Arrays.asList(new AzurePlan().withSkuId("0001"), new AzurePlan().withSkuId("0002"))) - .withInvoiceEmailOptIn(true) - .withPoNumber("ABC12345") - .withShipTo(new BillingProfilePropertiesShipTo().withAddressLine1("Test Address1") - .withAddressLine2("Test Address2") - .withAddressLine3("Test Address3") - .withCity("City") - .withCompanyName("Contoso") - .withCountry("US") - .withEmail("abc@contoso.com") - .withFirstName("Test") - .withLastName("User") - .withPhoneNumber("000-000-0000") - .withPostalCode("fakeTokenPlaceholder") - .withRegion("WA") - .withIsValidAddress(true))), + public static void billingRequestsListByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRequests() + .listByCustomer("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", null, null, null, null, null, null, com.azure.core.util.Context.NONE); } } @@ -1321,22 +1329,23 @@ public final class BillingProfilesCreateOrUpdateSamples { ```java /** - * Samples for BillingProfiles Delete. + * Samples for PartnerTransfers Cancel. */ -public final class BillingProfilesDeleteSamples { +public final class PartnerTransfersCancelSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingProfilesDelete.json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/partnerTransfersCancel.json */ /** - * Sample code: BillingProfilesDelete. + * Sample code: PartnerTransferCancel. * * @param manager Entry point to BillingManager. */ - public static void billingProfilesDelete(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingProfiles() - .delete("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", com.azure.core.util.Context.NONE); + public static void partnerTransferCancel(com.azure.resourcemanager.billing.BillingManager manager) { + manager.partnerTransfers() + .cancelWithResponse("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", "aabb123", + com.azure.core.util.Context.NONE); } } ``` @@ -1345,22 +1354,24 @@ public final class BillingProfilesDeleteSamples { ```java /** - * Samples for BillingProfiles Get. + * Samples for BillingSubscriptions ListByCustomerAtBillingAccount. */ -public final class BillingProfilesGetSamples { +public final class BillingSubscriptionsListByCustomerAtBillingAccountSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingProfilesGet.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingSubscriptionsListByCustomerAtBillingAccount.json */ /** - * Sample code: BillingProfilesGet. + * Sample code: BillingSubscriptionsListByCustomerAtBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void billingProfilesGet(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingProfiles() - .getWithResponse("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", com.azure.core.util.Context.NONE); + public static void + billingSubscriptionsListByCustomerAtBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingSubscriptions() + .listByCustomerAtBillingAccount( + "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", + "Q7GV-UUVA-PJA-TGB", null, null, null, null, null, null, null, null, com.azure.core.util.Context.NONE); } } ``` @@ -1368,24 +1379,27 @@ public final class BillingProfilesGetSamples { ### BillingProfiles_ListByBillingAccount ```java +import com.azure.resourcemanager.billing.models.PatchModel; + /** - * Samples for BillingProfiles ListByBillingAccount. + * Samples for Reservations UpdateByBillingAccount. */ -public final class BillingProfilesListByBillingAccountSamples { +public final class ReservationsUpdateByBillingAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingProfilesListByBillingAccount.json + * reservationUpdateByBillingAccount.json */ /** - * Sample code: BillingProfilesListByBillingAccount. + * Sample code: ReservationUpdate. * * @param manager Entry point to BillingManager. */ - public static void billingProfilesListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingProfiles() - .listByBillingAccount( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", null, null, - null, null, null, null, null, com.azure.core.util.Context.NONE); + public static void reservationUpdate(com.azure.resourcemanager.billing.BillingManager manager) { + manager.reservations() + .updateByBillingAccount( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", + new PatchModel().withDisplayName("NewName"), com.azure.core.util.Context.NONE); } } ``` @@ -1394,41 +1408,25 @@ public final class BillingProfilesListByBillingAccountSamples { ```java /** - * Samples for BillingProfiles ValidateDeleteEligibility. + * Samples for BillingRoleAssignments GetByBillingAccount. */ -public final class BillingProfilesValidateDeleteEligibilitySamples { - /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingProfilesValidateDeleteEligibilityFailure.json - */ - /** - * Sample code: BillingProfilesValidateDeleteEligibilityFailure. - * - * @param manager Entry point to BillingManager. - */ - public static void - billingProfilesValidateDeleteEligibilityFailure(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingProfiles() - .validateDeleteEligibilityWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", com.azure.core.util.Context.NONE); - } - +public final class BillingRoleAssignmentsGetByBillingAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingProfilesValidateDeleteEligibilitySuccess.json + * billingRoleAssignmentGetByBillingAccount.json */ /** - * Sample code: BillingProfilesValidateDeleteEligibilitySuccess. + * Sample code: BillingRoleAssignmentGetByBillingAccount. * * @param manager Entry point to BillingManager. */ public static void - billingProfilesValidateDeleteEligibilitySuccess(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingProfiles() - .validateDeleteEligibilityWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", com.azure.core.util.Context.NONE); + billingRoleAssignmentGetByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .getByBillingAccountWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", + "10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9", + com.azure.core.util.Context.NONE); } } ``` @@ -1436,154 +1434,109 @@ public final class BillingProfilesValidateDeleteEligibilitySamples { ### BillingProperty_Get ```java +import com.azure.resourcemanager.billing.models.PaymentTerm; +import java.time.OffsetDateTime; +import java.util.Arrays; + /** - * Samples for BillingProperty Get. + * Samples for BillingAccounts AddPaymentTerms. */ -public final class BillingPropertyGetSamples { +public final class BillingAccountsAddPaymentTermsSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingPropertyGetMCA.json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentTermsAdd.json */ /** - * Sample code: BillingPropertyGetMCA. + * Sample code: PaymentTermsAdd. * * @param manager Entry point to BillingManager. */ - public static void billingPropertyGetMCA(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingProperties().getWithResponse(null, null, com.azure.core.util.Context.NONE); + public static void paymentTermsAdd(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingAccounts() + .addPaymentTerms("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + Arrays.asList(new PaymentTerm().withTerm("net10") + .withStartDate(OffsetDateTime.parse("2023-01-05T22:39:34.2606750Z")) + .withEndDate(OffsetDateTime.parse("2023-01-25T22:39:34.2606750Z"))), + com.azure.core.util.Context.NONE); } +} +``` - /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingPropertyGetMOSP.json - */ - /** - * Sample code: BillingPropertyGetMOSP. - * - * @param manager Entry point to BillingManager. - */ - public static void billingPropertyGetMOSP(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingProperties().getWithResponse(null, null, com.azure.core.util.Context.NONE); - } +### BillingProperty_Update +```java +/** + * Samples for Policies GetBySubscription. + */ +public final class PoliciesGetBySubscriptionSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingPropertyGetMPA.json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/policiesGetBySubscription. + * json */ /** - * Sample code: BillingPropertyGetMPA. + * Sample code: PoliciesGetBySubscription. * * @param manager Entry point to BillingManager. */ - public static void billingPropertyGetMPA(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingProperties().getWithResponse(null, null, com.azure.core.util.Context.NONE); + public static void policiesGetBySubscription(com.azure.resourcemanager.billing.BillingManager manager) { + manager.policies().getBySubscriptionWithResponse(com.azure.core.util.Context.NONE); } } ``` -### BillingProperty_Update +### BillingRequests_CreateOrUpdate ```java -import com.azure.resourcemanager.billing.fluent.models.BillingPropertyInner; -import com.azure.resourcemanager.billing.models.BillingPropertyProperties; -import com.azure.resourcemanager.billing.models.BillingPropertyPropertiesSubscriptionServiceUsageAddress; - /** - * Samples for BillingProperty Update. + * Samples for BillingAccounts List. */ -public final class BillingPropertyUpdateSamples { +public final class BillingAccountsListSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingPropertyPatchSubscriptionServiceUsageAddress.json + * billingAccountForLegacyAccountDetails.json */ /** - * Sample code: BillingPropertyPatchSubscriptionServiceUsageAddress. + * Sample code: BillingAccountForLegacyAccountDetails. * * @param manager Entry point to BillingManager. */ - public static void - billingPropertyPatchSubscriptionServiceUsageAddress(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingProperties() - .updateWithResponse(new BillingPropertyInner() - .withProperties(new BillingPropertyProperties().withSubscriptionServiceUsageAddress( - new BillingPropertyPropertiesSubscriptionServiceUsageAddress().withAddressLine1("Address line 1") - .withAddressLine2("Address line 2") - .withCity("City") - .withCountry("US") - .withFirstName("Jenny") - .withLastName("Doe") - .withMiddleName("Ann") - .withPostalCode("fakeTokenPlaceholder") - .withRegion("State"))), + public static void billingAccountForLegacyAccountDetails(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingAccounts() + .list(null, null, null, null, null, null, null, null, null, null, null, null, com.azure.core.util.Context.NONE); } - /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingPropertyPatchCostCenter.json + /* + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsList.json */ /** - * Sample code: BillingPropertyPatchCostCenter. + * Sample code: BillingAccountsList. * * @param manager Entry point to BillingManager. */ - public static void billingPropertyPatchCostCenter(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingProperties() - .updateWithResponse( - new BillingPropertyInner().withProperties(new BillingPropertyProperties().withCostCenter("1010")), + public static void billingAccountsList(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingAccounts() + .list(null, null, null, null, null, null, null, null, null, null, null, null, com.azure.core.util.Context.NONE); } -} -``` - -### BillingRequests_CreateOrUpdate -```java -import com.azure.resourcemanager.billing.fluent.models.BillingRequestInner; -import com.azure.resourcemanager.billing.models.BillingRequestProperties; -import com.azure.resourcemanager.billing.models.BillingRequestStatus; -import com.azure.resourcemanager.billing.models.BillingRequestType; -import java.util.HashMap; -import java.util.Map; - -/** - * Samples for BillingRequests CreateOrUpdate. - */ -public final class BillingRequestsCreateOrUpdateSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRequestsCreateOrUpdate - * .json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingAccountsListWithExpandForPONumber.json */ /** - * Sample code: BillingRequestsCreateOrUpdate. + * Sample code: BillingAccountsListWithExpandForPONumber. * * @param manager Entry point to BillingManager. */ - public static void billingRequestsCreateOrUpdate(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRequests() - .createOrUpdate("00000000-0000-0000-0000-000000000000", - new BillingRequestInner().withProperties(new BillingRequestProperties() - .withAdditionalInformation(mapOf("RoleId", "40000000-aaaa-bbbb-cccc-200000000006")) - .withDecisionReason("New team member") - .withRequestScope( - "/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx") - .withStatus(BillingRequestStatus.PENDING) - .withType(BillingRequestType.ROLE_ASSIGNMENT)), + public static void + billingAccountsListWithExpandForPONumber(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingAccounts() + .list(null, null, null, null, null, null, null, null, "soldTo,enrollmentDetails/poNumber", null, null, null, com.azure.core.util.Context.NONE); } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } } ``` @@ -1591,21 +1544,20 @@ public final class BillingRequestsCreateOrUpdateSamples { ```java /** - * Samples for BillingRequests Get. + * Samples for Operations List. */ -public final class BillingRequestsGetSamples { +public final class OperationsListSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRequestsGet.json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/operationsList.json */ /** - * Sample code: BillingRequestsGet. + * Sample code: OperationsList. * * @param manager Entry point to BillingManager. */ - public static void billingRequestsGet(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRequests() - .getWithResponse("00000000-0000-0000-0000-000000000000", com.azure.core.util.Context.NONE); + public static void operationsList(com.azure.resourcemanager.billing.BillingManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); } } ``` @@ -1614,23 +1566,22 @@ public final class BillingRequestsGetSamples { ```java /** - * Samples for BillingRequests ListByBillingAccount. + * Samples for Agreements Get. */ -public final class BillingRequestsListByBillingAccountSamples { +public final class AgreementsGetSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRequestsListByBillingAccount.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/agreementByName.json */ /** - * Sample code: BillingRequestsListByBillingAccount. + * Sample code: AgreementByName. * * @param manager Entry point to BillingManager. */ - public static void billingRequestsListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRequests() - .listByBillingAccount( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", null, null, - null, null, null, null, com.azure.core.util.Context.NONE); + public static void agreementByName(com.azure.resourcemanager.billing.BillingManager manager) { + manager.agreements() + .getWithResponse("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "ABC123", com.azure.core.util.Context.NONE); } } ``` @@ -1639,23 +1590,24 @@ public final class BillingRequestsListByBillingAccountSamples { ```java /** - * Samples for BillingRequests ListByBillingProfile. + * Samples for Products ListByBillingAccount. */ -public final class BillingRequestsListByBillingProfileSamples { +public final class ProductsListByBillingAccountSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRequestsListByBillingProfile.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/productsListByBillingAccount. + * json */ /** - * Sample code: BillingRequestsListByBillingProfile. + * Sample code: ProductsListByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void billingRequestsListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRequests() - .listByBillingProfile( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", null, null, null, null, null, null, com.azure.core.util.Context.NONE); + public static void productsListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.products() + .listByBillingAccount( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", null, null, + null, null, null, null, com.azure.core.util.Context.NONE); } } ``` @@ -1664,23 +1616,22 @@ public final class BillingRequestsListByBillingProfileSamples { ```java /** - * Samples for BillingRequests ListByCustomer. + * Samples for Agreements ListByBillingAccount. */ -public final class BillingRequestsListByCustomerSamples { +public final class AgreementsListByBillingAccountSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRequestsListByCustomer - * .json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * agreementsListByBillingAccount.json */ /** - * Sample code: BillingRequestsListByCustomer. + * Sample code: AgreementsListByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void billingRequestsListByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRequests() - .listByCustomer("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", null, null, null, null, null, null, + public static void agreementsListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.agreements() + .listByBillingAccount( + "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "Participants", com.azure.core.util.Context.NONE); } } @@ -1690,24 +1641,21 @@ public final class BillingRequestsListByCustomerSamples { ```java /** - * Samples for BillingRequests ListByInvoiceSection. + * Samples for BillingRequests Get. */ -public final class BillingRequestsListByInvoiceSectionSamples { +public final class BillingRequestsGetSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRequestsListByInvoiceSection.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRequestsGet.json */ /** - * Sample code: BillingRequestsListByInvoiceSection. + * Sample code: BillingRequestsGet. * * @param manager Entry point to BillingManager. */ - public static void billingRequestsListByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { + public static void billingRequestsGet(com.azure.resourcemanager.billing.BillingManager manager) { manager.billingRequests() - .listByInvoiceSection( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", null, null, null, null, null, null, - com.azure.core.util.Context.NONE); + .getWithResponse("00000000-0000-0000-0000-000000000000", com.azure.core.util.Context.NONE); } } ``` @@ -1716,36 +1664,23 @@ public final class BillingRequestsListByInvoiceSectionSamples { ```java /** - * Samples for BillingRequests ListByUser. + * Samples for PaymentMethods GetByBillingAccount. */ -public final class BillingRequestsListByUserSamples { - /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRequestsListByUser. - * json - */ - /** - * Sample code: BillingRequestsListByUser. - * - * @param manager Entry point to BillingManager. - */ - public static void billingRequestsListByUser(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRequests().listByUser(null, null, null, null, null, null, com.azure.core.util.Context.NONE); - } - +public final class PaymentMethodsGetByBillingAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRequestsListByUserWithFilter.json + * paymentMethodsGetByBillingAccount.json */ /** - * Sample code: BillingRequestsListByUserWithFilter. + * Sample code: PaymentMethodGetAtBillingProfile. * * @param manager Entry point to BillingManager. */ - public static void billingRequestsListByUserWithFilter(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRequests() - .listByUser("properties/status eq 'Approved'", null, null, null, null, null, - com.azure.core.util.Context.NONE); + public static void paymentMethodGetAtBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { + manager.paymentMethods() + .getByBillingAccountWithResponse( + "00000000-0000-0000-0000-000000000032:00000000-0000-0000-0000-000000000099_2019-05-31", + "21dd9edc-af71-4d62-80ce-37151d475326", com.azure.core.util.Context.NONE); } } ``` @@ -1753,32 +1688,21 @@ public final class BillingRequestsListByUserSamples { ### BillingRoleAssignments_CreateByBillingAccount ```java -import com.azure.resourcemanager.billing.models.BillingRoleAssignmentProperties; - /** - * Samples for BillingRoleAssignments CreateByBillingAccount. + * Samples for EnrollmentAccounts Get. */ -public final class BillingRoleAssignmentsCreateByBillingAccountSamples { +public final class EnrollmentAccountsGetSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentCreateByBillingAccount.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/enrollmentAccountGet.json */ /** - * Sample code: BillingRoleAssignmentCreateByBillingAccount. + * Sample code: EnrollmentAccountGet. * * @param manager Entry point to BillingManager. */ - public static void - billingRoleAssignmentCreateByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .createByBillingAccount( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", - new BillingRoleAssignmentProperties().withPrincipalId("00000000-0000-0000-0000-000000000000") - .withPrincipalTenantId("076915e7-de10-4323-bb34-a58c904068bb") - .withRoleDefinitionId( - "/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingRoleDefinitions/10000000-aaaa-bbbb-cccc-100000000000") - .withUserEmailAddress("john@contoso.com"), - com.azure.core.util.Context.NONE); + public static void enrollmentAccountGet(com.azure.resourcemanager.billing.BillingManager manager) { + manager.enrollmentAccounts().getWithResponse("6564892", "257698", com.azure.core.util.Context.NONE); } } ``` @@ -1786,33 +1710,25 @@ public final class BillingRoleAssignmentsCreateByBillingAccountSamples { ### BillingRoleAssignments_CreateByBillingProfile ```java -import com.azure.resourcemanager.billing.models.BillingRoleAssignmentProperties; - /** - * Samples for BillingRoleAssignments CreateByBillingProfile. + * Samples for BillingPermissions ListByBillingProfile. */ -public final class BillingRoleAssignmentsCreateByBillingProfileSamples { +public final class BillingPermissionsListByBillingProfileSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentCreateByBillingProfile.json + * billingPermissionsListByBillingProfile.json */ /** - * Sample code: BillingRoleAssignmentCreateByBillingProfile. + * Sample code: BillingPermissionsListByBillingProfile. * * @param manager Entry point to BillingManager. */ public static void - billingRoleAssignmentCreateByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .createByBillingProfile( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", - "BKM6-54VH-BG7-PGB", - new BillingRoleAssignmentProperties().withPrincipalId("00000000-0000-0000-0000-000000000000") - .withPrincipalTenantId("076915e7-de10-4323-bb34-a58c904068bb") - .withRoleDefinitionId( - "/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/billingRoleDefinitions/10000000-aaaa-bbbb-cccc-100000000000") - .withUserEmailAddress("john@contoso.com"), - com.azure.core.util.Context.NONE); + billingPermissionsListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingPermissions() + .listByBillingProfile( + "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", com.azure.core.util.Context.NONE); } } ``` @@ -1820,31 +1736,23 @@ public final class BillingRoleAssignmentsCreateByBillingProfileSamples { ### BillingRoleAssignments_CreateByCustomer ```java -import com.azure.resourcemanager.billing.models.BillingRoleAssignmentProperties; - /** - * Samples for BillingRoleAssignments CreateByCustomer. + * Samples for InvoiceSections Get. */ -public final class BillingRoleAssignmentsCreateByCustomerSamples { +public final class InvoiceSectionsGetSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentCreateByCustomer.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoiceSectionsGet.json */ /** - * Sample code: BillingRoleAssignmentCreateByCustomer. + * Sample code: InvoiceSectionsGet. * * @param manager Entry point to BillingManager. */ - public static void billingRoleAssignmentCreateByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .createByCustomer("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", - "BKM6-54VH-BG7-PGB", "703ab484-dda2-4402-827b-a74513b61e2d", - new BillingRoleAssignmentProperties().withPrincipalId("00000000-0000-0000-0000-000000000000") - .withPrincipalTenantId("076915e7-de10-4323-bb34-a58c904068bb") - .withRoleDefinitionId( - "/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfileName/BKM6-54VH-BG7-PGB/customers/703ab484-dda2-4402-827b-a74513b61e2d/billingRoleDefinitions/30000000-aaaa-bbbb-cccc-100000000000") - .withUserEmailAddress("john@contoso.com"), - com.azure.core.util.Context.NONE); + public static void invoiceSectionsGet(com.azure.resourcemanager.billing.BillingManager manager) { + manager.invoiceSections() + .getWithResponse("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", com.azure.core.util.Context.NONE); } } ``` @@ -1852,33 +1760,24 @@ public final class BillingRoleAssignmentsCreateByCustomerSamples { ### BillingRoleAssignments_CreateByInvoiceSection ```java -import com.azure.resourcemanager.billing.models.BillingRoleAssignmentProperties; - /** - * Samples for BillingRoleAssignments CreateByInvoiceSection. + * Samples for Reservations ListByBillingAccount. */ -public final class BillingRoleAssignmentsCreateByInvoiceSectionSamples { +public final class ReservationsListByBillingAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentCreateByInvoiceSection.json + * reservationsListByBillingAccount.json */ /** - * Sample code: BillingRoleAssignmentCreateByInvoiceSection. + * Sample code: reservationsListByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void - billingRoleAssignmentCreateByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .createByInvoiceSection( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", - "BKM6-54VH-BG7-PGB", "xxxx-xxxx-xxx-xxx", - new BillingRoleAssignmentProperties().withPrincipalId("00000000-0000-0000-0000-000000000000") - .withPrincipalTenantId("076915e7-de10-4323-bb34-a58c904068bb") - .withRoleDefinitionId( - "/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/invoiceSections/xxxx-xxxx-xxx-xxx/billingRoleDefinitions/10000000-aaaa-bbbb-cccc-100000000000") - .withUserEmailAddress("john@contoso.com"), - com.azure.core.util.Context.NONE); + public static void reservationsListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.reservations() + .listByBillingAccount( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", null, null, + null, "true", "Succeeded", null, com.azure.core.util.Context.NONE); } } ``` @@ -1886,33 +1785,25 @@ public final class BillingRoleAssignmentsCreateByInvoiceSectionSamples { ### BillingRoleAssignments_CreateOrUpdateByBillingAccount ```java -import com.azure.resourcemanager.billing.fluent.models.BillingRoleAssignmentInner; -import com.azure.resourcemanager.billing.models.BillingRoleAssignmentProperties; - /** - * Samples for BillingRoleAssignments CreateOrUpdateByBillingAccount. + * Samples for BillingRoleAssignments ResolveByBillingProfile. */ -public final class BillingRoleAssignmentsCreateOrUpdateByBillingAccountSamples { +public final class BillingRoleAssignmentsResolveByBillingProfileSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentCreateOrUpdateByBillingAccount.json + * resolveBillingRoleAssignmentByBillingProfile.json */ /** - * Sample code: BillingRoleAssignmentCreateOrUpdateByBillingAccount. + * Sample code: ResolveBillingRoleAssignmentByBillingProfile. * * @param manager Entry point to BillingManager. */ public static void - billingRoleAssignmentCreateOrUpdateByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + resolveBillingRoleAssignmentByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { manager.billingRoleAssignments() - .createOrUpdateByBillingAccount("7898901", "9dfd08c2-62a3-4d47-85bd-1cdba1408402", - new BillingRoleAssignmentInner().withProperties(new BillingRoleAssignmentProperties() - .withPrincipalId("00000000-0000-0000-0000-000000000000") - .withPrincipalTenantId("076915e7-de10-4323-bb34-a58c904068bb") - .withRoleDefinitionId( - "/providers/Microsoft.Billing/billingAccounts/7898901/billingRoleDefinitions/9f1983cb-2574-400c-87e9-34cf8e2280db") - .withUserEmailAddress("john@contoso.com")), - com.azure.core.util.Context.NONE); + .resolveByBillingProfile( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", + "xxxx-xxxx-xxx-xxx", null, null, com.azure.core.util.Context.NONE); } } ``` @@ -1920,32 +1811,25 @@ public final class BillingRoleAssignmentsCreateOrUpdateByBillingAccountSamples { ### BillingRoleAssignments_CreateOrUpdateByDepartment ```java -import com.azure.resourcemanager.billing.fluent.models.BillingRoleAssignmentInner; -import com.azure.resourcemanager.billing.models.BillingRoleAssignmentProperties; - /** - * Samples for BillingRoleAssignments CreateOrUpdateByDepartment. + * Samples for BillingRoleAssignments GetByCustomer. */ -public final class BillingRoleAssignmentsCreateOrUpdateByDepartmentSamples { +public final class BillingRoleAssignmentsGetByCustomerSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentCreateOrUpdateByDepartment.json + * billingRoleAssignmentGetByCustomer.json */ /** - * Sample code: BillingRoleAssignmentCreateOrUpdateByDepartment. + * Sample code: BillingRoleAssignmentGetByCustomer. * * @param manager Entry point to BillingManager. */ - public static void - billingRoleAssignmentCreateOrUpdateByDepartment(com.azure.resourcemanager.billing.BillingManager manager) { + public static void billingRoleAssignmentGetByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { manager.billingRoleAssignments() - .createOrUpdateByDepartment("7898901", "12345", "9dfd08c2-62a3-4d47-85bd-1cdba1408402", - new BillingRoleAssignmentInner().withProperties(new BillingRoleAssignmentProperties() - .withPrincipalId("00000000-0000-0000-0000-000000000000") - .withPrincipalTenantId("076915e7-de10-4323-bb34-a58c904068bb") - .withRoleDefinitionId( - "/providers/Microsoft.Billing/billingAccounts/7898901/departments/12345/billingRoleDefinitions/9f1983cb-2574-400c-87e9-34cf8e2280db") - .withUserEmailAddress("john@contoso.com")), + .getByCustomerWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", + "xxxx-xxxx-xxx-xxx", "703ab484-dda2-4402-827b-a74513b61e2d", + "30000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9", com.azure.core.util.Context.NONE); } } @@ -1954,33 +1838,24 @@ public final class BillingRoleAssignmentsCreateOrUpdateByDepartmentSamples { ### BillingRoleAssignments_CreateOrUpdateByEnrollmentAccount ```java -import com.azure.resourcemanager.billing.fluent.models.BillingRoleAssignmentInner; -import com.azure.resourcemanager.billing.models.BillingRoleAssignmentProperties; - /** - * Samples for BillingRoleAssignments CreateOrUpdateByEnrollmentAccount. + * Samples for AssociatedTenants ListByBillingAccount. */ -public final class BillingRoleAssignmentsCreateOrUpdateByEnrollmentAccountSamples { +public final class AssociatedTenantsListByBillingAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentCreateOrUpdateByEnrollmentAccount.json + * associatedTenantsListByBillingAccount.json */ /** - * Sample code: BillingRoleAssignmentCreateOrUpdateByEnrollmentAccount. + * Sample code: AssociatedTenantsListByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void billingRoleAssignmentCreateOrUpdateByEnrollmentAccount( - com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .createOrUpdateByEnrollmentAccount("7898901", "123456", "9dfd08c2-62a3-4d47-85bd-1cdba1408402", - new BillingRoleAssignmentInner().withProperties(new BillingRoleAssignmentProperties() - .withPrincipalId("00000000-0000-0000-0000-000000000000") - .withPrincipalTenantId("076915e7-de10-4323-bb34-a58c904068bb") - .withRoleDefinitionId( - "/providers/Microsoft.Billing/billingAccounts/7898901/enrollmentAccounts/123456/billingRoleDefinitions/9f1983cb-2574-400c-87e9-34cf8e2280db") - .withUserEmailAddress("john@contoso.com")), - com.azure.core.util.Context.NONE); + public static void associatedTenantsListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.associatedTenants() + .listByBillingAccount( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", null, null, + null, null, null, null, null, com.azure.core.util.Context.NONE); } } ``` @@ -1988,25 +1863,27 @@ public final class BillingRoleAssignmentsCreateOrUpdateByEnrollmentAccountSample ### BillingRoleAssignments_DeleteByBillingAccount ```java +import com.azure.resourcemanager.billing.models.InitiateTransferRequest; + /** - * Samples for BillingRoleAssignments DeleteByBillingAccount. + * Samples for Transfers Initiate. */ -public final class BillingRoleAssignmentsDeleteByBillingAccountSamples { +public final class TransfersInitiateSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentDeleteByBillingAccount.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/transfersInitiate.json */ /** - * Sample code: BillingRoleAssignmentDeleteByBillingAccount. + * Sample code: InitiateTransfer. * * @param manager Entry point to BillingManager. */ - public static void - billingRoleAssignmentDeleteByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .deleteByBillingAccountWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", - "10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9", + public static void initiateTransfer(com.azure.resourcemanager.billing.BillingManager manager) { + manager.transfers() + .initiateWithResponse( + "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", "aabb123", + new InitiateTransferRequest().withRecipientEmailId("user@contoso.com"), com.azure.core.util.Context.NONE); } } @@ -2015,25 +1892,27 @@ public final class BillingRoleAssignmentsDeleteByBillingAccountSamples { ### BillingRoleAssignments_DeleteByBillingProfile ```java +import com.azure.resourcemanager.billing.models.MoveBillingSubscriptionRequest; + /** - * Samples for BillingRoleAssignments DeleteByBillingProfile. + * Samples for BillingSubscriptions Move. */ -public final class BillingRoleAssignmentsDeleteByBillingProfileSamples { +public final class BillingSubscriptionsMoveSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentDeleteByBillingProfile.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionMove.json */ /** - * Sample code: BillingRoleAssignmentDeleteByBillingProfile. + * Sample code: BillingSubscriptionMove. * * @param manager Entry point to BillingManager. */ - public static void - billingRoleAssignmentDeleteByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .deleteByBillingProfileWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", - "BKM6-54VH-BG7-PGB", "10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9", + public static void billingSubscriptionMove(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingSubscriptions() + .move("a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", + "6b96d3f2-9008-4a9d-912f-f87744185aa3", + new MoveBillingSubscriptionRequest().withDestinationInvoiceSectionId( + "/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), com.azure.core.util.Context.NONE); } } @@ -2043,25 +1922,22 @@ public final class BillingRoleAssignmentsDeleteByBillingProfileSamples { ```java /** - * Samples for BillingRoleAssignments DeleteByCustomer. + * Samples for PartnerTransfers List. */ -public final class BillingRoleAssignmentsDeleteByCustomerSamples { +public final class PartnerTransfersListSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentDeleteByCustomer.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/partnerTransfersList.json */ /** - * Sample code: BillingRoleAssignmentDeleteByCustomer. + * Sample code: PartnerTransfersList. * * @param manager Entry point to BillingManager. */ - public static void billingRoleAssignmentDeleteByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .deleteByCustomerWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", - "BKM6-54VH-BG7-PGB", "703ab484-dda2-4402-827b-a74513b61e2d", - "30000000-aaaa-bbbb-cccc-100000000000_00000000-0000-0000-0000-000000000000", - com.azure.core.util.Context.NONE); + public static void partnerTransfersList(com.azure.resourcemanager.billing.BillingManager manager) { + manager.partnerTransfers() + .list("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", com.azure.core.util.Context.NONE); } } ``` @@ -2070,23 +1946,23 @@ public final class BillingRoleAssignmentsDeleteByCustomerSamples { ```java /** - * Samples for BillingRoleAssignments DeleteByDepartment. + * Samples for Policies GetByCustomerAtBillingAccount. */ -public final class BillingRoleAssignmentsDeleteByDepartmentSamples { +public final class PoliciesGetByCustomerAtBillingAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentDeleteByDepartment.json + * policiesGetByCustomerAtBillingAccount.json */ /** - * Sample code: BillingRoleAssignmentDeleteByDepartment. + * Sample code: PoliciesGetByCustomerAtBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void - billingRoleAssignmentDeleteByDepartment(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .deleteByDepartmentWithResponse("8608480", "123456", "9dfd08c2-62a3-4d47-85bd-1cdba1408402", - com.azure.core.util.Context.NONE); + public static void policiesGetByCustomerAtBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.policies() + .getByCustomerAtBillingAccountWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "11111111-1111-1111-1111-111111111111", com.azure.core.util.Context.NONE); } } ``` @@ -2095,23 +1971,21 @@ public final class BillingRoleAssignmentsDeleteByDepartmentSamples { ```java /** - * Samples for BillingRoleAssignments DeleteByEnrollmentAccount. + * Samples for BillingPermissions ListByEnrollmentAccount. */ -public final class BillingRoleAssignmentsDeleteByEnrollmentAccountSamples { +public final class BillingPermissionsListByEnrollmentAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentDeleteByEnrollmentAccount.json + * billingPermissionsListByEnrollmentAccount.json */ /** - * Sample code: BillingRoleAssignmentDeleteByEnrollmentAccount. + * Sample code: BillingPermissionsListByEnrollmentAccount. * * @param manager Entry point to BillingManager. */ public static void - billingRoleAssignmentDeleteByEnrollmentAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .deleteByEnrollmentAccountWithResponse("8608480", "123456", "9dfd08c2-62a3-4d47-85bd-1cdba1408402", - com.azure.core.util.Context.NONE); + billingPermissionsListByEnrollmentAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingPermissions().listByEnrollmentAccount("6100092", "123456", com.azure.core.util.Context.NONE); } } ``` @@ -2119,26 +1993,32 @@ public final class BillingRoleAssignmentsDeleteByEnrollmentAccountSamples { ### BillingRoleAssignments_DeleteByInvoiceSection ```java +import com.azure.resourcemanager.billing.models.AcceptTransferRequest; +import com.azure.resourcemanager.billing.models.ProductDetails; +import com.azure.resourcemanager.billing.models.ProductType; +import java.util.Arrays; + /** - * Samples for BillingRoleAssignments DeleteByInvoiceSection. + * Samples for RecipientTransfers Accept. */ -public final class BillingRoleAssignmentsDeleteByInvoiceSectionSamples { +public final class RecipientTransfersAcceptSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentDeleteByInvoiceSection.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/recipientTransfersAccept.json */ /** - * Sample code: BillingRoleAssignmentDeleteByInvoiceSection. + * Sample code: AcceptTransfer. * * @param manager Entry point to BillingManager. */ - public static void - billingRoleAssignmentDeleteByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .deleteByInvoiceSectionWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", - "BKM6-54VH-BG7-PGB", "xxxx-xxxx-xxx-xxx", - "10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9", + public static void acceptTransfer(com.azure.resourcemanager.billing.BillingManager manager) { + manager.recipientTransfers() + .acceptWithResponse("aabb123", + new AcceptTransferRequest().withProductDetails(Arrays.asList( + new ProductDetails().withProductType(ProductType.AZURE_SUBSCRIPTION) + .withProductId("subscriptionId"), + new ProductDetails().withProductType(ProductType.AZURE_RESERVATION) + .withProductId("reservedInstanceId"))), com.azure.core.util.Context.NONE); } } @@ -2148,25 +2028,40 @@ public final class BillingRoleAssignmentsDeleteByInvoiceSectionSamples { ```java /** - * Samples for BillingRoleAssignments GetByBillingAccount. + * Samples for SavingsPlanOrders GetByBillingAccount. */ -public final class BillingRoleAssignmentsGetByBillingAccountSamples { +public final class SavingsPlanOrdersGetByBillingAccountSamples { + /* + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * savingsPlanOrderGetByBillingAccount.json + */ + /** + * Sample code: SavingsPlanOrderGet. + * + * @param manager Entry point to BillingManager. + */ + public static void savingsPlanOrderGet(com.azure.resourcemanager.billing.BillingManager manager) { + manager.savingsPlanOrders() + .getByBillingAccountWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "20000000-0000-0000-0000-000000000000", null, com.azure.core.util.Context.NONE); + } + /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentGetByBillingAccount.json + * savingsPlanOrderExpandedScheduleGetByBillingAccount.json */ /** - * Sample code: BillingRoleAssignmentGetByBillingAccount. + * Sample code: SavingsPlanOrderWithExpandedPaymentsGet. * * @param manager Entry point to BillingManager. */ public static void - billingRoleAssignmentGetByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() + savingsPlanOrderWithExpandedPaymentsGet(com.azure.resourcemanager.billing.BillingManager manager) { + manager.savingsPlanOrders() .getByBillingAccountWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", - "10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9", - com.azure.core.util.Context.NONE); + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "20000000-0000-0000-0000-000000000000", null, com.azure.core.util.Context.NONE); } } ``` @@ -2174,26 +2069,29 @@ public final class BillingRoleAssignmentsGetByBillingAccountSamples { ### BillingRoleAssignments_GetByBillingProfile ```java +import com.azure.resourcemanager.billing.models.TransactionType; +import java.time.LocalDate; + /** - * Samples for BillingRoleAssignments GetByBillingProfile. + * Samples for Transactions ListByCustomer. */ -public final class BillingRoleAssignmentsGetByBillingProfileSamples { +public final class TransactionsListByCustomerSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentGetByBillingProfile.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/transactionsListByCustomer. + * json */ /** - * Sample code: BillingRoleAssignmentGetByBillingProfile. + * Sample code: TransactionsListByCustomer. * * @param manager Entry point to BillingManager. */ - public static void - billingRoleAssignmentGetByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .getByBillingProfileWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", - "xxxx-xxxx-xxx-xxx", "10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9", - com.azure.core.util.Context.NONE); + public static void transactionsListByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { + manager.transactions() + .listByCustomer("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", "22000000-0000-0000-0000-000000000000", LocalDate.parse("2024-04-01"), + LocalDate.parse("2023-05-30"), TransactionType.BILLED, "properties/date gt '2020-10-01'", + "properties/date", null, null, null, "storage", com.azure.core.util.Context.NONE); } } ``` @@ -2202,25 +2100,21 @@ public final class BillingRoleAssignmentsGetByBillingProfileSamples { ```java /** - * Samples for BillingRoleAssignments GetByCustomer. + * Samples for BillingRoleDefinition ListByEnrollmentAccount. */ -public final class BillingRoleAssignmentsGetByCustomerSamples { +public final class BillingRoleDefinitionListByEnrollmentAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentGetByCustomer.json + * billingRoleDefinitionListByEnrollmentAccount.json */ /** - * Sample code: BillingRoleAssignmentGetByCustomer. + * Sample code: BillingRoleDefinitionListByEnrollmentAccount. * * @param manager Entry point to BillingManager. */ - public static void billingRoleAssignmentGetByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .getByCustomerWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", - "xxxx-xxxx-xxx-xxx", "703ab484-dda2-4402-827b-a74513b61e2d", - "30000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9", - com.azure.core.util.Context.NONE); + public static void + billingRoleDefinitionListByEnrollmentAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleDefinitions().listByEnrollmentAccount("123456", "4568789", com.azure.core.util.Context.NONE); } } ``` @@ -2229,22 +2123,24 @@ public final class BillingRoleAssignmentsGetByCustomerSamples { ```java /** - * Samples for BillingRoleAssignments GetByDepartment. + * Samples for Customers GetByBillingAccount. */ -public final class BillingRoleAssignmentsGetByDepartmentSamples { +public final class CustomersGetByBillingAccountSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentGetByDepartment.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/customersGetByBillingAccount. + * json */ /** - * Sample code: BillingRoleAssignmentGetByDepartment. + * Sample code: CustomersGetByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void billingRoleAssignmentGetByDepartment(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .getByDepartmentWithResponse("7898901", "225314", "9dfd08c2-62a3-4d47-85bd-1cdba1408402", - com.azure.core.util.Context.NONE); + public static void customersGetByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.customers() + .getByBillingAccountWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "11111111-1111-1111-1111-111111111111", com.azure.core.util.Context.NONE); } } ``` @@ -2253,22 +2149,24 @@ public final class BillingRoleAssignmentsGetByDepartmentSamples { ```java /** - * Samples for BillingRoleAssignments GetByEnrollmentAccount. + * Samples for BillingRoleAssignments DeleteByBillingAccount. */ -public final class BillingRoleAssignmentsGetByEnrollmentAccountSamples { +public final class BillingRoleAssignmentsDeleteByBillingAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentGetByEnrollmentAccount.json + * billingRoleAssignmentDeleteByBillingAccount.json */ /** - * Sample code: BillingRoleAssignmentGetByEnrollmentAccount. + * Sample code: BillingRoleAssignmentDeleteByBillingAccount. * * @param manager Entry point to BillingManager. */ public static void - billingRoleAssignmentGetByEnrollmentAccount(com.azure.resourcemanager.billing.BillingManager manager) { + billingRoleAssignmentDeleteByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { manager.billingRoleAssignments() - .getByEnrollmentAccountWithResponse("7898901", "225314", "9dfd08c2-62a3-4d47-85bd-1cdba1408402", + .deleteByBillingAccountWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", + "10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9", com.azure.core.util.Context.NONE); } } @@ -2278,26 +2176,22 @@ public final class BillingRoleAssignmentsGetByEnrollmentAccountSamples { ```java /** - * Samples for BillingRoleAssignments GetByInvoiceSection. + * Samples for Customers Get. */ -public final class BillingRoleAssignmentsGetByInvoiceSectionSamples { +public final class CustomersGetSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentGetByInvoiceSection.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/customersGet.json */ /** - * Sample code: BillingRoleAssignmentGetByInvoiceSection. + * Sample code: CustomersGet. * * @param manager Entry point to BillingManager. */ - public static void - billingRoleAssignmentGetByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .getByInvoiceSectionWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", - "BKM6-54VH-BG7-PGB", "xxxx-xxxx-xxx-xxx", - "10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9", - com.azure.core.util.Context.NONE); + public static void customersGet(com.azure.resourcemanager.billing.BillingManager manager) { + manager.customers() + .getWithResponse("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", com.azure.core.util.Context.NONE); } } ``` @@ -2306,24 +2200,20 @@ public final class BillingRoleAssignmentsGetByInvoiceSectionSamples { ```java /** - * Samples for BillingRoleAssignments ListByBillingAccount. + * Samples for PaymentMethods ListByUser. */ -public final class BillingRoleAssignmentsListByBillingAccountSamples { +public final class PaymentMethodsListByUserSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentListByBillingAccount.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentMethodsListByUser.json */ /** - * Sample code: BillingRoleAssignmentListByBillingAccount. + * Sample code: ListPaymentMethodOwnedByUser. * * @param manager Entry point to BillingManager. */ - public static void - billingRoleAssignmentListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .listByBillingAccount( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", null, null, - null, com.azure.core.util.Context.NONE); + public static void listPaymentMethodOwnedByUser(com.azure.resourcemanager.billing.BillingManager manager) { + manager.paymentMethods().listByUser(com.azure.core.util.Context.NONE); } } ``` @@ -2332,24 +2222,22 @@ public final class BillingRoleAssignmentsListByBillingAccountSamples { ```java /** - * Samples for BillingRoleAssignments ListByBillingProfile. + * Samples for EnrollmentAccounts GetByDepartment. */ -public final class BillingRoleAssignmentsListByBillingProfileSamples { +public final class EnrollmentAccountsGetByDepartmentSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentListByBillingProfile.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/enrollmentAccountByDepartment + * .json */ /** - * Sample code: BillingRoleAssignmentListByBillingProfile. + * Sample code: EnrollmentAccountByDepartment. * * @param manager Entry point to BillingManager. */ - public static void - billingRoleAssignmentListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .listByBillingProfile( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", - "xxxx-xxxx-xxx-xxx", null, null, null, com.azure.core.util.Context.NONE); + public static void enrollmentAccountByDepartment(com.azure.resourcemanager.billing.BillingManager manager) { + manager.enrollmentAccounts() + .getByDepartmentWithResponse("6564892", "164821", "257698", com.azure.core.util.Context.NONE); } } ``` @@ -2358,22 +2246,21 @@ public final class BillingRoleAssignmentsListByBillingProfileSamples { ```java /** - * Samples for BillingRoleAssignments ListByCustomer. + * Samples for BillingRoleDefinition GetByDepartment. */ -public final class BillingRoleAssignmentsListByCustomerSamples { +public final class BillingRoleDefinitionGetByDepartmentSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentListByCustomer.json + * billingRoleDefinitionGetByDepartment.json */ /** - * Sample code: BillingRoleAssignmentListByCustomer. + * Sample code: BillingRoleDefinitionGetByDepartment. * * @param manager Entry point to BillingManager. */ - public static void billingRoleAssignmentListByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .listByCustomer("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", - "BKM6-54VH-BG7-PGB", "703ab484-dda2-4402-827b-a74513b61e2d", null, null, null, + public static void billingRoleDefinitionGetByDepartment(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleDefinitions() + .getByDepartmentWithResponse("123456", "7368531", "50000000-aaaa-bbbb-cccc-100000000000", com.azure.core.util.Context.NONE); } } @@ -2383,22 +2270,25 @@ public final class BillingRoleAssignmentsListByCustomerSamples { ```java /** - * Samples for BillingRoleAssignments ListByDepartment. + * Samples for BillingSubscriptions ListByInvoiceSection. */ -public final class BillingRoleAssignmentsListByDepartmentSamples { +public final class BillingSubscriptionsListByInvoiceSectionSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentListByDepartment.json + * billingSubscriptionsListByInvoiceSection.json */ /** - * Sample code: BillingRoleAssignmentListByDepartment. + * Sample code: BillingSubscriptionsListByInvoiceSection. * * @param manager Entry point to BillingManager. */ - public static void billingRoleAssignmentListByDepartment(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .listByDepartment("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", - "12345", com.azure.core.util.Context.NONE); + public static void + billingSubscriptionsListByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingSubscriptions() + .listByInvoiceSection( + "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", + "ea36e548-1505-41db-bebc-46fff3d37998", "Q7GV-UUVA-PJA-TGB", null, null, null, null, null, null, null, + null, com.azure.core.util.Context.NONE); } } ``` @@ -2407,21 +2297,24 @@ public final class BillingRoleAssignmentsListByDepartmentSamples { ```java /** - * Samples for BillingRoleAssignments ListByEnrollmentAccount. + * Samples for BillingSubscriptionsAliases ListByBillingAccount. */ -public final class BillingRoleAssignmentsListByEnrollmentAccountSamples { +public final class BillingSubscriptionsAliasesListByBillingAccountSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentListByEnrollmentAccount.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionAliasList. + * json */ /** - * Sample code: BillingRoleAssignmentListByEnrollmentAccount. + * Sample code: BillingSubscriptionAliasList. * * @param manager Entry point to BillingManager. */ - public static void - billingRoleAssignmentListByEnrollmentAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments().listByEnrollmentAccount("6100092", "123456", com.azure.core.util.Context.NONE); + public static void billingSubscriptionAliasList(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingSubscriptionsAliases() + .listByBillingAccount( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", null, null, + null, null, null, null, null, com.azure.core.util.Context.NONE); } } ``` @@ -2430,24 +2323,41 @@ public final class BillingRoleAssignmentsListByEnrollmentAccountSamples { ```java /** - * Samples for BillingRoleAssignments ListByInvoiceSection. + * Samples for InvoiceSections ValidateDeleteEligibility. */ -public final class BillingRoleAssignmentsListByInvoiceSectionSamples { +public final class InvoiceSectionsValidateDeleteEligibilitySamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleAssignmentListByInvoiceSection.json + * invoiceSectionsValidateDeleteEligibilityFailure.json */ /** - * Sample code: BillingRoleAssignmentListByInvoiceSection. + * Sample code: InvoiceSectionsValidateDeleteEligibilityFailure. * * @param manager Entry point to BillingManager. */ public static void - billingRoleAssignmentListByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .listByInvoiceSection( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", - "BKM6-54VH-BG7-PGB", "xxxx-xxxx-xxx-xxx", null, null, null, com.azure.core.util.Context.NONE); + invoiceSectionsValidateDeleteEligibilityFailure(com.azure.resourcemanager.billing.BillingManager manager) { + manager.invoiceSections() + .validateDeleteEligibilityWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * invoiceSectionsValidateDeleteEligibilitySuccess.json + */ + /** + * Sample code: InvoiceSectionsValidateDeleteEligibilitySuccess. + * + * @param manager Entry point to BillingManager. + */ + public static void + invoiceSectionsValidateDeleteEligibilitySuccess(com.azure.resourcemanager.billing.BillingManager manager) { + manager.invoiceSections() + .validateDeleteEligibilityWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", com.azure.core.util.Context.NONE); } } ``` @@ -2456,24 +2366,23 @@ public final class BillingRoleAssignmentsListByInvoiceSectionSamples { ```java /** - * Samples for BillingRoleAssignments ResolveByBillingAccount. + * Samples for SavingsPlanOrders ListByBillingAccount. */ -public final class BillingRoleAssignmentsResolveByBillingAccountSamples { +public final class SavingsPlanOrdersListByBillingAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * resolveBillingRoleAssignmentByBillingAccount.json + * savingsPlanOrderListByBillingAccount.json */ /** - * Sample code: ResolveBillingRoleAssignmentByBillingAccount. + * Sample code: SavingsPlanOrderList. * - * @param manager Entry point to BillingManager. - */ - public static void - resolveBillingRoleAssignmentByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .resolveByBillingAccount( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", null, null, - com.azure.core.util.Context.NONE); + * @param manager Entry point to BillingManager. + */ + public static void savingsPlanOrderList(com.azure.resourcemanager.billing.BillingManager manager) { + manager.savingsPlanOrders() + .listByBillingAccount( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", null, null, + null, com.azure.core.util.Context.NONE); } } ``` @@ -2481,25 +2390,30 @@ public final class BillingRoleAssignmentsResolveByBillingAccountSamples { ### BillingRoleAssignments_ResolveByBillingProfile ```java +import com.azure.resourcemanager.billing.models.CheckAccessRequest; +import java.util.Arrays; + /** - * Samples for BillingRoleAssignments ResolveByBillingProfile. + * Samples for BillingPermissions CheckAccessByInvoiceSection. */ -public final class BillingRoleAssignmentsResolveByBillingProfileSamples { +public final class BillingPermissionsCheckAccessByInvoiceSectionSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * resolveBillingRoleAssignmentByBillingProfile.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/checkAccessByInvoiceSection. + * json */ /** - * Sample code: ResolveBillingRoleAssignmentByBillingProfile. + * Sample code: CheckAccessByInvoiceSection. * * @param manager Entry point to BillingManager. */ - public static void - resolveBillingRoleAssignmentByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .resolveByBillingProfile( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", - "xxxx-xxxx-xxx-xxx", null, null, com.azure.core.util.Context.NONE); + public static void checkAccessByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingPermissions() + .checkAccessByInvoiceSectionWithResponse( + "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", "Q7GV-UUVA-PJA-TGB", new CheckAccessRequest().withActions(Arrays + .asList("Microsoft.Billing/billingAccounts/read", "Microsoft.Subscription/subscriptions/write")), + com.azure.core.util.Context.NONE); } } ``` @@ -2507,24 +2421,37 @@ public final class BillingRoleAssignmentsResolveByBillingProfileSamples { ### BillingRoleAssignments_ResolveByCustomer ```java +import com.azure.resourcemanager.billing.fluent.models.BillingProfilePolicyInner; +import com.azure.resourcemanager.billing.models.BillingProfilePolicyProperties; +import com.azure.resourcemanager.billing.models.InvoiceSectionLabelManagementPolicy; +import com.azure.resourcemanager.billing.models.MarketplacePurchasesPolicy; +import com.azure.resourcemanager.billing.models.ReservationPurchasesPolicy; +import com.azure.resourcemanager.billing.models.SavingsPlanPurchasesPolicy; + /** - * Samples for BillingRoleAssignments ResolveByCustomer. + * Samples for Policies CreateOrUpdateByBillingProfile. */ -public final class BillingRoleAssignmentsResolveByCustomerSamples { +public final class PoliciesCreateOrUpdateByBillingProfileSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * resolveBillingRoleAssignmentByCustomer.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/policiesPutByBillingProfile. + * json */ /** - * Sample code: ResolveBillingRoleAssignmentByCustomer. + * Sample code: PoliciesPutByBillingProfile. * * @param manager Entry point to BillingManager. */ - public static void - resolveBillingRoleAssignmentByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .resolveByCustomer("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", - "xxxx-xxxx-xxx-xxx", "703ab484-dda2-4402-827b-a74513b61e2d", null, null, + public static void policiesPutByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { + manager.policies() + .createOrUpdateByBillingProfile( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", + new BillingProfilePolicyInner().withProperties(new BillingProfilePolicyProperties() + .withInvoiceSectionLabelManagement(InvoiceSectionLabelManagementPolicy.ALLOWED) + .withMarketplacePurchases(MarketplacePurchasesPolicy.ALL_ALLOWED) + .withReservationPurchases(ReservationPurchasesPolicy.ALLOWED) + .withSavingsPlanPurchases(SavingsPlanPurchasesPolicy.ALLOWED)), com.azure.core.util.Context.NONE); } } @@ -2534,24 +2461,22 @@ public final class BillingRoleAssignmentsResolveByCustomerSamples { ```java /** - * Samples for BillingRoleAssignments ResolveByInvoiceSection. + * Samples for Products ListByCustomer. */ -public final class BillingRoleAssignmentsResolveByInvoiceSectionSamples { +public final class ProductsListByCustomerSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * resolveBillingRoleAssignmentByInvoiceSection.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/productsListByCustomer.json */ /** - * Sample code: ResolveBillingRoleAssignmentByInvoiceSection. + * Sample code: ProductsListByCustomer. * * @param manager Entry point to BillingManager. */ - public static void - resolveBillingRoleAssignmentByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleAssignments() - .resolveByInvoiceSection( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", - "BKM6-54VH-BG7-PGB", "xxxx-xxxx-xxx-xxx", null, null, com.azure.core.util.Context.NONE); + public static void productsListByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { + manager.products() + .listByCustomer("a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", + "Q7GV-UUVA-PJA-TGB", null, null, null, null, null, null, com.azure.core.util.Context.NONE); } } ``` @@ -2560,24 +2485,20 @@ public final class BillingRoleAssignmentsResolveByInvoiceSectionSamples { ```java /** - * Samples for BillingRoleDefinition GetByBillingAccount. + * Samples for RecipientTransfers List. */ -public final class BillingRoleDefinitionGetByBillingAccountSamples { +public final class RecipientTransfersListSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleDefinitionGetByBillingAccount.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/recipientTransfersList.json */ /** - * Sample code: BillingRoleDefinitionGetByBillingAccount. + * Sample code: RecipientTransfersList. * * @param manager Entry point to BillingManager. */ - public static void - billingRoleDefinitionGetByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleDefinitions() - .getByBillingAccountWithResponse( - "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "50000000-aaaa-bbbb-cccc-100000000000", com.azure.core.util.Context.NONE); + public static void recipientTransfersList(com.azure.resourcemanager.billing.BillingManager manager) { + manager.recipientTransfers().list(com.azure.core.util.Context.NONE); } } ``` @@ -2586,79 +2507,67 @@ public final class BillingRoleDefinitionGetByBillingAccountSamples { ```java /** - * Samples for BillingRoleDefinition GetByBillingProfile. + * Samples for BillingRequests ListByUser. */ -public final class BillingRoleDefinitionGetByBillingProfileSamples { +public final class BillingRequestsListByUserSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleDefinitionGetByBillingProfile.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRequestsListByUser. + * json */ /** - * Sample code: BillingRoleDefinitionGetByBillingProfile. + * Sample code: BillingRequestsListByUser. * * @param manager Entry point to BillingManager. */ - public static void - billingRoleDefinitionGetByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleDefinitions() - .getByBillingProfileWithResponse( - "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "40000000-aaaa-bbbb-cccc-100000000000", com.azure.core.util.Context.NONE); + public static void billingRequestsListByUser(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRequests().listByUser(null, null, null, null, null, null, com.azure.core.util.Context.NONE); } -} -``` - -### BillingRoleDefinition_GetByCustomer -```java -/** - * Samples for BillingRoleDefinition GetByCustomer. - */ -public final class BillingRoleDefinitionGetByCustomerSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleDefinitionGetByCustomer.json + * billingRequestsListByUserWithFilter.json */ /** - * Sample code: BillingRoleDefinitionGetByCustomer. + * Sample code: BillingRequestsListByUserWithFilter. * * @param manager Entry point to BillingManager. */ - public static void billingRoleDefinitionGetByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleDefinitions() - .getByCustomerWithResponse( - "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", "30000000-aaaa-bbbb-cccc-100000000000", + public static void billingRequestsListByUserWithFilter(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRequests() + .listByUser("properties/status eq 'Approved'", null, null, null, null, null, com.azure.core.util.Context.NONE); } } ``` -### BillingRoleDefinition_GetByDepartment +### BillingRoleDefinition_GetByCustomer ```java /** - * Samples for BillingRoleDefinition GetByDepartment. + * Samples for BillingRoleAssignments ListByBillingAccount. */ -public final class BillingRoleDefinitionGetByDepartmentSamples { +public final class BillingRoleAssignmentsListByBillingAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleDefinitionGetByDepartment.json + * billingRoleAssignmentListByBillingAccount.json */ /** - * Sample code: BillingRoleDefinitionGetByDepartment. + * Sample code: BillingRoleAssignmentListByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void billingRoleDefinitionGetByDepartment(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleDefinitions() - .getByDepartmentWithResponse("123456", "7368531", "50000000-aaaa-bbbb-cccc-100000000000", - com.azure.core.util.Context.NONE); + public static void + billingRoleAssignmentListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .listByBillingAccount( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", null, null, + null, com.azure.core.util.Context.NONE); } } ``` -### BillingRoleDefinition_GetByEnrollmentAccount +### BillingRoleDefinition_GetByDepartment ```java /** @@ -2683,261 +2592,257 @@ public final class BillingRoleDefinitionGetByEnrollmentAccountSamples { } ``` -### BillingRoleDefinition_GetByInvoiceSection +### BillingRoleDefinition_GetByEnrollmentAccount ```java /** - * Samples for BillingRoleDefinition GetByInvoiceSection. + * Samples for BillingRoleAssignments DeleteByBillingProfile. */ -public final class BillingRoleDefinitionGetByInvoiceSectionSamples { +public final class BillingRoleAssignmentsDeleteByBillingProfileSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleDefinitionGetByInvoiceSection.json + * billingRoleAssignmentDeleteByBillingProfile.json */ /** - * Sample code: BillingRoleDefinitionGetByInvoiceSection. + * Sample code: BillingRoleAssignmentDeleteByBillingProfile. * * @param manager Entry point to BillingManager. */ public static void - billingRoleDefinitionGetByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleDefinitions() - .getByInvoiceSectionWithResponse( - "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", "30000000-aaaa-bbbb-cccc-100000000000", + billingRoleAssignmentDeleteByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .deleteByBillingProfileWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", + "BKM6-54VH-BG7-PGB", "10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9", com.azure.core.util.Context.NONE); } } ``` -### BillingRoleDefinition_ListByBillingAccount +### BillingRoleDefinition_GetByInvoiceSection ```java /** - * Samples for BillingRoleDefinition ListByBillingAccount. + * Samples for BillingRoleAssignments ListByInvoiceSection. */ -public final class BillingRoleDefinitionListByBillingAccountSamples { +public final class BillingRoleAssignmentsListByInvoiceSectionSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleDefinitionListByBillingAccount.json + * billingRoleAssignmentListByInvoiceSection.json */ /** - * Sample code: BillingRoleDefinitionListByBillingAccount. + * Sample code: BillingRoleAssignmentListByInvoiceSection. * * @param manager Entry point to BillingManager. */ public static void - billingRoleDefinitionListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleDefinitions() - .listByBillingAccount( - "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - com.azure.core.util.Context.NONE); + billingRoleAssignmentListByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .listByInvoiceSection( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", + "BKM6-54VH-BG7-PGB", "xxxx-xxxx-xxx-xxx", null, null, null, com.azure.core.util.Context.NONE); } } ``` -### BillingRoleDefinition_ListByBillingProfile +### BillingRoleDefinition_ListByBillingAccount ```java +import com.azure.resourcemanager.billing.fluent.models.BillingSubscriptionAliasInner; + /** - * Samples for BillingRoleDefinition ListByBillingProfile. + * Samples for BillingSubscriptionsAliases CreateOrUpdate. */ -public final class BillingRoleDefinitionListByBillingProfileSamples { +public final class BillingSubscriptionsAliasesCreateOrUpdateSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleDefinitionListByBillingProfile.json + * billingSubscriptionAliasCreateOrUpdate.json */ /** - * Sample code: BillingRoleDefinitionListByBillingProfile. + * Sample code: BillingSubscriptionAliasCreateOrUpdate. * * @param manager Entry point to BillingManager. */ public static void - billingRoleDefinitionListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleDefinitions() - .listByBillingProfile( - "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", com.azure.core.util.Context.NONE); + billingSubscriptionAliasCreateOrUpdate(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingSubscriptionsAliases() + .createOrUpdate("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "c356b7c7-7545-4686-b843-c1a49cf853fc", + new BillingSubscriptionAliasInner().withBillingFrequency("P1M") + .withDisplayName("Subscription 3") + .withQuantity(1L) + .withSkuId("0001") + .withTermDuration("P1M"), + com.azure.core.util.Context.NONE); } } ``` -### BillingRoleDefinition_ListByCustomer +### BillingRoleDefinition_ListByBillingProfile ```java /** - * Samples for BillingRoleDefinition ListByCustomer. + * Samples for Transactions GetTransactionSummaryByInvoice. */ -public final class BillingRoleDefinitionListByCustomerSamples { +public final class TransactionsGetTransactionSummaryByInvoiceSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleDefinitionListByCustomer.json + * transactionSummaryGetByInvoice.json */ /** - * Sample code: BillingRoleDefinitionListByCustomer. + * Sample code: TransactionSummaryGetByInvoice. * * @param manager Entry point to BillingManager. */ - public static void billingRoleDefinitionListByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleDefinitions() - .listByCustomer("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", com.azure.core.util.Context.NONE); + public static void transactionSummaryGetByInvoice(com.azure.resourcemanager.billing.BillingManager manager) { + manager.transactions() + .getTransactionSummaryByInvoiceWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "G123456789", + null, null, com.azure.core.util.Context.NONE); } } ``` -### BillingRoleDefinition_ListByDepartment +### BillingRoleDefinition_ListByCustomer ```java /** - * Samples for BillingRoleDefinition ListByDepartment. + * Samples for ReservationOrders GetByBillingAccount. */ -public final class BillingRoleDefinitionListByDepartmentSamples { +public final class ReservationOrdersGetByBillingAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleDefinitionListByDepartment.json + * reservationOrderGetByBillingAccount.json */ /** - * Sample code: BillingRoleDefinitionListByDepartment. + * Sample code: reservationOrderGetByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void billingRoleDefinitionListByDepartment(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleDefinitions().listByDepartment("123456", "7368531", com.azure.core.util.Context.NONE); + public static void reservationOrderGetByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.reservationOrders() + .getByBillingAccountWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "20000000-0000-0000-0000-000000000000", null, com.azure.core.util.Context.NONE); } -} -``` -### BillingRoleDefinition_ListByEnrollmentAccount - -```java -/** - * Samples for BillingRoleDefinition ListByEnrollmentAccount. - */ -public final class BillingRoleDefinitionListByEnrollmentAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleDefinitionListByEnrollmentAccount.json + * reservationOrderGetByBillingAccountWithExpandPlanInformation.json */ /** - * Sample code: BillingRoleDefinitionListByEnrollmentAccount. + * Sample code: reservationOrderGetByBillingAccountWithExpandPlanInformation. * * @param manager Entry point to BillingManager. */ - public static void - billingRoleDefinitionListByEnrollmentAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleDefinitions().listByEnrollmentAccount("123456", "4568789", com.azure.core.util.Context.NONE); + public static void reservationOrderGetByBillingAccountWithExpandPlanInformation( + com.azure.resourcemanager.billing.BillingManager manager) { + manager.reservationOrders() + .getByBillingAccountWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "20000000-0000-0000-0000-000000000000", null, com.azure.core.util.Context.NONE); } } ``` -### BillingRoleDefinition_ListByInvoiceSection +### BillingRoleDefinition_ListByDepartment ```java /** - * Samples for BillingRoleDefinition ListByInvoiceSection. + * Samples for Invoices GetByBillingSubscription. */ -public final class BillingRoleDefinitionListByInvoiceSectionSamples { +public final class InvoicesGetByBillingSubscriptionSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingRoleDefinitionListByInvoiceSection.json + * invoicesGetByBillingSubscription.json */ /** - * Sample code: BillingRoleDefinitionListByInvoiceSection. + * Sample code: InvoicesGetByBillingSubscription. * * @param manager Entry point to BillingManager. */ - public static void - billingRoleDefinitionListByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingRoleDefinitions() - .listByInvoiceSection( - "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", com.azure.core.util.Context.NONE); + public static void invoicesGetByBillingSubscription(com.azure.resourcemanager.billing.BillingManager manager) { + manager.invoices().getByBillingSubscriptionWithResponse("E123456789", com.azure.core.util.Context.NONE); } } ``` -### BillingSubscriptions_Cancel +### BillingRoleDefinition_ListByEnrollmentAccount ```java -import com.azure.resourcemanager.billing.models.CancellationReason; -import com.azure.resourcemanager.billing.models.CancelSubscriptionRequest; - /** - * Samples for BillingSubscriptions Cancel. + * Samples for BillingPermissions ListByCustomer. */ -public final class BillingSubscriptionsCancelSamples { +public final class BillingPermissionsListByCustomerSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionsCancel. - * json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingPermissionsListByCustomer.json */ /** - * Sample code: BillingSubscriptionsCancel. + * Sample code: BillingPermissionsListByCustomer. * * @param manager Entry point to BillingManager. */ - public static void billingSubscriptionsCancel(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingSubscriptions() - .cancel("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "11111111-1111-1111-1111-111111111111", - new CancelSubscriptionRequest().withCancellationReason(CancellationReason.COMPROMISE) - .withCustomerId("11111111-1111-1111-1111-111111111111"), - com.azure.core.util.Context.NONE); + public static void billingPermissionsListByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingPermissions() + .listByCustomer("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "BKM6-54VH-BG7-PGB", "11111111-1111-1111-1111-111111111111", com.azure.core.util.Context.NONE); } } ``` -### BillingSubscriptions_Delete +### BillingRoleDefinition_ListByInvoiceSection ```java /** - * Samples for BillingSubscriptions Delete. + * Samples for BillingRoleAssignments ResolveByBillingAccount. */ -public final class BillingSubscriptionsDeleteSamples { +public final class BillingRoleAssignmentsResolveByBillingAccountSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionsDelete. - * json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * resolveBillingRoleAssignmentByBillingAccount.json */ /** - * Sample code: BillingSubscriptionsDelete. + * Sample code: ResolveBillingRoleAssignmentByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void billingSubscriptionsDelete(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingSubscriptions() - .delete("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "11111111-1111-1111-1111-111111111111", com.azure.core.util.Context.NONE); + public static void + resolveBillingRoleAssignmentByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .resolveByBillingAccount( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", null, null, + com.azure.core.util.Context.NONE); } } ``` -### BillingSubscriptions_Get +### BillingSubscriptions_Cancel ```java /** - * Samples for BillingSubscriptions Get. + * Samples for SavingsPlans ListByBillingAccount. */ -public final class BillingSubscriptionsGetSamples { +public final class SavingsPlansListByBillingAccountSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionsGet.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * savingsPlansListByBillingAccount.json */ /** - * Sample code: BillingSubscriptionsGet. + * Sample code: SavingsPlansList. * * @param manager Entry point to BillingManager. */ - public static void billingSubscriptionsGet(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingSubscriptions() - .getWithResponse("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "11111111-1111-1111-1111-111111111111", null, com.azure.core.util.Context.NONE); + public static void savingsPlansList(com.azure.resourcemanager.billing.BillingManager manager) { + manager.savingsPlans() + .listByBillingAccount( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", null, null, + null, 3.0F, "Succeeded", "true", com.azure.core.util.Context.NONE); } } ``` -### BillingSubscriptions_GetByBillingProfile +### BillingSubscriptions_Delete ```java /** @@ -2962,1236 +2867,1232 @@ public final class BillingSubscriptionsGetByBillingProfileSamples { } ``` -### BillingSubscriptions_ListByBillingAccount +### BillingSubscriptions_Get ```java +import com.azure.resourcemanager.billing.models.CheckAccessRequest; +import java.util.Arrays; + /** - * Samples for BillingSubscriptions ListByBillingAccount. + * Samples for BillingPermissions CheckAccessByBillingAccount. */ -public final class BillingSubscriptionsListByBillingAccountSamples { +public final class BillingPermissionsCheckAccessByBillingAccountSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingSubscriptionsListByBillingAccount.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/checkAccessByBillingAccount. + * json */ /** - * Sample code: BillingSubscriptionsListByBillingAccount. + * Sample code: CheckAccessByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void - billingSubscriptionsListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingSubscriptions() - .listByBillingAccount( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", false, false, - null, null, null, null, null, null, null, null, com.azure.core.util.Context.NONE); + public static void checkAccessByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingPermissions() + .checkAccessByBillingAccountWithResponse( + "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + new CheckAccessRequest().withActions(Arrays.asList("Microsoft.Billing/billingAccounts/read", + "Microsoft.Subscription/subscriptions/write")), + com.azure.core.util.Context.NONE); } } ``` -### BillingSubscriptions_ListByBillingProfile +### BillingSubscriptions_GetByBillingProfile ```java +import com.azure.resourcemanager.billing.models.CheckAccessRequest; +import java.util.Arrays; + /** - * Samples for BillingSubscriptions ListByBillingProfile. + * Samples for BillingPermissions CheckAccessByCustomer. */ -public final class BillingSubscriptionsListByBillingProfileSamples { - /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingSubscriptionsListByBillingProfileEA.json - */ - /** - * Sample code: BillingSubscriptionsListByBillingProfileEA. - * - * @param manager Entry point to BillingManager. - */ - public static void - billingSubscriptionsListByBillingProfileEA(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingSubscriptions() - .listByBillingProfile("pcn.94077792", "6478903", null, null, null, null, null, null, null, null, - com.azure.core.util.Context.NONE); - } - +public final class BillingPermissionsCheckAccessByCustomerSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingSubscriptionsListByBillingProfileMCA.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/checkAccessByCustomer.json */ /** - * Sample code: BillingSubscriptionsListByBillingProfileMCA. + * Sample code: CheckAccessByCustomer. * * @param manager Entry point to BillingManager. */ - public static void - billingSubscriptionsListByBillingProfileMCA(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingSubscriptions() - .listByBillingProfile( - "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", - "ea36e548-1505-41db-bebc-46fff3d37998", null, null, null, null, null, null, null, null, + public static void checkAccessByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingPermissions() + .checkAccessByCustomerWithResponse( + "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", "703ab484-dda2-4402-827b-a74513b61e2d", new CheckAccessRequest().withActions(Arrays + .asList("Microsoft.Billing/billingAccounts/read", "Microsoft.Subscription/subscriptions/write")), com.azure.core.util.Context.NONE); } } ``` -### BillingSubscriptions_ListByCustomer +### BillingSubscriptions_ListByBillingAccount ```java +import com.azure.resourcemanager.billing.models.ServiceDefinedResourceName; + /** - * Samples for BillingSubscriptions ListByCustomer. + * Samples for Policies GetByCustomer. */ -public final class BillingSubscriptionsListByCustomerSamples { +public final class PoliciesGetByCustomerSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingSubscriptionsListByCustomer.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/policiesGetByCustomer.json */ /** - * Sample code: BillingSubscriptionsListByCustomer. + * Sample code: PoliciesGetByCustomer. * * @param manager Entry point to BillingManager. */ - public static void billingSubscriptionsListByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingSubscriptions() - .listByCustomer("a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", - "ea36e548-1505-41db-bebc-46fff3d37998", "Q7GV-UUVA-PJA-TGB", null, null, null, null, null, null, null, - null, com.azure.core.util.Context.NONE); + public static void policiesGetByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { + manager.policies() + .getByCustomerWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", ServiceDefinedResourceName.DEFAULT, + com.azure.core.util.Context.NONE); } } ``` -### BillingSubscriptions_ListByCustomerAtBillingAccount +### BillingSubscriptions_ListByBillingProfile ```java /** - * Samples for BillingSubscriptions ListByCustomerAtBillingAccount. + * Samples for Invoices Amend. */ -public final class BillingSubscriptionsListByCustomerAtBillingAccountSamples { +public final class InvoicesAmendSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingSubscriptionsListByCustomerAtBillingAccount.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoicesAmend.json */ /** - * Sample code: BillingSubscriptionsListByCustomerAtBillingAccount. + * Sample code: InvoicesAmend. * * @param manager Entry point to BillingManager. */ - public static void - billingSubscriptionsListByCustomerAtBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingSubscriptions() - .listByCustomerAtBillingAccount( - "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", - "Q7GV-UUVA-PJA-TGB", null, null, null, null, null, null, null, null, com.azure.core.util.Context.NONE); + public static void invoicesAmend(com.azure.resourcemanager.billing.BillingManager manager) { + manager.invoices() + .amend("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "G123456789", + com.azure.core.util.Context.NONE); } } ``` -### BillingSubscriptions_ListByEnrollmentAccount +### BillingSubscriptions_ListByCustomer ```java +import com.azure.resourcemanager.billing.models.BillingAccountPatch; +import com.azure.resourcemanager.billing.models.BillingAccountProperties; +import com.azure.resourcemanager.billing.models.BillingAccountPropertiesEnrollmentDetails; +import com.azure.resourcemanager.billing.models.BillingAccountPropertiesSoldTo; + /** - * Samples for BillingSubscriptions ListByEnrollmentAccount. + * Samples for BillingAccounts Update. */ -public final class BillingSubscriptionsListByEnrollmentAccountSamples { +public final class BillingAccountsUpdateSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingSubscriptionsListByEnrollmentAccount.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingAccountsUpdate.json */ /** - * Sample code: BillingSubscriptionsListByEnrollmentAccount. + * Sample code: BillingAccountsUpdate. * * @param manager Entry point to BillingManager. */ - public static void - billingSubscriptionsListByEnrollmentAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingSubscriptions() - .listByEnrollmentAccount("6564892", "172988", null, null, null, null, null, null, + public static void billingAccountsUpdate(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingAccounts() + .update("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + new BillingAccountPatch().withProperties(new BillingAccountProperties().withDisplayName("Test Account") + .withSoldTo(new BillingAccountPropertiesSoldTo().withAddressLine1("1 Microsoft Way") + .withCity("Redmond") + .withCompanyName("Contoso") + .withCountry("US") + .withPostalCode("fakeTokenPlaceholder") + .withRegion("WA"))), com.azure.core.util.Context.NONE); } -} -``` - -### BillingSubscriptions_ListByInvoiceSection -```java -/** - * Samples for BillingSubscriptions ListByInvoiceSection. - */ -public final class BillingSubscriptionsListByInvoiceSectionSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingSubscriptionsListByInvoiceSection.json + * billingAccountUpdateWithPONumber.json */ /** - * Sample code: BillingSubscriptionsListByInvoiceSection. + * Sample code: BillingAccountUpdateWithPONumber. * * @param manager Entry point to BillingManager. */ - public static void - billingSubscriptionsListByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingSubscriptions() - .listByInvoiceSection( - "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", - "ea36e548-1505-41db-bebc-46fff3d37998", "Q7GV-UUVA-PJA-TGB", null, null, null, null, null, null, null, - null, com.azure.core.util.Context.NONE); + public static void billingAccountUpdateWithPONumber(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingAccounts() + .update("6575495", + new BillingAccountPatch().withProperties(new BillingAccountProperties().withEnrollmentDetails( + new BillingAccountPropertiesEnrollmentDetails().withPoNumber("poNumber123"))), + com.azure.core.util.Context.NONE); } } ``` -### BillingSubscriptions_Merge +### BillingSubscriptions_ListByCustomerAtBillingAccount ```java -import com.azure.resourcemanager.billing.models.BillingSubscriptionMergeRequest; - /** - * Samples for BillingSubscriptions Merge. + * Samples for BillingSubscriptions ListByBillingAccount. */ -public final class BillingSubscriptionsMergeSamples { +public final class BillingSubscriptionsListByBillingAccountSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionsMerge. - * json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingSubscriptionsListByBillingAccount.json */ /** - * Sample code: BillingSubscriptionsMerge. + * Sample code: BillingSubscriptionsListByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void billingSubscriptionsMerge(com.azure.resourcemanager.billing.BillingManager manager) { + public static void + billingSubscriptionsListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { manager.billingSubscriptions() - .merge("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "11111111-1111-1111-1111-111111111111", - new BillingSubscriptionMergeRequest() - .withTargetBillingSubscriptionName("22222222-2222-2222-2222-222222222222") - .withQuantity(1), - com.azure.core.util.Context.NONE); + .listByBillingAccount( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", false, false, + null, null, null, null, null, null, null, null, com.azure.core.util.Context.NONE); } } ``` -### BillingSubscriptions_Move +### BillingSubscriptions_ListByEnrollmentAccount ```java -import com.azure.resourcemanager.billing.models.MoveBillingSubscriptionRequest; - /** - * Samples for BillingSubscriptions Move. + * Samples for BillingRoleAssignments DeleteByCustomer. */ -public final class BillingSubscriptionsMoveSamples { +public final class BillingRoleAssignmentsDeleteByCustomerSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionMove.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingRoleAssignmentDeleteByCustomer.json */ /** - * Sample code: BillingSubscriptionMove. + * Sample code: BillingRoleAssignmentDeleteByCustomer. * * @param manager Entry point to BillingManager. */ - public static void billingSubscriptionMove(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingSubscriptions() - .move("a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", - "6b96d3f2-9008-4a9d-912f-f87744185aa3", - new MoveBillingSubscriptionRequest().withDestinationInvoiceSectionId( - "/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), + public static void billingRoleAssignmentDeleteByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .deleteByCustomerWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", + "BKM6-54VH-BG7-PGB", "703ab484-dda2-4402-827b-a74513b61e2d", + "30000000-aaaa-bbbb-cccc-100000000000_00000000-0000-0000-0000-000000000000", com.azure.core.util.Context.NONE); } } ``` -### BillingSubscriptions_Split +### BillingSubscriptions_ListByInvoiceSection ```java -import com.azure.resourcemanager.billing.models.BillingSubscriptionSplitRequest; - /** - * Samples for BillingSubscriptions Split. + * Samples for BillingRoleAssignments ListByCustomer. */ -public final class BillingSubscriptionsSplitSamples { +public final class BillingRoleAssignmentsListByCustomerSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionsSplit. - * json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingRoleAssignmentListByCustomer.json */ /** - * Sample code: BillingSubscriptionsSplit. + * Sample code: BillingRoleAssignmentListByCustomer. * * @param manager Entry point to BillingManager. */ - public static void billingSubscriptionsSplit(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingSubscriptions() - .split("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "11111111-1111-1111-1111-111111111111", - new BillingSubscriptionSplitRequest().withTargetProductTypeId("XYZ56789") - .withTargetSkuId("0001") - .withQuantity(1) - .withTermDuration("P1M") - .withBillingFrequency("P1M"), + public static void billingRoleAssignmentListByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .listByCustomer("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", + "BKM6-54VH-BG7-PGB", "703ab484-dda2-4402-827b-a74513b61e2d", null, null, null, com.azure.core.util.Context.NONE); } } ``` -### BillingSubscriptions_Update +### BillingSubscriptions_Merge ```java -import com.azure.resourcemanager.billing.models.BillingSubscriptionPatch; - /** - * Samples for BillingSubscriptions Update. + * Samples for BillingRoleDefinition GetByBillingAccount. */ -public final class BillingSubscriptionsUpdateSamples { +public final class BillingRoleDefinitionGetByBillingAccountSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionsUpdate. - * json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingRoleDefinitionGetByBillingAccount.json */ /** - * Sample code: BillingSubscriptionsUpdate. + * Sample code: BillingRoleDefinitionGetByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void billingSubscriptionsUpdate(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingSubscriptions() - .update("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "11111111-1111-1111-1111-111111111111", - new BillingSubscriptionPatch().withConsumptionCostCenter("ABC1234"), com.azure.core.util.Context.NONE); + public static void + billingRoleDefinitionGetByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleDefinitions() + .getByBillingAccountWithResponse( + "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "50000000-aaaa-bbbb-cccc-100000000000", com.azure.core.util.Context.NONE); } } ``` -### BillingSubscriptions_ValidateMoveEligibility +### BillingSubscriptions_Move ```java -import com.azure.resourcemanager.billing.models.MoveBillingSubscriptionRequest; - /** - * Samples for BillingSubscriptions ValidateMoveEligibility. + * Samples for Reservations GetByReservationOrder. */ -public final class BillingSubscriptionsValidateMoveEligibilitySamples { +public final class ReservationsGetByReservationOrderSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingSubscriptionValidateMoveSuccess.json + * reservationGetByBillingAccountManagementGroup.json */ /** - * Sample code: BillingSubscriptionValidateMoveSuccess. + * Sample code: reservationGetByBillingAccountManagementGroup. * * @param manager Entry point to BillingManager. */ public static void - billingSubscriptionValidateMoveSuccess(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingSubscriptions() - .validateMoveEligibilityWithResponse( - "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", - "6b96d3f2-9008-4a9d-912f-f87744185aa3", - new MoveBillingSubscriptionRequest().withDestinationInvoiceSectionId( - "/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), + reservationGetByBillingAccountManagementGroup(com.azure.resourcemanager.billing.BillingManager manager) { + manager.reservations() + .getByReservationOrderWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", null, com.azure.core.util.Context.NONE); } /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingSubscriptionValidateMoveFailure.json + * reservationGetByBillingAccount.json */ /** - * Sample code: BillingSubscriptionValidateMoveFailure. + * Sample code: reservationGetByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void - billingSubscriptionValidateMoveFailure(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingSubscriptions() - .validateMoveEligibilityWithResponse( - "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", - "6b96d3f2-9008-4a9d-912f-f87744185aa3", - new MoveBillingSubscriptionRequest().withDestinationInvoiceSectionId( - "/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), + public static void reservationGetByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.reservations() + .getByReservationOrderWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", null, com.azure.core.util.Context.NONE); } -} -``` - -### BillingSubscriptionsAliases_CreateOrUpdate - -```java -import com.azure.resourcemanager.billing.fluent.models.BillingSubscriptionAliasInner; -/** - * Samples for BillingSubscriptionsAliases CreateOrUpdate. - */ -public final class BillingSubscriptionsAliasesCreateOrUpdateSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * billingSubscriptionAliasCreateOrUpdate.json + * reservationGetByBillingAccountSingleScope.json */ /** - * Sample code: BillingSubscriptionAliasCreateOrUpdate. + * Sample code: reservationGetByBillingAccountSingleScope. * * @param manager Entry point to BillingManager. */ public static void - billingSubscriptionAliasCreateOrUpdate(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingSubscriptionsAliases() - .createOrUpdate("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "c356b7c7-7545-4686-b843-c1a49cf853fc", - new BillingSubscriptionAliasInner().withBillingFrequency("P1M") - .withDisplayName("Subscription 3") - .withQuantity(1L) - .withSkuId("0001") - .withTermDuration("P1M"), + reservationGetByBillingAccountSingleScope(com.azure.resourcemanager.billing.BillingManager manager) { + manager.reservations() + .getByReservationOrderWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", null, com.azure.core.util.Context.NONE); } -} -``` - -### BillingSubscriptionsAliases_Get -```java -/** - * Samples for BillingSubscriptionsAliases Get. - */ -public final class BillingSubscriptionsAliasesGetSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionAliasGet. - * json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * reservationGetByBillingAccountSingleResourceGroup.json */ /** - * Sample code: BillingSubscriptionAliasGet. + * Sample code: reservationGetByBillingAccountSingleResourceGroup. * * @param manager Entry point to BillingManager. */ - public static void billingSubscriptionAliasGet(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingSubscriptionsAliases() - .getWithResponse("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "c356b7c7-7545-4686-b843-c1a49cf853fc", com.azure.core.util.Context.NONE); + public static void + reservationGetByBillingAccountSingleResourceGroup(com.azure.resourcemanager.billing.BillingManager manager) { + manager.reservations() + .getByReservationOrderWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", null, + com.azure.core.util.Context.NONE); } } ``` -### BillingSubscriptionsAliases_ListByBillingAccount +### BillingSubscriptions_Split ```java +import java.time.LocalDate; + /** - * Samples for BillingSubscriptionsAliases ListByBillingAccount. + * Samples for Invoices ListByBillingAccount. */ -public final class BillingSubscriptionsAliasesListByBillingAccountSamples { +public final class InvoicesListByBillingAccountSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionAliasList. + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoicesListByBillingAccount. * json */ /** - * Sample code: BillingSubscriptionAliasList. + * Sample code: InvoicesListByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void billingSubscriptionAliasList(com.azure.resourcemanager.billing.BillingManager manager) { - manager.billingSubscriptionsAliases() + public static void invoicesListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.invoices() .listByBillingAccount( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", null, null, - null, null, null, null, null, com.azure.core.util.Context.NONE); + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + LocalDate.parse("2023-01-01"), LocalDate.parse("2023-06-30"), null, null, null, null, null, null, + com.azure.core.util.Context.NONE); } } ``` -### Customers_Get +### BillingSubscriptions_Update ```java /** - * Samples for Customers Get. + * Samples for Reservations ListByBillingProfile. */ -public final class CustomersGetSamples { +public final class ReservationsListByBillingProfileSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/customersGet.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * reservationsListByBillingProfile.json */ /** - * Sample code: CustomersGet. + * Sample code: ReservationsListByBillingProfile. * * @param manager Entry point to BillingManager. */ - public static void customersGet(com.azure.resourcemanager.billing.BillingManager manager) { - manager.customers() - .getWithResponse("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", com.azure.core.util.Context.NONE); + public static void reservationsListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { + manager.reservations() + .listByBillingProfile( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "AAAA-AAAA-AAA-AAA", null, null, null, "true", "Succeeded", null, com.azure.core.util.Context.NONE); } } ``` -### Customers_GetByBillingAccount +### BillingSubscriptions_ValidateMoveEligibility ```java /** - * Samples for Customers GetByBillingAccount. + * Samples for AssociatedTenants Get. */ -public final class CustomersGetByBillingAccountSamples { +public final class AssociatedTenantsGetSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/customersGetByBillingAccount. - * json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/associatedTenantsGet.json */ /** - * Sample code: CustomersGetByBillingAccount. + * Sample code: AssociatedTenantsGet. * * @param manager Entry point to BillingManager. */ - public static void customersGetByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.customers() - .getByBillingAccountWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + public static void associatedTenantsGet(com.azure.resourcemanager.billing.BillingManager manager) { + manager.associatedTenants() + .getWithResponse("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "11111111-1111-1111-1111-111111111111", com.azure.core.util.Context.NONE); } } ``` -### Customers_ListByBillingAccount +### BillingSubscriptionsAliases_CreateOrUpdate ```java /** - * Samples for Customers ListByBillingAccount. + * Samples for BillingRoleAssignments DeleteByInvoiceSection. */ -public final class CustomersListByBillingAccountSamples { +public final class BillingRoleAssignmentsDeleteByInvoiceSectionSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/customersListByBillingAccount - * .json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingRoleAssignmentDeleteByInvoiceSection.json */ /** - * Sample code: CustomersListByBillingAccount. + * Sample code: BillingRoleAssignmentDeleteByInvoiceSection. * * @param manager Entry point to BillingManager. */ - public static void customersListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.customers() - .listByBillingAccount( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", null, null, - null, null, null, null, null, com.azure.core.util.Context.NONE); + public static void + billingRoleAssignmentDeleteByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .deleteByInvoiceSectionWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", + "BKM6-54VH-BG7-PGB", "xxxx-xxxx-xxx-xxx", + "10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9", + com.azure.core.util.Context.NONE); } +} +``` + +### BillingSubscriptionsAliases_Get +```java +/** + * Samples for Transfers Cancel. + */ +public final class TransfersCancelSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * customersListByBillingAccountWithExpand.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/transfersCancel.json */ /** - * Sample code: CustomersListByBillingAccountWithExpand. + * Sample code: TransferCancel. * * @param manager Entry point to BillingManager. */ - public static void - customersListByBillingAccountWithExpand(com.azure.resourcemanager.billing.BillingManager manager) { - manager.customers() - .listByBillingAccount( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "enabledAzurePlans,resellers", null, null, null, null, null, null, com.azure.core.util.Context.NONE); + public static void transferCancel(com.azure.resourcemanager.billing.BillingManager manager) { + manager.transfers() + .cancelWithResponse("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", "aabb123", com.azure.core.util.Context.NONE); } } ``` -### Customers_ListByBillingProfile +### BillingSubscriptionsAliases_ListByBillingAccount ```java /** - * Samples for Customers ListByBillingProfile. + * Samples for Policies GetByBillingAccount. */ -public final class CustomersListByBillingProfileSamples { +public final class PoliciesGetByBillingAccountSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/customersListByBillingProfile - * .json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/policiesGetByBillingAccount. + * json */ /** - * Sample code: CustomersListByBillingProfile. + * Sample code: PoliciesGetByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void customersListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { - manager.customers() - .listByBillingProfile( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", null, null, null, null, null, null, null, com.azure.core.util.Context.NONE); + public static void policiesGetByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.policies().getByBillingAccountWithResponse("1234567", com.azure.core.util.Context.NONE); } } ``` -### Departments_Get +### Customers_Get ```java /** - * Samples for Departments Get. + * Samples for BillingRoleAssignments DeleteByDepartment. */ -public final class DepartmentsGetSamples { +public final class BillingRoleAssignmentsDeleteByDepartmentSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/departmentGet.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingRoleAssignmentDeleteByDepartment.json */ /** - * Sample code: DepartmentGet. + * Sample code: BillingRoleAssignmentDeleteByDepartment. * * @param manager Entry point to BillingManager. */ - public static void departmentGet(com.azure.resourcemanager.billing.BillingManager manager) { - manager.departments().getWithResponse("456598", "164821", com.azure.core.util.Context.NONE); + public static void + billingRoleAssignmentDeleteByDepartment(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .deleteByDepartmentWithResponse("8608480", "123456", "9dfd08c2-62a3-4d47-85bd-1cdba1408402", + com.azure.core.util.Context.NONE); } } ``` -### Departments_ListByBillingAccount +### Customers_GetByBillingAccount ```java /** - * Samples for Departments ListByBillingAccount. + * Samples for Products ListByBillingProfile. */ -public final class DepartmentsListByBillingAccountSamples { +public final class ProductsListByBillingProfileSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * departmentsListByBillingAccount.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/productsListByBillingProfile. + * json */ /** - * Sample code: DepartmentsListByBillingAccount. + * Sample code: ProductsListByBillingProfile. * * @param manager Entry point to BillingManager. */ - public static void departmentsListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.departments() - .listByBillingAccount("456598", null, null, null, null, null, com.azure.core.util.Context.NONE); + public static void productsListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { + manager.products() + .listByBillingProfile( + "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", + "ea36e548-1505-41db-bebc-46fff3d37998", null, null, null, null, null, null, + com.azure.core.util.Context.NONE); } } ``` -### EnrollmentAccounts_Get +### Customers_ListByBillingAccount ```java /** - * Samples for EnrollmentAccounts Get. + * Samples for BillingProfiles Get. */ -public final class EnrollmentAccountsGetSamples { +public final class BillingProfilesGetSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/enrollmentAccountGet.json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingProfilesGet.json */ /** - * Sample code: EnrollmentAccountGet. + * Sample code: BillingProfilesGet. * * @param manager Entry point to BillingManager. */ - public static void enrollmentAccountGet(com.azure.resourcemanager.billing.BillingManager manager) { - manager.enrollmentAccounts().getWithResponse("6564892", "257698", com.azure.core.util.Context.NONE); + public static void billingProfilesGet(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingProfiles() + .getWithResponse("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", com.azure.core.util.Context.NONE); } } ``` -### EnrollmentAccounts_GetByDepartment +### Customers_ListByBillingProfile ```java /** - * Samples for EnrollmentAccounts GetByDepartment. + * Samples for PaymentMethods ListByBillingAccount. */ -public final class EnrollmentAccountsGetByDepartmentSamples { +public final class PaymentMethodsListByBillingAccountSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/enrollmentAccountByDepartment - * .json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * paymentMethodsListByBillingAccount.json */ /** - * Sample code: EnrollmentAccountByDepartment. + * Sample code: PaymentMethodsListByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void enrollmentAccountByDepartment(com.azure.resourcemanager.billing.BillingManager manager) { - manager.enrollmentAccounts() - .getByDepartmentWithResponse("6564892", "164821", "257698", com.azure.core.util.Context.NONE); + public static void paymentMethodsListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.paymentMethods() + .listByBillingAccount( + "00000000-0000-0000-0000-000000000032:00000000-0000-0000-0000-000000000099_2019-05-31", + com.azure.core.util.Context.NONE); } } ``` -### EnrollmentAccounts_ListByBillingAccount +### Departments_Get ```java /** - * Samples for EnrollmentAccounts ListByBillingAccount. + * Samples for BillingProfiles Delete. */ -public final class EnrollmentAccountsListByBillingAccountSamples { +public final class BillingProfilesDeleteSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * enrollmentAccountsListByBillingAccount.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingProfilesDelete.json */ /** - * Sample code: EnrollmentAccountsListByBillingAccount. + * Sample code: BillingProfilesDelete. * * @param manager Entry point to BillingManager. */ - public static void - enrollmentAccountsListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.enrollmentAccounts() - .listByBillingAccount("6564892", null, null, null, null, null, null, com.azure.core.util.Context.NONE); + public static void billingProfilesDelete(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingProfiles() + .delete("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", com.azure.core.util.Context.NONE); } } ``` -### EnrollmentAccounts_ListByDepartment +### Departments_ListByBillingAccount ```java /** - * Samples for EnrollmentAccounts ListByDepartment. + * Samples for BillingProfiles ListByBillingAccount. */ -public final class EnrollmentAccountsListByDepartmentSamples { +public final class BillingProfilesListByBillingAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * enrollmentAccountsListByDepartment.json + * billingProfilesListByBillingAccount.json */ /** - * Sample code: EnrollmentAccountsListByDepartment. + * Sample code: BillingProfilesListByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void enrollmentAccountsListByDepartment(com.azure.resourcemanager.billing.BillingManager manager) { - manager.enrollmentAccounts() - .listByDepartment("6564892", "164821", null, null, null, null, null, null, - com.azure.core.util.Context.NONE); + public static void billingProfilesListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingProfiles() + .listByBillingAccount( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", null, null, + null, null, null, null, null, com.azure.core.util.Context.NONE); } } ``` -### InvoiceSections_CreateOrUpdate +### EnrollmentAccounts_Get ```java -import com.azure.resourcemanager.billing.fluent.models.InvoiceSectionInner; -import com.azure.resourcemanager.billing.models.InvoiceSectionProperties; -import java.util.HashMap; -import java.util.Map; - /** - * Samples for InvoiceSections CreateOrUpdate. + * Samples for BillingRequests ListByBillingProfile. */ -public final class InvoiceSectionsCreateOrUpdateSamples { +public final class BillingRequestsListByBillingProfileSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoiceSectionsCreateOrUpdate - * .json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingRequestsListByBillingProfile.json */ /** - * Sample code: InvoiceSectionsCreateOrUpdate. + * Sample code: BillingRequestsListByBillingProfile. * * @param manager Entry point to BillingManager. */ - public static void invoiceSectionsCreateOrUpdate(com.azure.resourcemanager.billing.BillingManager manager) { - manager.invoiceSections() - .createOrUpdate("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "invoice-section-1", - new InvoiceSectionInner() - .withProperties(new InvoiceSectionProperties().withDisplayName("Invoice Section 1") - .withTags(mapOf("costCategory", "Support", "pcCode", "fakeTokenPlaceholder"))), - com.azure.core.util.Context.NONE); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; + public static void billingRequestsListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRequests() + .listByBillingProfile( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", null, null, null, null, null, null, com.azure.core.util.Context.NONE); } } ``` -### InvoiceSections_Delete +### EnrollmentAccounts_GetByDepartment ```java +import com.azure.resourcemanager.billing.fluent.models.BillingRoleAssignmentInner; +import com.azure.resourcemanager.billing.models.BillingRoleAssignmentProperties; + /** - * Samples for InvoiceSections Delete. + * Samples for BillingRoleAssignments CreateOrUpdateByDepartment. */ -public final class InvoiceSectionsDeleteSamples { +public final class BillingRoleAssignmentsCreateOrUpdateByDepartmentSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoiceSectionsDelete.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingRoleAssignmentCreateOrUpdateByDepartment.json */ /** - * Sample code: InvoiceSectionsDelete. + * Sample code: BillingRoleAssignmentCreateOrUpdateByDepartment. * * @param manager Entry point to BillingManager. */ - public static void invoiceSectionsDelete(com.azure.resourcemanager.billing.BillingManager manager) { - manager.invoiceSections() - .delete("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", com.azure.core.util.Context.NONE); + public static void + billingRoleAssignmentCreateOrUpdateByDepartment(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .createOrUpdateByDepartment("7898901", "12345", "9dfd08c2-62a3-4d47-85bd-1cdba1408402", + new BillingRoleAssignmentInner().withProperties(new BillingRoleAssignmentProperties() + .withPrincipalId("00000000-0000-0000-0000-000000000000") + .withPrincipalTenantId("076915e7-de10-4323-bb34-a58c904068bb") + .withRoleDefinitionId( + "/providers/Microsoft.Billing/billingAccounts/7898901/departments/12345/billingRoleDefinitions/9f1983cb-2574-400c-87e9-34cf8e2280db") + .withUserEmailAddress("john@contoso.com")), + com.azure.core.util.Context.NONE); } } ``` -### InvoiceSections_Get +### EnrollmentAccounts_ListByBillingAccount ```java /** - * Samples for InvoiceSections Get. + * Samples for BillingPermissions ListByBillingAccount. */ -public final class InvoiceSectionsGetSamples { +public final class BillingPermissionsListByBillingAccountSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoiceSectionsGet.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingPermissionsListByBillingAccount.json */ /** - * Sample code: InvoiceSectionsGet. + * Sample code: BillingPermissionsListByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void invoiceSectionsGet(com.azure.resourcemanager.billing.BillingManager manager) { - manager.invoiceSections() - .getWithResponse("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", com.azure.core.util.Context.NONE); + public static void + billingPermissionsListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingPermissions() + .listByBillingAccount( + "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + com.azure.core.util.Context.NONE); } } ``` -### InvoiceSections_ListByBillingProfile +### EnrollmentAccounts_ListByDepartment ```java +import com.azure.resourcemanager.billing.models.BillingSubscriptionPatch; + /** - * Samples for InvoiceSections ListByBillingProfile. + * Samples for BillingSubscriptions Update. */ -public final class InvoiceSectionsListByBillingProfileSamples { +public final class BillingSubscriptionsUpdateSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * invoiceSectionsListByBillingProfile.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionsUpdate. + * json */ /** - * Sample code: InvoiceSectionsListByBillingProfile. + * Sample code: BillingSubscriptionsUpdate. * * @param manager Entry point to BillingManager. */ - public static void invoiceSectionsListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { - manager.invoiceSections() - .listByBillingProfile( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", true, null, null, null, null, null, null, com.azure.core.util.Context.NONE); + public static void billingSubscriptionsUpdate(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingSubscriptions() + .update("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "11111111-1111-1111-1111-111111111111", + new BillingSubscriptionPatch().withConsumptionCostCenter("ABC1234"), com.azure.core.util.Context.NONE); } } ``` -### InvoiceSections_ValidateDeleteEligibility +### InvoiceSections_CreateOrUpdate ```java /** - * Samples for InvoiceSections ValidateDeleteEligibility. + * Samples for Transfers List. */ -public final class InvoiceSectionsValidateDeleteEligibilitySamples { +public final class TransfersListSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * invoiceSectionsValidateDeleteEligibilityFailure.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/transfersList.json */ /** - * Sample code: InvoiceSectionsValidateDeleteEligibilityFailure. + * Sample code: TransfersList. * * @param manager Entry point to BillingManager. */ - public static void - invoiceSectionsValidateDeleteEligibilityFailure(com.azure.resourcemanager.billing.BillingManager manager) { - manager.invoiceSections() - .validateDeleteEligibilityWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + public static void transfersList(com.azure.resourcemanager.billing.BillingManager manager) { + manager.transfers() + .list("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", com.azure.core.util.Context.NONE); } +} +``` +### InvoiceSections_Delete + +```java +/** + * Samples for BillingRoleDefinition ListByInvoiceSection. + */ +public final class BillingRoleDefinitionListByInvoiceSectionSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * invoiceSectionsValidateDeleteEligibilitySuccess.json + * billingRoleDefinitionListByInvoiceSection.json */ /** - * Sample code: InvoiceSectionsValidateDeleteEligibilitySuccess. + * Sample code: BillingRoleDefinitionListByInvoiceSection. * * @param manager Entry point to BillingManager. */ public static void - invoiceSectionsValidateDeleteEligibilitySuccess(com.azure.resourcemanager.billing.BillingManager manager) { - manager.invoiceSections() - .validateDeleteEligibilityWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + billingRoleDefinitionListByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleDefinitions() + .listByInvoiceSection( + "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", com.azure.core.util.Context.NONE); } } ``` -### Invoices_Amend +### InvoiceSections_Get ```java /** - * Samples for Invoices Amend. + * Samples for Invoices DownloadSummaryByBillingAccount. */ -public final class InvoicesAmendSamples { +public final class InvoicesDownloadSummaryByBillingAccountSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoicesAmend.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * invoicesDownloadSummaryByBillingAccount.json */ /** - * Sample code: InvoicesAmend. + * Sample code: InvoicesDownloadSummaryByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void invoicesAmend(com.azure.resourcemanager.billing.BillingManager manager) { - manager.invoices() - .amend("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "G123456789", - com.azure.core.util.Context.NONE); + public static void + invoicesDownloadSummaryByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.invoices().downloadSummaryByBillingAccount("123456789", "G123456789", com.azure.core.util.Context.NONE); } } ``` -### Invoices_DownloadByBillingAccount +### InvoiceSections_ListByBillingProfile ```java /** - * Samples for Invoices DownloadByBillingAccount. + * Samples for Products Get. */ -public final class InvoicesDownloadByBillingAccountSamples { +public final class ProductsGetSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * invoicesDownloadByBillingAccount.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/productsGet.json */ /** - * Sample code: InvoicesDownloadByBillingAccount. + * Sample code: ProductsGet. * * @param manager Entry point to BillingManager. */ - public static void invoicesDownloadByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.invoices() - .downloadByBillingAccount( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "G123456789", - "12345678", com.azure.core.util.Context.NONE); + public static void productsGet(com.azure.resourcemanager.billing.BillingManager manager) { + manager.products() + .getWithResponse("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "11111111-1111-1111-1111-111111111111", com.azure.core.util.Context.NONE); } } ``` -### Invoices_DownloadByBillingSubscription +### InvoiceSections_ValidateDeleteEligibility ```java /** - * Samples for Invoices DownloadByBillingSubscription. + * Samples for BillingRoleAssignments ResolveByCustomer. */ -public final class InvoicesDownloadByBillingSubscriptionSamples { +public final class BillingRoleAssignmentsResolveByCustomerSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * invoicesDownloadByBillingSubscription.json + * resolveBillingRoleAssignmentByCustomer.json */ /** - * Sample code: InvoicesDownloadByBillingSubscription. + * Sample code: ResolveBillingRoleAssignmentByCustomer. * * @param manager Entry point to BillingManager. */ - public static void invoicesDownloadByBillingSubscription(com.azure.resourcemanager.billing.BillingManager manager) { - manager.invoices().downloadByBillingSubscription("E123456789", "12345678", com.azure.core.util.Context.NONE); + public static void + resolveBillingRoleAssignmentByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .resolveByCustomer("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", + "xxxx-xxxx-xxx-xxx", "703ab484-dda2-4402-827b-a74513b61e2d", null, null, + com.azure.core.util.Context.NONE); } } ``` -### Invoices_DownloadDocumentsByBillingAccount +### Invoices_Amend ```java -import com.azure.resourcemanager.billing.models.DocumentDownloadRequest; -import java.util.Arrays; - /** - * Samples for Invoices DownloadDocumentsByBillingAccount. + * Samples for BillingRoleAssignments GetByInvoiceSection. */ -public final class InvoicesDownloadDocumentsByBillingAccountSamples { +public final class BillingRoleAssignmentsGetByInvoiceSectionSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * invoicesDownloadDocumentsByBillingAccount.json + * billingRoleAssignmentGetByInvoiceSection.json */ /** - * Sample code: InvoicesDownloadDocumentsByBillingAccount. + * Sample code: BillingRoleAssignmentGetByInvoiceSection. * * @param manager Entry point to BillingManager. */ public static void - invoicesDownloadDocumentsByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.invoices() - .downloadDocumentsByBillingAccount( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - Arrays.asList(new DocumentDownloadRequest().withDocumentName("12345678").withInvoiceName("G123456789"), - new DocumentDownloadRequest().withDocumentName("12345678").withInvoiceName("G987654321")), + billingRoleAssignmentGetByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .getByInvoiceSectionWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", + "BKM6-54VH-BG7-PGB", "xxxx-xxxx-xxx-xxx", + "10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9", com.azure.core.util.Context.NONE); } } ``` -### Invoices_DownloadDocumentsByBillingSubscription +### Invoices_DownloadByBillingAccount ```java -import com.azure.resourcemanager.billing.models.DocumentDownloadRequest; -import java.util.Arrays; - /** - * Samples for Invoices DownloadDocumentsByBillingSubscription. + * Samples for Products ListByInvoiceSection. */ -public final class InvoicesDownloadDocumentsByBillingSubscriptionSamples { +public final class ProductsListByInvoiceSectionSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * invoicesDownloadDocumentsByBillingSubscription.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/productsListByInvoiceSection. + * json */ /** - * Sample code: InvoicesDownloadDocumentsByBillingSubscription. + * Sample code: ProductsListByInvoiceSection. * * @param manager Entry point to BillingManager. */ - public static void - invoicesDownloadDocumentsByBillingSubscription(com.azure.resourcemanager.billing.BillingManager manager) { - manager.invoices() - .downloadDocumentsByBillingSubscription( - Arrays.asList(new DocumentDownloadRequest().withDocumentName("12345678").withInvoiceName("E123456789"), - new DocumentDownloadRequest().withDocumentName("12345678").withInvoiceName("E987654321")), + public static void productsListByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { + manager.products() + .listByInvoiceSection( + "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", + "ea36e548-1505-41db-bebc-46fff3d37998", "Q7GV-UUVA-PJA-TGB", null, null, null, null, null, null, com.azure.core.util.Context.NONE); } } ``` -### Invoices_DownloadSummaryByBillingAccount +### Invoices_DownloadByBillingSubscription ```java +import com.azure.resourcemanager.billing.models.MoveProductRequest; + /** - * Samples for Invoices DownloadSummaryByBillingAccount. + * Samples for Products ValidateMoveEligibility. */ -public final class InvoicesDownloadSummaryByBillingAccountSamples { +public final class ProductsValidateMoveEligibilitySamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * invoicesDownloadSummaryByBillingAccount.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/productValidateMoveFailure. + * json */ /** - * Sample code: InvoicesDownloadSummaryByBillingAccount. + * Sample code: ProductValidateMoveFailure. * * @param manager Entry point to BillingManager. */ - public static void - invoicesDownloadSummaryByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.invoices().downloadSummaryByBillingAccount("123456789", "G123456789", com.azure.core.util.Context.NONE); + public static void productValidateMoveFailure(com.azure.resourcemanager.billing.BillingManager manager) { + manager.products() + .validateMoveEligibilityWithResponse( + "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", + "6b96d3f2-9008-4a9d-912f-f87744185aa3", + new MoveProductRequest().withDestinationInvoiceSectionId( + "/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/productValidateMoveSuccess. + * json + */ + /** + * Sample code: ProductValidateMoveSuccess. + * + * @param manager Entry point to BillingManager. + */ + public static void productValidateMoveSuccess(com.azure.resourcemanager.billing.BillingManager manager) { + manager.products() + .validateMoveEligibilityWithResponse( + "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", + "6b96d3f2-9008-4a9d-912f-f87744185aa3", + new MoveProductRequest().withDestinationInvoiceSectionId( + "/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), + com.azure.core.util.Context.NONE); } } ``` -### Invoices_Get +### Invoices_DownloadDocumentsByBillingAccount ```java /** - * Samples for Invoices Get. + * Samples for ReservationOrders ListByBillingAccount. */ -public final class InvoicesGetSamples { +public final class ReservationOrdersListByBillingAccountSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoicesGet.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * reservationOrdersListByBillingAccount.json */ /** - * Sample code: InvoicesGet. + * Sample code: reservationOrderListByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void invoicesGet(com.azure.resourcemanager.billing.BillingManager manager) { - manager.invoices().getWithResponse("G123456789", com.azure.core.util.Context.NONE); + public static void reservationOrderListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.reservationOrders() + .listByBillingAccount( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", null, null, + null, com.azure.core.util.Context.NONE); } } ``` -### Invoices_GetByBillingAccount +### Invoices_DownloadDocumentsByBillingSubscription ```java +import com.azure.resourcemanager.billing.models.CheckAccessRequest; +import java.util.Arrays; + /** - * Samples for Invoices GetByBillingAccount. + * Samples for BillingPermissions CheckAccessByBillingProfile. */ -public final class InvoicesGetByBillingAccountSamples { +public final class BillingPermissionsCheckAccessByBillingProfileSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoicesGetByBillingAccount. + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/checkAccessByBillingProfile. * json */ /** - * Sample code: InvoicesGetByBillingAccount. + * Sample code: CheckAccessByBillingProfile. * * @param manager Entry point to BillingManager. */ - public static void invoicesGetByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.invoices() - .getByBillingAccountWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "G123456789", + public static void checkAccessByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingPermissions() + .checkAccessByBillingProfileWithResponse( + "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", new CheckAccessRequest().withActions(Arrays + .asList("Microsoft.Billing/billingAccounts/read", "Microsoft.Subscription/subscriptions/write")), com.azure.core.util.Context.NONE); } } ``` -### Invoices_GetByBillingSubscription +### Invoices_DownloadSummaryByBillingAccount ```java /** - * Samples for Invoices GetByBillingSubscription. + * Samples for BillingSubscriptions ListByBillingProfile. */ -public final class InvoicesGetByBillingSubscriptionSamples { +public final class BillingSubscriptionsListByBillingProfileSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * invoicesGetByBillingSubscription.json + * billingSubscriptionsListByBillingProfileEA.json */ /** - * Sample code: InvoicesGetByBillingSubscription. + * Sample code: BillingSubscriptionsListByBillingProfileEA. * * @param manager Entry point to BillingManager. */ - public static void invoicesGetByBillingSubscription(com.azure.resourcemanager.billing.BillingManager manager) { - manager.invoices().getByBillingSubscriptionWithResponse("E123456789", com.azure.core.util.Context.NONE); + public static void + billingSubscriptionsListByBillingProfileEA(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingSubscriptions() + .listByBillingProfile("pcn.94077792", "6478903", null, null, null, null, null, null, null, null, + com.azure.core.util.Context.NONE); } -} -``` - -### Invoices_ListByBillingAccount - -```java -import java.time.LocalDate; -/** - * Samples for Invoices ListByBillingAccount. - */ -public final class InvoicesListByBillingAccountSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoicesListByBillingAccount. - * json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingSubscriptionsListByBillingProfileMCA.json */ /** - * Sample code: InvoicesListByBillingAccount. + * Sample code: BillingSubscriptionsListByBillingProfileMCA. * * @param manager Entry point to BillingManager. */ - public static void invoicesListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.invoices() - .listByBillingAccount( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - LocalDate.parse("2023-01-01"), LocalDate.parse("2023-06-30"), null, null, null, null, null, null, + public static void + billingSubscriptionsListByBillingProfileMCA(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingSubscriptions() + .listByBillingProfile( + "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", + "ea36e548-1505-41db-bebc-46fff3d37998", null, null, null, null, null, null, null, null, com.azure.core.util.Context.NONE); } } ``` -### Invoices_ListByBillingProfile +### Invoices_Get ```java -import java.time.LocalDate; - /** - * Samples for Invoices ListByBillingProfile. + * Samples for Departments ListByBillingAccount. */ -public final class InvoicesListByBillingProfileSamples { +public final class DepartmentsListByBillingAccountSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoicesListByBillingProfile. - * json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * departmentsListByBillingAccount.json */ /** - * Sample code: InvoicesListByBillingProfile. + * Sample code: DepartmentsListByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void invoicesListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { - manager.invoices() - .listByBillingProfile( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", LocalDate.parse("2023-01-01"), LocalDate.parse("2023-06-30"), null, null, null, - null, null, null, com.azure.core.util.Context.NONE); + public static void departmentsListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.departments() + .listByBillingAccount("456598", null, null, null, null, null, com.azure.core.util.Context.NONE); } } ``` -### Invoices_ListByBillingSubscription +### Invoices_GetByBillingAccount ```java -import java.time.LocalDate; - /** - * Samples for Invoices ListByBillingSubscription. + * Samples for RecipientTransfers Decline. */ -public final class InvoicesListByBillingSubscriptionSamples { +public final class RecipientTransfersDeclineSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * invoicesListByBillingSubscription.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/recipientTransfersDecline. + * json */ /** - * Sample code: InvoicesListByBillingSubscription. + * Sample code: DeclineTransfer. * * @param manager Entry point to BillingManager. */ - public static void invoicesListByBillingSubscription(com.azure.resourcemanager.billing.BillingManager manager) { - manager.invoices() - .listByBillingSubscription(LocalDate.parse("2023-01-01"), LocalDate.parse("2023-06-30"), null, null, null, - null, null, null, com.azure.core.util.Context.NONE); + public static void declineTransfer(com.azure.resourcemanager.billing.BillingManager manager) { + manager.recipientTransfers().declineWithResponse("aabb123", com.azure.core.util.Context.NONE); } } ``` -### Operations_List +### Invoices_GetByBillingSubscription ```java /** - * Samples for Operations List. + * Samples for PaymentMethods GetByBillingProfile. */ -public final class OperationsListSamples { +public final class PaymentMethodsGetByBillingProfileSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/operationsList.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * paymentMethodsGetByBillingProfile.json */ /** - * Sample code: OperationsList. + * Sample code: PaymentMethodsGetByBillingProfile. * * @param manager Entry point to BillingManager. */ - public static void operationsList(com.azure.resourcemanager.billing.BillingManager manager) { - manager.operations().list(com.azure.core.util.Context.NONE); + public static void paymentMethodsGetByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { + manager.paymentMethods() + .getByBillingProfileWithResponse( + "00000000-0000-0000-0000-000000000032:00000000-0000-0000-0000-000000000099_2019-05-31", + "ABC1-A1CD-AB1-BP1", "ABCDABCDABC0", com.azure.core.util.Context.NONE); } } ``` -### PartnerTransfers_Cancel +### Invoices_ListByBillingAccount ```java /** - * Samples for PartnerTransfers Cancel. + * Samples for Customers ListByBillingProfile. */ -public final class PartnerTransfersCancelSamples { +public final class CustomersListByBillingProfileSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/partnerTransfersCancel.json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/customersListByBillingProfile + * .json */ /** - * Sample code: PartnerTransferCancel. + * Sample code: CustomersListByBillingProfile. * * @param manager Entry point to BillingManager. */ - public static void partnerTransferCancel(com.azure.resourcemanager.billing.BillingManager manager) { - manager.partnerTransfers() - .cancelWithResponse("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", "aabb123", - com.azure.core.util.Context.NONE); + public static void customersListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { + manager.customers() + .listByBillingProfile( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", null, null, null, null, null, null, null, com.azure.core.util.Context.NONE); } } ``` -### PartnerTransfers_Get +### Invoices_ListByBillingProfile ```java +import com.azure.resourcemanager.billing.fluent.models.BillingRoleAssignmentInner; +import com.azure.resourcemanager.billing.models.BillingRoleAssignmentProperties; + /** - * Samples for PartnerTransfers Get. + * Samples for BillingRoleAssignments CreateOrUpdateByEnrollmentAccount. */ -public final class PartnerTransfersGetSamples { +public final class BillingRoleAssignmentsCreateOrUpdateByEnrollmentAccountSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/partnerTransfersGet.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingRoleAssignmentCreateOrUpdateByEnrollmentAccount.json */ /** - * Sample code: PartnerTransferGet. + * Sample code: BillingRoleAssignmentCreateOrUpdateByEnrollmentAccount. * * @param manager Entry point to BillingManager. */ - public static void partnerTransferGet(com.azure.resourcemanager.billing.BillingManager manager) { - manager.partnerTransfers() - .getWithResponse("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", "aabb123", + public static void billingRoleAssignmentCreateOrUpdateByEnrollmentAccount( + com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .createOrUpdateByEnrollmentAccount("7898901", "123456", "9dfd08c2-62a3-4d47-85bd-1cdba1408402", + new BillingRoleAssignmentInner().withProperties(new BillingRoleAssignmentProperties() + .withPrincipalId("00000000-0000-0000-0000-000000000000") + .withPrincipalTenantId("076915e7-de10-4323-bb34-a58c904068bb") + .withRoleDefinitionId( + "/providers/Microsoft.Billing/billingAccounts/7898901/enrollmentAccounts/123456/billingRoleDefinitions/9f1983cb-2574-400c-87e9-34cf8e2280db") + .withUserEmailAddress("john@contoso.com")), com.azure.core.util.Context.NONE); } } ``` -### PartnerTransfers_Initiate +### Invoices_ListByBillingSubscription ```java import com.azure.resourcemanager.billing.models.PartnerInitiateTransferRequest; @@ -4220,363 +4121,395 @@ public final class PartnerTransfersInitiateSamples { } ``` -### PartnerTransfers_List +### Operations_List ```java /** - * Samples for PartnerTransfers List. + * Samples for BillingSubscriptions Get. */ -public final class PartnerTransfersListSamples { +public final class BillingSubscriptionsGetSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/partnerTransfersList.json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionsGet.json */ /** - * Sample code: PartnerTransfersList. + * Sample code: BillingSubscriptionsGet. * * @param manager Entry point to BillingManager. */ - public static void partnerTransfersList(com.azure.resourcemanager.billing.BillingManager manager) { - manager.partnerTransfers() - .list("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", com.azure.core.util.Context.NONE); + public static void billingSubscriptionsGet(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingSubscriptions() + .getWithResponse("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "11111111-1111-1111-1111-111111111111", null, com.azure.core.util.Context.NONE); } } ``` -### PaymentMethods_DeleteByUser +### PartnerTransfers_Cancel ```java +import com.azure.resourcemanager.billing.models.BillingSubscriptionMergeRequest; + /** - * Samples for PaymentMethods DeleteByUser. + * Samples for BillingSubscriptions Merge. */ -public final class PaymentMethodsDeleteByUserSamples { +public final class BillingSubscriptionsMergeSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentMethodsDeleteByUser. + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionsMerge. * json */ /** - * Sample code: DeletePaymentMethodOwnedByUser. + * Sample code: BillingSubscriptionsMerge. * * @param manager Entry point to BillingManager. */ - public static void deletePaymentMethodOwnedByUser(com.azure.resourcemanager.billing.BillingManager manager) { - manager.paymentMethods().deleteByUserWithResponse("ABCDABCDABC0", com.azure.core.util.Context.NONE); + public static void billingSubscriptionsMerge(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingSubscriptions() + .merge("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "11111111-1111-1111-1111-111111111111", + new BillingSubscriptionMergeRequest() + .withTargetBillingSubscriptionName("22222222-2222-2222-2222-222222222222") + .withQuantity(1), + com.azure.core.util.Context.NONE); } } ``` -### PaymentMethods_GetByBillingAccount +### PartnerTransfers_Get ```java +import com.azure.resourcemanager.billing.models.DocumentDownloadRequest; +import java.util.Arrays; + /** - * Samples for PaymentMethods GetByBillingAccount. + * Samples for Invoices DownloadDocumentsByBillingSubscription. */ -public final class PaymentMethodsGetByBillingAccountSamples { +public final class InvoicesDownloadDocumentsByBillingSubscriptionSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * paymentMethodsGetByBillingAccount.json + * invoicesDownloadDocumentsByBillingSubscription.json */ /** - * Sample code: PaymentMethodGetAtBillingProfile. + * Sample code: InvoicesDownloadDocumentsByBillingSubscription. * * @param manager Entry point to BillingManager. */ - public static void paymentMethodGetAtBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { - manager.paymentMethods() - .getByBillingAccountWithResponse( - "00000000-0000-0000-0000-000000000032:00000000-0000-0000-0000-000000000099_2019-05-31", - "21dd9edc-af71-4d62-80ce-37151d475326", com.azure.core.util.Context.NONE); + public static void + invoicesDownloadDocumentsByBillingSubscription(com.azure.resourcemanager.billing.BillingManager manager) { + manager.invoices() + .downloadDocumentsByBillingSubscription( + Arrays.asList(new DocumentDownloadRequest().withDocumentName("12345678").withInvoiceName("E123456789"), + new DocumentDownloadRequest().withDocumentName("12345678").withInvoiceName("E987654321")), + com.azure.core.util.Context.NONE); } } ``` -### PaymentMethods_GetByBillingProfile +### PartnerTransfers_Initiate ```java +import com.azure.resourcemanager.billing.models.MoveBillingSubscriptionRequest; + /** - * Samples for PaymentMethods GetByBillingProfile. + * Samples for BillingSubscriptions ValidateMoveEligibility. */ -public final class PaymentMethodsGetByBillingProfileSamples { +public final class BillingSubscriptionsValidateMoveEligibilitySamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * paymentMethodsGetByBillingProfile.json + * billingSubscriptionValidateMoveSuccess.json */ /** - * Sample code: PaymentMethodsGetByBillingProfile. + * Sample code: BillingSubscriptionValidateMoveSuccess. * * @param manager Entry point to BillingManager. */ - public static void paymentMethodsGetByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { - manager.paymentMethods() - .getByBillingProfileWithResponse( - "00000000-0000-0000-0000-000000000032:00000000-0000-0000-0000-000000000099_2019-05-31", - "ABC1-A1CD-AB1-BP1", "ABCDABCDABC0", com.azure.core.util.Context.NONE); + public static void + billingSubscriptionValidateMoveSuccess(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingSubscriptions() + .validateMoveEligibilityWithResponse( + "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", + "6b96d3f2-9008-4a9d-912f-f87744185aa3", + new MoveBillingSubscriptionRequest().withDestinationInvoiceSectionId( + "/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingSubscriptionValidateMoveFailure.json + */ + /** + * Sample code: BillingSubscriptionValidateMoveFailure. + * + * @param manager Entry point to BillingManager. + */ + public static void + billingSubscriptionValidateMoveFailure(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingSubscriptions() + .validateMoveEligibilityWithResponse( + "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", + "6b96d3f2-9008-4a9d-912f-f87744185aa3", + new MoveBillingSubscriptionRequest().withDestinationInvoiceSectionId( + "/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), + com.azure.core.util.Context.NONE); } } ``` -### PaymentMethods_GetByUser +### PartnerTransfers_List ```java /** - * Samples for PaymentMethods GetByUser. + * Samples for BillingPermissions ListByDepartment. */ -public final class PaymentMethodsGetByUserSamples { +public final class BillingPermissionsListByDepartmentSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentMethodsGetByUser.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingPermissionsListByDepartment.json */ /** - * Sample code: GetPaymentMethodOwnedByUser. + * Sample code: BillingPermissionsListByDepartment. * * @param manager Entry point to BillingManager. */ - public static void getPaymentMethodOwnedByUser(com.azure.resourcemanager.billing.BillingManager manager) { - manager.paymentMethods().getByUserWithResponse("ABCDABCDABC0", com.azure.core.util.Context.NONE); + public static void billingPermissionsListByDepartment(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingPermissions().listByDepartment("6100092", "123456", com.azure.core.util.Context.NONE); } } ``` -### PaymentMethods_ListByBillingAccount +### PaymentMethods_DeleteByUser ```java +import com.azure.resourcemanager.billing.models.BillingRoleAssignmentProperties; + /** - * Samples for PaymentMethods ListByBillingAccount. + * Samples for BillingRoleAssignments CreateByCustomer. */ -public final class PaymentMethodsListByBillingAccountSamples { +public final class BillingRoleAssignmentsCreateByCustomerSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * paymentMethodsListByBillingAccount.json + * billingRoleAssignmentCreateByCustomer.json */ /** - * Sample code: PaymentMethodsListByBillingAccount. + * Sample code: BillingRoleAssignmentCreateByCustomer. * * @param manager Entry point to BillingManager. */ - public static void paymentMethodsListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.paymentMethods() - .listByBillingAccount( - "00000000-0000-0000-0000-000000000032:00000000-0000-0000-0000-000000000099_2019-05-31", + public static void billingRoleAssignmentCreateByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .createByCustomer("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", + "BKM6-54VH-BG7-PGB", "703ab484-dda2-4402-827b-a74513b61e2d", + new BillingRoleAssignmentProperties().withPrincipalId("00000000-0000-0000-0000-000000000000") + .withPrincipalTenantId("076915e7-de10-4323-bb34-a58c904068bb") + .withRoleDefinitionId( + "/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfileName/BKM6-54VH-BG7-PGB/customers/703ab484-dda2-4402-827b-a74513b61e2d/billingRoleDefinitions/30000000-aaaa-bbbb-cccc-100000000000") + .withUserEmailAddress("john@contoso.com"), com.azure.core.util.Context.NONE); } } ``` -### PaymentMethods_ListByBillingProfile +### PaymentMethods_GetByBillingAccount ```java +import com.azure.resourcemanager.billing.fluent.models.InvoiceSectionInner; +import com.azure.resourcemanager.billing.models.InvoiceSectionProperties; +import java.util.HashMap; +import java.util.Map; + /** - * Samples for PaymentMethods ListByBillingProfile. + * Samples for InvoiceSections CreateOrUpdate. */ -public final class PaymentMethodsListByBillingProfileSamples { +public final class InvoiceSectionsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * paymentMethodsListByBillingProfile.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoiceSectionsCreateOrUpdate + * .json */ /** - * Sample code: PaymentMethodsListByBillingProfile. + * Sample code: InvoiceSectionsCreateOrUpdate. * * @param manager Entry point to BillingManager. */ - public static void paymentMethodsListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { - manager.paymentMethods() - .listByBillingProfile( - "00000000-0000-0000-0000-000000000032:00000000-0000-0000-0000-000000000099_2019-05-31", - "ABC1-A1CD-AB1-BP1", com.azure.core.util.Context.NONE); + public static void invoiceSectionsCreateOrUpdate(com.azure.resourcemanager.billing.BillingManager manager) { + manager.invoiceSections() + .createOrUpdate("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", "invoice-section-1", + new InvoiceSectionInner() + .withProperties(new InvoiceSectionProperties().withDisplayName("Invoice Section 1") + .withTags(mapOf("costCategory", "Support", "pcCode", "fakeTokenPlaceholder"))), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; } } ``` -### PaymentMethods_ListByUser +### PaymentMethods_GetByBillingProfile ```java /** - * Samples for PaymentMethods ListByUser. + * Samples for PaymentMethods DeleteByUser. */ -public final class PaymentMethodsListByUserSamples { +public final class PaymentMethodsDeleteByUserSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentMethodsListByUser.json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentMethodsDeleteByUser. + * json */ /** - * Sample code: ListPaymentMethodOwnedByUser. + * Sample code: DeletePaymentMethodOwnedByUser. * * @param manager Entry point to BillingManager. */ - public static void listPaymentMethodOwnedByUser(com.azure.resourcemanager.billing.BillingManager manager) { - manager.paymentMethods().listByUser(com.azure.core.util.Context.NONE); + public static void deletePaymentMethodOwnedByUser(com.azure.resourcemanager.billing.BillingManager manager) { + manager.paymentMethods().deleteByUserWithResponse("ABCDABCDABC0", com.azure.core.util.Context.NONE); } } ``` -### Policies_CreateOrUpdateByBillingAccount +### PaymentMethods_GetByUser ```java -import com.azure.resourcemanager.billing.fluent.models.BillingAccountPolicyInner; -import com.azure.resourcemanager.billing.models.BillingAccountPolicyProperties; -import com.azure.resourcemanager.billing.models.BillingAccountPolicyPropertiesEnterpriseAgreementPolicies; -import com.azure.resourcemanager.billing.models.EnrollmentAuthLevelState; -import com.azure.resourcemanager.billing.models.MarketplacePurchasesPolicy; -import com.azure.resourcemanager.billing.models.ReservationPurchasesPolicy; -import com.azure.resourcemanager.billing.models.SavingsPlanPurchasesPolicy; - /** - * Samples for Policies CreateOrUpdateByBillingAccount. + * Samples for AssociatedTenants Delete. */ -public final class PoliciesCreateOrUpdateByBillingAccountSamples { +public final class AssociatedTenantsDeleteSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/policiesPutByBillingAccount. - * json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/associatedTenantsDelete.json */ /** - * Sample code: PoliciesPutByBillingAccount. + * Sample code: AssociatedTenantsDelete. * * @param manager Entry point to BillingManager. */ - public static void policiesPutByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.policies() - .createOrUpdateByBillingAccount("1234567", - new BillingAccountPolicyInner().withProperties(new BillingAccountPolicyProperties() - .withEnterpriseAgreementPolicies(new BillingAccountPolicyPropertiesEnterpriseAgreementPolicies() - .withAuthenticationType(EnrollmentAuthLevelState.ORGANIZATIONAL_ACCOUNT_ONLY)) - .withMarketplacePurchases(MarketplacePurchasesPolicy.ALL_ALLOWED) - .withReservationPurchases(ReservationPurchasesPolicy.ALLOWED) - .withSavingsPlanPurchases(SavingsPlanPurchasesPolicy.NOT_ALLOWED)), - com.azure.core.util.Context.NONE); + public static void associatedTenantsDelete(com.azure.resourcemanager.billing.BillingManager manager) { + manager.associatedTenants() + .delete("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "11111111-1111-1111-1111-111111111111", com.azure.core.util.Context.NONE); } } ``` -### Policies_CreateOrUpdateByBillingProfile +### PaymentMethods_ListByBillingAccount ```java -import com.azure.resourcemanager.billing.fluent.models.BillingProfilePolicyInner; -import com.azure.resourcemanager.billing.models.BillingProfilePolicyProperties; -import com.azure.resourcemanager.billing.models.InvoiceSectionLabelManagementPolicy; -import com.azure.resourcemanager.billing.models.MarketplacePurchasesPolicy; -import com.azure.resourcemanager.billing.models.ReservationPurchasesPolicy; -import com.azure.resourcemanager.billing.models.SavingsPlanPurchasesPolicy; - /** - * Samples for Policies CreateOrUpdateByBillingProfile. + * Samples for BillingRoleAssignments GetByDepartment. */ -public final class PoliciesCreateOrUpdateByBillingProfileSamples { +public final class BillingRoleAssignmentsGetByDepartmentSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/policiesPutByBillingProfile. - * json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingRoleAssignmentGetByDepartment.json */ /** - * Sample code: PoliciesPutByBillingProfile. + * Sample code: BillingRoleAssignmentGetByDepartment. * * @param manager Entry point to BillingManager. */ - public static void policiesPutByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { - manager.policies() - .createOrUpdateByBillingProfile( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", - new BillingProfilePolicyInner().withProperties(new BillingProfilePolicyProperties() - .withInvoiceSectionLabelManagement(InvoiceSectionLabelManagementPolicy.ALLOWED) - .withMarketplacePurchases(MarketplacePurchasesPolicy.ALL_ALLOWED) - .withReservationPurchases(ReservationPurchasesPolicy.ALLOWED) - .withSavingsPlanPurchases(SavingsPlanPurchasesPolicy.ALLOWED)), + public static void billingRoleAssignmentGetByDepartment(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .getByDepartmentWithResponse("7898901", "225314", "9dfd08c2-62a3-4d47-85bd-1cdba1408402", com.azure.core.util.Context.NONE); } } ``` -### Policies_CreateOrUpdateByCustomer +### PaymentMethods_ListByBillingProfile ```java -import com.azure.resourcemanager.billing.fluent.models.CustomerPolicyInner; -import com.azure.resourcemanager.billing.models.CustomerPolicyProperties; -import com.azure.resourcemanager.billing.models.ViewChargesPolicy; - /** - * Samples for Policies CreateOrUpdateByCustomer. + * Samples for PaymentMethods GetByUser. */ -public final class PoliciesCreateOrUpdateByCustomerSamples { +public final class PaymentMethodsGetByUserSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/policiesPutByCustomer.json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentMethodsGetByUser.json */ /** - * Sample code: PoliciesPutByCustomer. + * Sample code: GetPaymentMethodOwnedByUser. * * @param manager Entry point to BillingManager. */ - public static void policiesPutByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { - manager.policies() - .createOrUpdateByCustomer( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", - new CustomerPolicyInner() - .withProperties(new CustomerPolicyProperties().withViewCharges(ViewChargesPolicy.ALLOWED)), - com.azure.core.util.Context.NONE); + public static void getPaymentMethodOwnedByUser(com.azure.resourcemanager.billing.BillingManager manager) { + manager.paymentMethods().getByUserWithResponse("ABCDABCDABC0", com.azure.core.util.Context.NONE); } } ``` -### Policies_CreateOrUpdateByCustomerAtBillingAccount +### PaymentMethods_ListByUser ```java -import com.azure.resourcemanager.billing.fluent.models.CustomerPolicyInner; -import com.azure.resourcemanager.billing.models.CustomerPolicyProperties; -import com.azure.resourcemanager.billing.models.ViewChargesPolicy; - /** - * Samples for Policies CreateOrUpdateByCustomerAtBillingAccount. + * Samples for BillingSubscriptions Delete. */ -public final class PoliciesCreateOrUpdateByCustomerAtBillingAccountSamples { +public final class BillingSubscriptionsDeleteSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * policiesPutByCustomerAtBillingAccount.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionsDelete. + * json */ /** - * Sample code: PoliciesPutByCustomerAtBillingAccount. + * Sample code: BillingSubscriptionsDelete. * * @param manager Entry point to BillingManager. */ - public static void policiesPutByCustomerAtBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.policies() - .createOrUpdateByCustomerAtBillingAccount( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "11111111-1111-1111-1111-111111111111", - new CustomerPolicyInner() - .withProperties(new CustomerPolicyProperties().withViewCharges(ViewChargesPolicy.ALLOWED)), - com.azure.core.util.Context.NONE); + public static void billingSubscriptionsDelete(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingSubscriptions() + .delete("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "11111111-1111-1111-1111-111111111111", com.azure.core.util.Context.NONE); } } ``` -### Policies_GetByBillingAccount +### Policies_CreateOrUpdateByBillingAccount ```java +import com.azure.resourcemanager.billing.models.BillingRoleAssignmentProperties; + /** - * Samples for Policies GetByBillingAccount. + * Samples for BillingRoleAssignments CreateByBillingProfile. */ -public final class PoliciesGetByBillingAccountSamples { +public final class BillingRoleAssignmentsCreateByBillingProfileSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/policiesGetByBillingAccount. - * json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingRoleAssignmentCreateByBillingProfile.json */ /** - * Sample code: PoliciesGetByBillingAccount. + * Sample code: BillingRoleAssignmentCreateByBillingProfile. * * @param manager Entry point to BillingManager. */ - public static void policiesGetByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.policies().getByBillingAccountWithResponse("1234567", com.azure.core.util.Context.NONE); + public static void + billingRoleAssignmentCreateByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .createByBillingProfile( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", + "BKM6-54VH-BG7-PGB", + new BillingRoleAssignmentProperties().withPrincipalId("00000000-0000-0000-0000-000000000000") + .withPrincipalTenantId("076915e7-de10-4323-bb34-a58c904068bb") + .withRoleDefinitionId( + "/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/billingRoleDefinitions/10000000-aaaa-bbbb-cccc-100000000000") + .withUserEmailAddress("john@contoso.com"), + com.azure.core.util.Context.NONE); } } ``` -### Policies_GetByBillingProfile +### Policies_CreateOrUpdateByBillingProfile ```java /** @@ -4602,812 +4535,873 @@ public final class PoliciesGetByBillingProfileSamples { } ``` -### Policies_GetByCustomer +### Policies_CreateOrUpdateByCustomer ```java -import com.azure.resourcemanager.billing.models.ServiceDefinedResourceName; +import java.time.LocalDate; /** - * Samples for Policies GetByCustomer. + * Samples for Invoices ListByBillingProfile. */ -public final class PoliciesGetByCustomerSamples { +public final class InvoicesListByBillingProfileSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/policiesGetByCustomer.json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoicesListByBillingProfile. + * json */ /** - * Sample code: PoliciesGetByCustomer. + * Sample code: InvoicesListByBillingProfile. * * @param manager Entry point to BillingManager. */ - public static void policiesGetByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { - manager.policies() - .getByCustomerWithResponse( + public static void invoicesListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { + manager.invoices() + .listByBillingProfile( "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", ServiceDefinedResourceName.DEFAULT, - com.azure.core.util.Context.NONE); + "xxxx-xxxx-xxx-xxx", LocalDate.parse("2023-01-01"), LocalDate.parse("2023-06-30"), null, null, null, + null, null, null, com.azure.core.util.Context.NONE); } } ``` -### Policies_GetByCustomerAtBillingAccount +### Policies_CreateOrUpdateByCustomerAtBillingAccount ```java +import com.azure.resourcemanager.billing.fluent.models.CustomerPolicyInner; +import com.azure.resourcemanager.billing.models.CustomerPolicyProperties; +import com.azure.resourcemanager.billing.models.ViewChargesPolicy; + /** - * Samples for Policies GetByCustomerAtBillingAccount. + * Samples for Policies CreateOrUpdateByCustomer. */ -public final class PoliciesGetByCustomerAtBillingAccountSamples { +public final class PoliciesCreateOrUpdateByCustomerSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * policiesGetByCustomerAtBillingAccount.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/policiesPutByCustomer.json */ /** - * Sample code: PoliciesGetByCustomerAtBillingAccount. + * Sample code: PoliciesPutByCustomer. * * @param manager Entry point to BillingManager. */ - public static void policiesGetByCustomerAtBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + public static void policiesPutByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { manager.policies() - .getByCustomerAtBillingAccountWithResponse( + .createOrUpdateByCustomer( "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "11111111-1111-1111-1111-111111111111", com.azure.core.util.Context.NONE); + "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", + new CustomerPolicyInner() + .withProperties(new CustomerPolicyProperties().withViewCharges(ViewChargesPolicy.ALLOWED)), + com.azure.core.util.Context.NONE); } } ``` -### Policies_GetBySubscription +### Policies_GetByBillingAccount ```java +import com.azure.resourcemanager.billing.models.AppliedScopeProperties; +import com.azure.resourcemanager.billing.models.AppliedScopeType; +import com.azure.resourcemanager.billing.models.SavingsPlanUpdateRequestProperties; +import com.azure.resourcemanager.billing.models.SavingsPlanUpdateValidateRequest; +import java.util.Arrays; + /** - * Samples for Policies GetBySubscription. + * Samples for SavingsPlans ValidateUpdateByBillingAccount. */ -public final class PoliciesGetBySubscriptionSamples { +public final class SavingsPlansValidateUpdateByBillingAccountSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/policiesGetBySubscription. - * json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * savingsPlanValidateUpdateByBillingAccount.json */ /** - * Sample code: PoliciesGetBySubscription. + * Sample code: SavingsPlanValidateUpdate. * * @param manager Entry point to BillingManager. */ - public static void policiesGetBySubscription(com.azure.resourcemanager.billing.BillingManager manager) { - manager.policies().getBySubscriptionWithResponse(com.azure.core.util.Context.NONE); + public static void savingsPlanValidateUpdate(com.azure.resourcemanager.billing.BillingManager manager) { + manager.savingsPlans() + .validateUpdateByBillingAccountWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", + new SavingsPlanUpdateValidateRequest().withBenefits( + Arrays.asList(new SavingsPlanUpdateRequestProperties().withAppliedScopeType(AppliedScopeType.SINGLE) + .withAppliedScopeProperties(new AppliedScopeProperties() + .withSubscriptionId("/subscriptions/50000000-0000-0000-0000-000000000000")))), + com.azure.core.util.Context.NONE); } } ``` -### Products_Get +### Policies_GetByBillingProfile ```java /** - * Samples for Products Get. + * Samples for BillingProfiles ValidateDeleteEligibility. */ -public final class ProductsGetSamples { +public final class BillingProfilesValidateDeleteEligibilitySamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/productsGet.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingProfilesValidateDeleteEligibilityFailure.json */ /** - * Sample code: ProductsGet. + * Sample code: BillingProfilesValidateDeleteEligibilityFailure. * * @param manager Entry point to BillingManager. */ - public static void productsGet(com.azure.resourcemanager.billing.BillingManager manager) { - manager.products() - .getWithResponse("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "11111111-1111-1111-1111-111111111111", com.azure.core.util.Context.NONE); + public static void + billingProfilesValidateDeleteEligibilityFailure(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingProfiles() + .validateDeleteEligibilityWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", com.azure.core.util.Context.NONE); } -} -``` - -### Products_ListByBillingAccount -```java -/** - * Samples for Products ListByBillingAccount. - */ -public final class ProductsListByBillingAccountSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/productsListByBillingAccount. - * json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingProfilesValidateDeleteEligibilitySuccess.json */ /** - * Sample code: ProductsListByBillingAccount. + * Sample code: BillingProfilesValidateDeleteEligibilitySuccess. * * @param manager Entry point to BillingManager. */ - public static void productsListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.products() - .listByBillingAccount( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", null, null, - null, null, null, null, com.azure.core.util.Context.NONE); + public static void + billingProfilesValidateDeleteEligibilitySuccess(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingProfiles() + .validateDeleteEligibilityWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", com.azure.core.util.Context.NONE); } } ``` -### Products_ListByBillingProfile +### Policies_GetByCustomer ```java +import com.azure.resourcemanager.billing.models.BillingRoleAssignmentProperties; + /** - * Samples for Products ListByBillingProfile. + * Samples for BillingRoleAssignments CreateByBillingAccount. */ -public final class ProductsListByBillingProfileSamples { +public final class BillingRoleAssignmentsCreateByBillingAccountSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/productsListByBillingProfile. - * json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingRoleAssignmentCreateByBillingAccount.json */ /** - * Sample code: ProductsListByBillingProfile. + * Sample code: BillingRoleAssignmentCreateByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void productsListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { - manager.products() - .listByBillingProfile( - "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", - "ea36e548-1505-41db-bebc-46fff3d37998", null, null, null, null, null, null, + public static void + billingRoleAssignmentCreateByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .createByBillingAccount( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", + new BillingRoleAssignmentProperties().withPrincipalId("00000000-0000-0000-0000-000000000000") + .withPrincipalTenantId("076915e7-de10-4323-bb34-a58c904068bb") + .withRoleDefinitionId( + "/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingRoleDefinitions/10000000-aaaa-bbbb-cccc-100000000000") + .withUserEmailAddress("john@contoso.com"), com.azure.core.util.Context.NONE); } } ``` -### Products_ListByCustomer +### Policies_GetByCustomerAtBillingAccount ```java /** - * Samples for Products ListByCustomer. + * Samples for BillingRequests ListByBillingAccount. */ -public final class ProductsListByCustomerSamples { +public final class BillingRequestsListByBillingAccountSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/productsListByCustomer.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingRequestsListByBillingAccount.json */ /** - * Sample code: ProductsListByCustomer. + * Sample code: BillingRequestsListByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void productsListByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { - manager.products() - .listByCustomer("a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", - "Q7GV-UUVA-PJA-TGB", null, null, null, null, null, null, com.azure.core.util.Context.NONE); + public static void billingRequestsListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRequests() + .listByBillingAccount( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", null, null, + null, null, null, null, com.azure.core.util.Context.NONE); } } ``` -### Products_ListByInvoiceSection +### Policies_GetBySubscription ```java /** - * Samples for Products ListByInvoiceSection. + * Samples for SavingsPlans ListBySavingsPlanOrder. */ -public final class ProductsListByInvoiceSectionSamples { +public final class SavingsPlansListBySavingsPlanOrderSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/productsListByInvoiceSection. - * json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * savingsPlansListBySavingsPlanOrders.json */ /** - * Sample code: ProductsListByInvoiceSection. + * Sample code: SavingsPlansInOrderList. * * @param manager Entry point to BillingManager. */ - public static void productsListByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { - manager.products() - .listByInvoiceSection( - "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", - "ea36e548-1505-41db-bebc-46fff3d37998", "Q7GV-UUVA-PJA-TGB", null, null, null, null, null, null, - com.azure.core.util.Context.NONE); + public static void savingsPlansInOrderList(com.azure.resourcemanager.billing.BillingManager manager) { + manager.savingsPlans() + .listBySavingsPlanOrder( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "20000000-0000-0000-0000-000000000000", com.azure.core.util.Context.NONE); } } ``` -### Products_Move +### Products_Get ```java -import com.azure.resourcemanager.billing.models.MoveProductRequest; - /** - * Samples for Products Move. + * Samples for BillingRoleAssignments DeleteByEnrollmentAccount. */ -public final class ProductsMoveSamples { +public final class BillingRoleAssignmentsDeleteByEnrollmentAccountSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/productMove.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingRoleAssignmentDeleteByEnrollmentAccount.json */ /** - * Sample code: ProductMove. + * Sample code: BillingRoleAssignmentDeleteByEnrollmentAccount. * * @param manager Entry point to BillingManager. */ - public static void productMove(com.azure.resourcemanager.billing.BillingManager manager) { - manager.products() - .move("a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", - "6b96d3f2-9008-4a9d-912f-f87744185aa3", - new MoveProductRequest().withDestinationInvoiceSectionId( - "/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), + public static void + billingRoleAssignmentDeleteByEnrollmentAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .deleteByEnrollmentAccountWithResponse("8608480", "123456", "9dfd08c2-62a3-4d47-85bd-1cdba1408402", com.azure.core.util.Context.NONE); } } ``` -### Products_Update +### Products_ListByBillingAccount ```java -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.ProductPatch; -import com.azure.resourcemanager.billing.models.ProductProperties; - /** - * Samples for Products Update. + * Samples for BillingRoleDefinition GetByBillingProfile. */ -public final class ProductsUpdateSamples { +public final class BillingRoleDefinitionGetByBillingProfileSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/productsUpdate.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingRoleDefinitionGetByBillingProfile.json */ /** - * Sample code: ProductsUpdate. + * Sample code: BillingRoleDefinitionGetByBillingProfile. * * @param manager Entry point to BillingManager. */ - public static void productsUpdate(com.azure.resourcemanager.billing.BillingManager manager) { - manager.products() - .updateWithResponse("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "11111111-1111-1111-1111-111111111111", - new ProductPatch().withProperties(new ProductProperties().withAutoRenew(AutoRenew.ON)), - com.azure.core.util.Context.NONE); + public static void + billingRoleDefinitionGetByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleDefinitions() + .getByBillingProfileWithResponse( + "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", "40000000-aaaa-bbbb-cccc-100000000000", com.azure.core.util.Context.NONE); } } ``` -### Products_ValidateMoveEligibility +### Products_ListByBillingProfile ```java -import com.azure.resourcemanager.billing.models.MoveProductRequest; +import com.azure.resourcemanager.billing.fluent.models.AssociatedTenantInner; +import com.azure.resourcemanager.billing.models.AssociatedTenantProperties; +import com.azure.resourcemanager.billing.models.BillingManagementTenantState; +import com.azure.resourcemanager.billing.models.ProvisioningTenantState; /** - * Samples for Products ValidateMoveEligibility. + * Samples for AssociatedTenants CreateOrUpdate. */ -public final class ProductsValidateMoveEligibilitySamples { +public final class AssociatedTenantsCreateOrUpdateSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/productValidateMoveFailure. - * json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * associatedTenantsCreateOrUpdate.json */ /** - * Sample code: ProductValidateMoveFailure. + * Sample code: AssociatedTenantsCreateOrUpdate. * * @param manager Entry point to BillingManager. */ - public static void productValidateMoveFailure(com.azure.resourcemanager.billing.BillingManager manager) { - manager.products() - .validateMoveEligibilityWithResponse( - "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", - "6b96d3f2-9008-4a9d-912f-f87744185aa3", - new MoveProductRequest().withDestinationInvoiceSectionId( - "/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), + public static void associatedTenantsCreateOrUpdate(com.azure.resourcemanager.billing.BillingManager manager) { + manager.associatedTenants() + .createOrUpdate("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "11111111-1111-1111-1111-111111111111", + new AssociatedTenantInner() + .withProperties(new AssociatedTenantProperties().withDisplayName("Contoso Finance") + .withBillingManagementState(BillingManagementTenantState.ACTIVE) + .withProvisioningManagementState(ProvisioningTenantState.PENDING)), com.azure.core.util.Context.NONE); } +} +``` + +### Products_ListByCustomer +```java +/** + * Samples for BillingPermissions ListByCustomerAtBillingAccount. + */ +public final class BillingPermissionsListByCustomerAtBillingAccountSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/productValidateMoveSuccess. - * json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingPermissionsListByCustomerAtBillingAccount.json */ /** - * Sample code: ProductValidateMoveSuccess. + * Sample code: BillingPermissionsListByCustomerAtBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void productValidateMoveSuccess(com.azure.resourcemanager.billing.BillingManager manager) { - manager.products() - .validateMoveEligibilityWithResponse( - "a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", - "6b96d3f2-9008-4a9d-912f-f87744185aa3", - new MoveProductRequest().withDestinationInvoiceSectionId( - "/providers/Microsoft.Billing/billingAccounts/a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31/billingProfiles/ea36e548-1505-41db-bebc-46fff3d37998/invoiceSections/Q7GV-UUVA-PJA-TGB"), - com.azure.core.util.Context.NONE); + public static void + billingPermissionsListByCustomerAtBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingPermissions() + .listByCustomerAtBillingAccount( + "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "11111111-1111-1111-1111-111111111111", com.azure.core.util.Context.NONE); } } ``` -### RecipientTransfers_Accept +### Products_ListByInvoiceSection ```java -import com.azure.resourcemanager.billing.models.AcceptTransferRequest; -import com.azure.resourcemanager.billing.models.ProductDetails; -import com.azure.resourcemanager.billing.models.ProductType; -import java.util.Arrays; - /** - * Samples for RecipientTransfers Accept. + * Samples for BillingRoleDefinition ListByBillingProfile. */ -public final class RecipientTransfersAcceptSamples { +public final class BillingRoleDefinitionListByBillingProfileSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/recipientTransfersAccept.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingRoleDefinitionListByBillingProfile.json */ /** - * Sample code: AcceptTransfer. + * Sample code: BillingRoleDefinitionListByBillingProfile. * * @param manager Entry point to BillingManager. */ - public static void acceptTransfer(com.azure.resourcemanager.billing.BillingManager manager) { - manager.recipientTransfers() - .acceptWithResponse("aabb123", - new AcceptTransferRequest().withProductDetails(Arrays.asList( - new ProductDetails().withProductType(ProductType.AZURE_SUBSCRIPTION) - .withProductId("subscriptionId"), - new ProductDetails().withProductType(ProductType.AZURE_RESERVATION) - .withProductId("reservedInstanceId"))), - com.azure.core.util.Context.NONE); + public static void + billingRoleDefinitionListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleDefinitions() + .listByBillingProfile( + "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", com.azure.core.util.Context.NONE); } } ``` -### RecipientTransfers_Decline +### Products_Move ```java /** - * Samples for RecipientTransfers Decline. + * Samples for BillingSubscriptions ListByCustomer. */ -public final class RecipientTransfersDeclineSamples { +public final class BillingSubscriptionsListByCustomerSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/recipientTransfersDecline. - * json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingSubscriptionsListByCustomer.json */ /** - * Sample code: DeclineTransfer. + * Sample code: BillingSubscriptionsListByCustomer. * * @param manager Entry point to BillingManager. */ - public static void declineTransfer(com.azure.resourcemanager.billing.BillingManager manager) { - manager.recipientTransfers().declineWithResponse("aabb123", com.azure.core.util.Context.NONE); + public static void billingSubscriptionsListByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingSubscriptions() + .listByCustomer("a1a9c77e-4cec-4a6c-a089-867d973a6074:a80d3b1f-c626-4e5e-82ed-1173bd91c838_2019-05-31", + "ea36e548-1505-41db-bebc-46fff3d37998", "Q7GV-UUVA-PJA-TGB", null, null, null, null, null, null, null, + null, com.azure.core.util.Context.NONE); } } ``` -### RecipientTransfers_Get +### Products_Update ```java +import com.azure.resourcemanager.billing.models.PaymentTerm; +import java.time.OffsetDateTime; +import java.util.Arrays; + /** - * Samples for RecipientTransfers Get. + * Samples for BillingAccounts ValidatePaymentTerms. */ -public final class RecipientTransfersGetSamples { +public final class BillingAccountsValidatePaymentTermsSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/recipientTransfersGet.json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentTermInvalid.json */ /** - * Sample code: RecipientTransferGet. + * Sample code: PaymentTermInvalid. * * @param manager Entry point to BillingManager. */ - public static void recipientTransferGet(com.azure.resourcemanager.billing.BillingManager manager) { - manager.recipientTransfers().getWithResponse("aabb123", com.azure.core.util.Context.NONE); + public static void paymentTermInvalid(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingAccounts() + .validatePaymentTermsWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + Arrays.asList(new PaymentTerm().withTerm("net10") + .withStartDate(OffsetDateTime.parse("2023-02-05T22:39:34.2606750Z")) + .withEndDate(OffsetDateTime.parse("2023-01-25T22:39:34.2606750Z"))), + com.azure.core.util.Context.NONE); } -} -``` - -### RecipientTransfers_List -```java -/** - * Samples for RecipientTransfers List. - */ -public final class RecipientTransfersListSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/recipientTransfersList.json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/paymentTermValid.json */ /** - * Sample code: RecipientTransfersList. + * Sample code: PaymentTermValid. * * @param manager Entry point to BillingManager. */ - public static void recipientTransfersList(com.azure.resourcemanager.billing.BillingManager manager) { - manager.recipientTransfers().list(com.azure.core.util.Context.NONE); + public static void paymentTermValid(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingAccounts() + .validatePaymentTermsWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + Arrays.asList(new PaymentTerm().withTerm("net10") + .withStartDate(OffsetDateTime.parse("2023-01-05T22:39:34.2606750Z")) + .withEndDate(OffsetDateTime.parse("2023-01-25T22:39:34.2606750Z"))), + com.azure.core.util.Context.NONE); } } ``` -### RecipientTransfers_Validate +### Products_ValidateMoveEligibility ```java -import com.azure.resourcemanager.billing.models.AcceptTransferRequest; -import com.azure.resourcemanager.billing.models.ProductDetails; -import com.azure.resourcemanager.billing.models.ProductType; -import java.util.Arrays; - /** - * Samples for RecipientTransfers Validate. + * Samples for BillingRoleDefinition GetByCustomer. */ -public final class RecipientTransfersValidateSamples { +public final class BillingRoleDefinitionGetByCustomerSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/recipientTransfersValidate. - * json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingRoleDefinitionGetByCustomer.json */ /** - * Sample code: ValidateTransfer. + * Sample code: BillingRoleDefinitionGetByCustomer. * * @param manager Entry point to BillingManager. */ - public static void validateTransfer(com.azure.resourcemanager.billing.BillingManager manager) { - manager.recipientTransfers() - .validateWithResponse("aabb123", - new AcceptTransferRequest().withProductDetails(Arrays.asList( - new ProductDetails().withProductType(ProductType.AZURE_SUBSCRIPTION) - .withProductId("subscriptionId"), - new ProductDetails().withProductType(ProductType.AZURE_RESERVATION) - .withProductId("reservedInstanceId"))), + public static void billingRoleDefinitionGetByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleDefinitions() + .getByCustomerWithResponse( + "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", "30000000-aaaa-bbbb-cccc-100000000000", com.azure.core.util.Context.NONE); } } ``` -### ReservationOrders_GetByBillingAccount +### RecipientTransfers_Accept ```java +import java.time.LocalDate; + /** - * Samples for ReservationOrders GetByBillingAccount. + * Samples for Invoices ListByBillingSubscription. */ -public final class ReservationOrdersGetByBillingAccountSamples { +public final class InvoicesListByBillingSubscriptionSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * reservationOrderGetByBillingAccount.json + * invoicesListByBillingSubscription.json */ /** - * Sample code: reservationOrderGetByBillingAccount. + * Sample code: InvoicesListByBillingSubscription. * * @param manager Entry point to BillingManager. */ - public static void reservationOrderGetByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.reservationOrders() - .getByBillingAccountWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "20000000-0000-0000-0000-000000000000", null, com.azure.core.util.Context.NONE); + public static void invoicesListByBillingSubscription(com.azure.resourcemanager.billing.BillingManager manager) { + manager.invoices() + .listByBillingSubscription(LocalDate.parse("2023-01-01"), LocalDate.parse("2023-06-30"), null, null, null, + null, null, null, com.azure.core.util.Context.NONE); } +} +``` + +### RecipientTransfers_Decline +```java +/** + * Samples for AvailableBalances GetByBillingAccount. + */ +public final class AvailableBalancesGetByBillingAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * reservationOrderGetByBillingAccountWithExpandPlanInformation.json + * availableBalanceGetByBillingAccount.json */ /** - * Sample code: reservationOrderGetByBillingAccountWithExpandPlanInformation. + * Sample code: AvailableBalanceGetByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void reservationOrderGetByBillingAccountWithExpandPlanInformation( - com.azure.resourcemanager.billing.BillingManager manager) { - manager.reservationOrders() + public static void availableBalanceGetByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.availableBalances() .getByBillingAccountWithResponse( "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "20000000-0000-0000-0000-000000000000", null, com.azure.core.util.Context.NONE); + com.azure.core.util.Context.NONE); } } ``` -### ReservationOrders_ListByBillingAccount +### RecipientTransfers_Get ```java /** - * Samples for ReservationOrders ListByBillingAccount. + * Samples for InvoiceSections ListByBillingProfile. */ -public final class ReservationOrdersListByBillingAccountSamples { +public final class InvoiceSectionsListByBillingProfileSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * reservationOrdersListByBillingAccount.json + * invoiceSectionsListByBillingProfile.json */ /** - * Sample code: reservationOrderListByBillingAccount. + * Sample code: InvoiceSectionsListByBillingProfile. * * @param manager Entry point to BillingManager. */ - public static void reservationOrderListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.reservationOrders() - .listByBillingAccount( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", null, null, - null, com.azure.core.util.Context.NONE); + public static void invoiceSectionsListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { + manager.invoiceSections() + .listByBillingProfile( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", true, null, null, null, null, null, null, com.azure.core.util.Context.NONE); } } ``` -### Reservations_GetByReservationOrder +### RecipientTransfers_List ```java /** - * Samples for Reservations GetByReservationOrder. + * Samples for InvoiceSections Delete. */ -public final class ReservationsGetByReservationOrderSamples { +public final class InvoiceSectionsDeleteSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * reservationGetByBillingAccountManagementGroup.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/invoiceSectionsDelete.json */ /** - * Sample code: reservationGetByBillingAccountManagementGroup. + * Sample code: InvoiceSectionsDelete. * * @param manager Entry point to BillingManager. */ - public static void - reservationGetByBillingAccountManagementGroup(com.azure.resourcemanager.billing.BillingManager manager) { - manager.reservations() - .getByReservationOrderWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", null, - com.azure.core.util.Context.NONE); + public static void invoiceSectionsDelete(com.azure.resourcemanager.billing.BillingManager manager) { + manager.invoiceSections() + .delete("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", com.azure.core.util.Context.NONE); } +} +``` + +### RecipientTransfers_Validate +```java +/** + * Samples for Invoices DownloadByBillingSubscription. + */ +public final class InvoicesDownloadByBillingSubscriptionSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * reservationGetByBillingAccount.json + * invoicesDownloadByBillingSubscription.json */ /** - * Sample code: reservationGetByBillingAccount. + * Sample code: InvoicesDownloadByBillingSubscription. * * @param manager Entry point to BillingManager. */ - public static void reservationGetByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.reservations() - .getByReservationOrderWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", null, - com.azure.core.util.Context.NONE); + public static void invoicesDownloadByBillingSubscription(com.azure.resourcemanager.billing.BillingManager manager) { + manager.invoices().downloadByBillingSubscription("E123456789", "12345678", com.azure.core.util.Context.NONE); } +} +``` + +### ReservationOrders_GetByBillingAccount +```java +import com.azure.resourcemanager.billing.fluent.models.BillingRoleAssignmentInner; +import com.azure.resourcemanager.billing.models.BillingRoleAssignmentProperties; + +/** + * Samples for BillingRoleAssignments CreateOrUpdateByBillingAccount. + */ +public final class BillingRoleAssignmentsCreateOrUpdateByBillingAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * reservationGetByBillingAccountSingleScope.json + * billingRoleAssignmentCreateOrUpdateByBillingAccount.json */ /** - * Sample code: reservationGetByBillingAccountSingleScope. + * Sample code: BillingRoleAssignmentCreateOrUpdateByBillingAccount. * * @param manager Entry point to BillingManager. */ public static void - reservationGetByBillingAccountSingleScope(com.azure.resourcemanager.billing.BillingManager manager) { - manager.reservations() - .getByReservationOrderWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", null, + billingRoleAssignmentCreateOrUpdateByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .createOrUpdateByBillingAccount("7898901", "9dfd08c2-62a3-4d47-85bd-1cdba1408402", + new BillingRoleAssignmentInner().withProperties(new BillingRoleAssignmentProperties() + .withPrincipalId("00000000-0000-0000-0000-000000000000") + .withPrincipalTenantId("076915e7-de10-4323-bb34-a58c904068bb") + .withRoleDefinitionId( + "/providers/Microsoft.Billing/billingAccounts/7898901/billingRoleDefinitions/9f1983cb-2574-400c-87e9-34cf8e2280db") + .withUserEmailAddress("john@contoso.com")), com.azure.core.util.Context.NONE); } +} +``` +### ReservationOrders_ListByBillingAccount + +```java +/** + * Samples for BillingRoleAssignments GetByBillingProfile. + */ +public final class BillingRoleAssignmentsGetByBillingProfileSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * reservationGetByBillingAccountSingleResourceGroup.json + * billingRoleAssignmentGetByBillingProfile.json */ /** - * Sample code: reservationGetByBillingAccountSingleResourceGroup. + * Sample code: BillingRoleAssignmentGetByBillingProfile. * * @param manager Entry point to BillingManager. */ public static void - reservationGetByBillingAccountSingleResourceGroup(com.azure.resourcemanager.billing.BillingManager manager) { - manager.reservations() - .getByReservationOrderWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", null, + billingRoleAssignmentGetByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .getByBillingProfileWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", + "xxxx-xxxx-xxx-xxx", "10000000-aaaa-bbbb-cccc-100000000000_6fd330f6-7d26-4aff-b9cf-7bd699f965b9", com.azure.core.util.Context.NONE); } } ``` -### Reservations_ListByBillingAccount +### Reservations_GetByReservationOrder ```java /** - * Samples for Reservations ListByBillingAccount. + * Samples for BillingRoleAssignments ListByDepartment. */ -public final class ReservationsListByBillingAccountSamples { +public final class BillingRoleAssignmentsListByDepartmentSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * reservationsListByBillingAccount.json + * billingRoleAssignmentListByDepartment.json */ /** - * Sample code: reservationsListByBillingAccount. + * Sample code: BillingRoleAssignmentListByDepartment. * * @param manager Entry point to BillingManager. */ - public static void reservationsListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.reservations() - .listByBillingAccount( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", null, null, - null, "true", "Succeeded", null, com.azure.core.util.Context.NONE); + public static void billingRoleAssignmentListByDepartment(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .listByDepartment("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", + "12345", com.azure.core.util.Context.NONE); } } ``` -### Reservations_ListByBillingProfile +### Reservations_ListByBillingAccount ```java /** - * Samples for Reservations ListByBillingProfile. + * Samples for BillingSubscriptionsAliases Get. */ -public final class ReservationsListByBillingProfileSamples { +public final class BillingSubscriptionsAliasesGetSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * reservationsListByBillingProfile.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingSubscriptionAliasGet. + * json */ /** - * Sample code: ReservationsListByBillingProfile. + * Sample code: BillingSubscriptionAliasGet. * * @param manager Entry point to BillingManager. */ - public static void reservationsListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { - manager.reservations() - .listByBillingProfile( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "AAAA-AAAA-AAA-AAA", null, null, null, "true", "Succeeded", null, com.azure.core.util.Context.NONE); + public static void billingSubscriptionAliasGet(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingSubscriptionsAliases() + .getWithResponse("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "c356b7c7-7545-4686-b843-c1a49cf853fc", com.azure.core.util.Context.NONE); } } ``` -### Reservations_ListByReservationOrder +### Reservations_ListByBillingProfile ```java /** - * Samples for Reservations ListByReservationOrder. + * Samples for PartnerTransfers Get. */ -public final class ReservationsListByReservationOrderSamples { +public final class PartnerTransfersGetSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * reservationsGetFromOrderByBillingAccount.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/partnerTransfersGet.json */ /** - * Sample code: reservationsGetFromOrderByBillingAccount. + * Sample code: PartnerTransferGet. * * @param manager Entry point to BillingManager. */ - public static void - reservationsGetFromOrderByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { - manager.reservations() - .listByReservationOrder( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "20000000-0000-0000-0000-000000000000", com.azure.core.util.Context.NONE); + public static void partnerTransferGet(com.azure.resourcemanager.billing.BillingManager manager) { + manager.partnerTransfers() + .getWithResponse("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", "11111111-1111-1111-1111-111111111111", "aabb123", + com.azure.core.util.Context.NONE); } } ``` -### Reservations_UpdateByBillingAccount +### Reservations_ListByReservationOrder ```java -import com.azure.resourcemanager.billing.models.PatchModel; - /** - * Samples for Reservations UpdateByBillingAccount. + * Samples for BillingSubscriptions ListByEnrollmentAccount. */ -public final class ReservationsUpdateByBillingAccountSamples { +public final class BillingSubscriptionsListByEnrollmentAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * reservationUpdateByBillingAccount.json + * billingSubscriptionsListByEnrollmentAccount.json */ /** - * Sample code: ReservationUpdate. + * Sample code: BillingSubscriptionsListByEnrollmentAccount. * * @param manager Entry point to BillingManager. */ - public static void reservationUpdate(com.azure.resourcemanager.billing.BillingManager manager) { - manager.reservations() - .updateByBillingAccount( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", - new PatchModel().withDisplayName("NewName"), com.azure.core.util.Context.NONE); + public static void + billingSubscriptionsListByEnrollmentAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingSubscriptions() + .listByEnrollmentAccount("6564892", "172988", null, null, null, null, null, null, + com.azure.core.util.Context.NONE); } } ``` -### SavingsPlanOrders_GetByBillingAccount +### Reservations_UpdateByBillingAccount ```java /** - * Samples for SavingsPlanOrders GetByBillingAccount. + * Samples for Customers ListByBillingAccount. */ -public final class SavingsPlanOrdersGetByBillingAccountSamples { +public final class CustomersListByBillingAccountSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * savingsPlanOrderGetByBillingAccount.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/customersListByBillingAccount + * .json */ /** - * Sample code: SavingsPlanOrderGet. + * Sample code: CustomersListByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void savingsPlanOrderGet(com.azure.resourcemanager.billing.BillingManager manager) { - manager.savingsPlanOrders() - .getByBillingAccountWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "20000000-0000-0000-0000-000000000000", null, com.azure.core.util.Context.NONE); + public static void customersListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.customers() + .listByBillingAccount( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", null, null, + null, null, null, null, null, com.azure.core.util.Context.NONE); } /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * savingsPlanOrderExpandedScheduleGetByBillingAccount.json + * customersListByBillingAccountWithExpand.json */ /** - * Sample code: SavingsPlanOrderWithExpandedPaymentsGet. + * Sample code: CustomersListByBillingAccountWithExpand. * * @param manager Entry point to BillingManager. */ public static void - savingsPlanOrderWithExpandedPaymentsGet(com.azure.resourcemanager.billing.BillingManager manager) { - manager.savingsPlanOrders() - .getByBillingAccountWithResponse( + customersListByBillingAccountWithExpand(com.azure.resourcemanager.billing.BillingManager manager) { + manager.customers() + .listByBillingAccount( "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "20000000-0000-0000-0000-000000000000", null, com.azure.core.util.Context.NONE); + "enabledAzurePlans,resellers", null, null, null, null, null, null, com.azure.core.util.Context.NONE); } } ``` -### SavingsPlanOrders_ListByBillingAccount +### SavingsPlanOrders_GetByBillingAccount ```java /** - * Samples for SavingsPlanOrders ListByBillingAccount. + * Samples for Transactions ListByInvoice. */ -public final class SavingsPlanOrdersListByBillingAccountSamples { +public final class TransactionsListByInvoiceSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * savingsPlanOrderListByBillingAccount.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/transactionsListByInvoice. + * json */ /** - * Sample code: SavingsPlanOrderList. + * Sample code: TransactionsListByInvoice. * * @param manager Entry point to BillingManager. */ - public static void savingsPlanOrderList(com.azure.resourcemanager.billing.BillingManager manager) { - manager.savingsPlanOrders() - .listByBillingAccount( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", null, null, - null, com.azure.core.util.Context.NONE); + public static void transactionsListByInvoice(com.azure.resourcemanager.billing.BillingManager manager) { + manager.transactions() + .listByInvoice("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "G123456789", null, null, null, null, null, null, com.azure.core.util.Context.NONE); } } ``` -### SavingsPlans_GetByBillingAccount +### SavingsPlanOrders_ListByBillingAccount ```java /** - * Samples for SavingsPlans GetByBillingAccount. + * Samples for BillingRequests ListByInvoiceSection. */ -public final class SavingsPlansGetByBillingAccountSamples { +public final class BillingRequestsListByInvoiceSectionSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * savingsPlanGetByBillingAccount.json + * billingRequestsListByInvoiceSection.json */ /** - * Sample code: SavingsPlanGet. + * Sample code: BillingRequestsListByInvoiceSection. * * @param manager Entry point to BillingManager. */ - public static void savingsPlanGet(com.azure.resourcemanager.billing.BillingManager manager) { - manager.savingsPlans() - .getByBillingAccountWithResponse( + public static void billingRequestsListByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRequests() + .listByInvoiceSection( "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", null, + "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", null, null, null, null, null, null, com.azure.core.util.Context.NONE); } +} +``` + +### SavingsPlans_GetByBillingAccount + +```java +import com.azure.resourcemanager.billing.models.BillingRoleAssignmentProperties; +/** + * Samples for BillingRoleAssignments CreateByInvoiceSection. + */ +public final class BillingRoleAssignmentsCreateByInvoiceSectionSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * savingsPlanGetExpandRenewPropertiesByBillingAccount.json + * billingRoleAssignmentCreateByInvoiceSection.json */ /** - * Sample code: SavingsPlanGetExpandRenewProperties. + * Sample code: BillingRoleAssignmentCreateByInvoiceSection. * * @param manager Entry point to BillingManager. */ - public static void savingsPlanGetExpandRenewProperties(com.azure.resourcemanager.billing.BillingManager manager) { - manager.savingsPlans() - .getByBillingAccountWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", null, + public static void + billingRoleAssignmentCreateByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments() + .createByInvoiceSection( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30", + "BKM6-54VH-BG7-PGB", "xxxx-xxxx-xxx-xxx", + new BillingRoleAssignmentProperties().withPrincipalId("00000000-0000-0000-0000-000000000000") + .withPrincipalTenantId("076915e7-de10-4323-bb34-a58c904068bb") + .withRoleDefinitionId( + "/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2018-09-30/billingProfiles/BKM6-54VH-BG7-PGB/invoiceSections/xxxx-xxxx-xxx-xxx/billingRoleDefinitions/10000000-aaaa-bbbb-cccc-100000000000") + .withUserEmailAddress("john@contoso.com"), com.azure.core.util.Context.NONE); } } @@ -5417,23 +5411,23 @@ public final class SavingsPlansGetByBillingAccountSamples { ```java /** - * Samples for SavingsPlans ListByBillingAccount. + * Samples for AvailableBalances GetByBillingProfile. */ -public final class SavingsPlansListByBillingAccountSamples { +public final class AvailableBalancesGetByBillingProfileSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * savingsPlansListByBillingAccount.json + * availableBalanceGetByBillingProfile.json */ /** - * Sample code: SavingsPlansList. + * Sample code: AvailableBalanceGetByBillingProfile. * * @param manager Entry point to BillingManager. */ - public static void savingsPlansList(com.azure.resourcemanager.billing.BillingManager manager) { - manager.savingsPlans() - .listByBillingAccount( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", null, null, - null, 3.0F, "Succeeded", "true", com.azure.core.util.Context.NONE); + public static void availableBalanceGetByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { + manager.availableBalances() + .getByBillingProfileWithResponse( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", com.azure.core.util.Context.NONE); } } ``` @@ -5442,23 +5436,46 @@ public final class SavingsPlansListByBillingAccountSamples { ```java /** - * Samples for SavingsPlans ListBySavingsPlanOrder. + * Samples for BillingProperty Get. */ -public final class SavingsPlansListBySavingsPlanOrderSamples { +public final class BillingPropertyGetSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * savingsPlansListBySavingsPlanOrders.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingPropertyGetMCA.json */ /** - * Sample code: SavingsPlansInOrderList. + * Sample code: BillingPropertyGetMCA. * * @param manager Entry point to BillingManager. */ - public static void savingsPlansInOrderList(com.azure.resourcemanager.billing.BillingManager manager) { - manager.savingsPlans() - .listBySavingsPlanOrder( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "20000000-0000-0000-0000-000000000000", com.azure.core.util.Context.NONE); + public static void billingPropertyGetMCA(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingProperties().getWithResponse(null, null, com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingPropertyGetMOSP.json + */ + /** + * Sample code: BillingPropertyGetMOSP. + * + * @param manager Entry point to BillingManager. + */ + public static void billingPropertyGetMOSP(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingProperties().getWithResponse(null, null, com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingPropertyGetMPA.json + */ + /** + * Sample code: BillingPropertyGetMPA. + * + * @param manager Entry point to BillingManager. + */ + public static void billingPropertyGetMPA(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingProperties().getWithResponse(null, null, com.azure.core.util.Context.NONE); } } ``` @@ -5466,57 +5483,28 @@ public final class SavingsPlansListBySavingsPlanOrderSamples { ### SavingsPlans_UpdateByBillingAccount ```java -import com.azure.resourcemanager.billing.models.AppliedScopeProperties; -import com.azure.resourcemanager.billing.models.AppliedScopeType; -import com.azure.resourcemanager.billing.models.BillingPlan; -import com.azure.resourcemanager.billing.models.Commitment; -import com.azure.resourcemanager.billing.models.CommitmentGrain; -import com.azure.resourcemanager.billing.models.PurchaseRequest; -import com.azure.resourcemanager.billing.models.RenewProperties; -import com.azure.resourcemanager.billing.models.SavingsPlanTerm; -import com.azure.resourcemanager.billing.models.SavingsPlanUpdateRequest; -import com.azure.resourcemanager.billing.models.SavingsPlanUpdateRequestProperties; -import com.azure.resourcemanager.billing.models.Sku; +import com.azure.resourcemanager.billing.models.CheckAccessRequest; +import java.util.Arrays; /** - * Samples for SavingsPlans UpdateByBillingAccount. + * Samples for BillingPermissions CheckAccessByEnrollmentAccount. */ -public final class SavingsPlansUpdateByBillingAccountSamples { +public final class BillingPermissionsCheckAccessByEnrollmentAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * savingsPlanUpdateByBillingAccount.json + * checkAccessByEnrollmentAccount.json */ /** - * Sample code: SavingsPlanUpdate. + * Sample code: CheckAccessByEnrollmentAccount. * * @param manager Entry point to BillingManager. */ - public static void savingsPlanUpdate(com.azure.resourcemanager.billing.BillingManager manager) { - manager.savingsPlans() - .updateByBillingAccount( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", - new SavingsPlanUpdateRequest() - .withProperties( - new SavingsPlanUpdateRequestProperties().withDisplayName("sp_newName") - .withAppliedScopeType(AppliedScopeType.MANAGEMENT_GROUP) - .withAppliedScopeProperties(new AppliedScopeProperties() - .withTenantId("80000000-0000-0000-0000-000000000000") - .withManagementGroupId("/providers/Microsoft.Management/managementGroups/mg1")) - .withRenew(true) - .withRenewProperties(new RenewProperties().withPurchaseProperties(new PurchaseRequest() - .withSku(new Sku().withName("Compute_Savings_Plan")) - .withDisplayName("sp_newName_renewed") - .withBillingScopeId("/subscriptions/50000000-0000-0000-0000-000000000000") - .withTerm(SavingsPlanTerm.P3Y) - .withBillingPlan(BillingPlan.P1M) - .withAppliedScopeType(AppliedScopeType.MANAGEMENT_GROUP) - .withCommitment(new Commitment().withCurrencyCode("fakeTokenPlaceholder") - .withAmount(0.001D) - .withGrain(CommitmentGrain.HOURLY)) - .withAppliedScopeProperties(new AppliedScopeProperties() - .withTenantId("80000000-0000-0000-0000-000000000000") - .withManagementGroupId("/providers/Microsoft.Management/managementGroups/mg1"))))), + public static void checkAccessByEnrollmentAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingPermissions() + .checkAccessByEnrollmentAccountWithResponse( + "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "123456", + new CheckAccessRequest().withActions(Arrays.asList("Microsoft.Billing/billingAccounts/read", + "Microsoft.Subscription/subscriptions/write")), com.azure.core.util.Context.NONE); } } @@ -5525,35 +5513,21 @@ public final class SavingsPlansUpdateByBillingAccountSamples { ### SavingsPlans_ValidateUpdateByBillingAccount ```java -import com.azure.resourcemanager.billing.models.AppliedScopeProperties; -import com.azure.resourcemanager.billing.models.AppliedScopeType; -import com.azure.resourcemanager.billing.models.SavingsPlanUpdateRequestProperties; -import com.azure.resourcemanager.billing.models.SavingsPlanUpdateValidateRequest; -import java.util.Arrays; - /** - * Samples for SavingsPlans ValidateUpdateByBillingAccount. + * Samples for BillingRoleDefinition ListByDepartment. */ -public final class SavingsPlansValidateUpdateByBillingAccountSamples { +public final class BillingRoleDefinitionListByDepartmentSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * savingsPlanValidateUpdateByBillingAccount.json + * billingRoleDefinitionListByDepartment.json */ /** - * Sample code: SavingsPlanValidateUpdate. + * Sample code: BillingRoleDefinitionListByDepartment. * * @param manager Entry point to BillingManager. */ - public static void savingsPlanValidateUpdate(com.azure.resourcemanager.billing.BillingManager manager) { - manager.savingsPlans() - .validateUpdateByBillingAccountWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "20000000-0000-0000-0000-000000000000", "30000000-0000-0000-0000-000000000000", - new SavingsPlanUpdateValidateRequest().withBenefits( - Arrays.asList(new SavingsPlanUpdateRequestProperties().withAppliedScopeType(AppliedScopeType.SINGLE) - .withAppliedScopeProperties(new AppliedScopeProperties() - .withSubscriptionId("/subscriptions/50000000-0000-0000-0000-000000000000")))), - com.azure.core.util.Context.NONE); + public static void billingRoleDefinitionListByDepartment(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleDefinitions().listByDepartment("123456", "7368531", com.azure.core.util.Context.NONE); } } ``` @@ -5561,24 +5535,50 @@ public final class SavingsPlansValidateUpdateByBillingAccountSamples { ### Transactions_GetTransactionSummaryByInvoice ```java +import com.azure.resourcemanager.billing.fluent.models.BillingRequestInner; +import com.azure.resourcemanager.billing.models.BillingRequestProperties; +import com.azure.resourcemanager.billing.models.BillingRequestStatus; +import com.azure.resourcemanager.billing.models.BillingRequestType; +import java.util.HashMap; +import java.util.Map; + /** - * Samples for Transactions GetTransactionSummaryByInvoice. + * Samples for BillingRequests CreateOrUpdate. */ -public final class TransactionsGetTransactionSummaryByInvoiceSamples { +public final class BillingRequestsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * transactionSummaryGetByInvoice.json + * x-ms-original-file: + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/billingRequestsCreateOrUpdate + * .json */ /** - * Sample code: TransactionSummaryGetByInvoice. + * Sample code: BillingRequestsCreateOrUpdate. * * @param manager Entry point to BillingManager. */ - public static void transactionSummaryGetByInvoice(com.azure.resourcemanager.billing.BillingManager manager) { - manager.transactions() - .getTransactionSummaryByInvoiceWithResponse( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "G123456789", - null, null, com.azure.core.util.Context.NONE); + public static void billingRequestsCreateOrUpdate(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRequests() + .createOrUpdate("00000000-0000-0000-0000-000000000000", + new BillingRequestInner().withProperties(new BillingRequestProperties() + .withAdditionalInformation(mapOf("RoleId", "40000000-aaaa-bbbb-cccc-200000000006")) + .withDecisionReason("New team member") + .withRequestScope( + "/providers/Microsoft.Billing/billingAccounts/00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31/billingProfiles/xxxx-xxxx-xxx-xxx") + .withStatus(BillingRequestStatus.PENDING) + .withType(BillingRequestType.ROLE_ASSIGNMENT)), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; } } ``` @@ -5586,29 +5586,31 @@ public final class TransactionsGetTransactionSummaryByInvoiceSamples { ### Transactions_ListByBillingProfile ```java -import com.azure.resourcemanager.billing.models.TransactionType; -import java.time.LocalDate; +import com.azure.resourcemanager.billing.fluent.models.CustomerPolicyInner; +import com.azure.resourcemanager.billing.models.CustomerPolicyProperties; +import com.azure.resourcemanager.billing.models.ViewChargesPolicy; /** - * Samples for Transactions ListByBillingProfile. + * Samples for Policies CreateOrUpdateByCustomerAtBillingAccount. */ -public final class TransactionsListByBillingProfileSamples { +public final class PoliciesCreateOrUpdateByCustomerAtBillingAccountSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * transactionsListByBillingProfile.json + * policiesPutByCustomerAtBillingAccount.json */ /** - * Sample code: TransactionsListByBillingProfile. + * Sample code: PoliciesPutByCustomerAtBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void transactionsListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { - manager.transactions() - .listByBillingProfile( + public static void policiesPutByCustomerAtBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.policies() + .createOrUpdateByCustomerAtBillingAccount( "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", LocalDate.parse("2024-04-01"), LocalDate.parse("2023-05-30"), - TransactionType.BILLED, "properties/date gt '2020-10-01'", "properties/date", null, null, null, - "storage", com.azure.core.util.Context.NONE); + "11111111-1111-1111-1111-111111111111", + new CustomerPolicyInner() + .withProperties(new CustomerPolicyProperties().withViewCharges(ViewChargesPolicy.ALLOWED)), + com.azure.core.util.Context.NONE); } } ``` @@ -5616,29 +5618,34 @@ public final class TransactionsListByBillingProfileSamples { ### Transactions_ListByCustomer ```java -import com.azure.resourcemanager.billing.models.TransactionType; -import java.time.LocalDate; +import com.azure.resourcemanager.billing.models.AcceptTransferRequest; +import com.azure.resourcemanager.billing.models.ProductDetails; +import com.azure.resourcemanager.billing.models.ProductType; +import java.util.Arrays; /** - * Samples for Transactions ListByCustomer. + * Samples for RecipientTransfers Validate. */ -public final class TransactionsListByCustomerSamples { +public final class RecipientTransfersValidateSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/transactionsListByCustomer. + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/recipientTransfersValidate. * json */ /** - * Sample code: TransactionsListByCustomer. + * Sample code: ValidateTransfer. * * @param manager Entry point to BillingManager. */ - public static void transactionsListByCustomer(com.azure.resourcemanager.billing.BillingManager manager) { - manager.transactions() - .listByCustomer("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "22000000-0000-0000-0000-000000000000", LocalDate.parse("2024-04-01"), - LocalDate.parse("2023-05-30"), TransactionType.BILLED, "properties/date gt '2020-10-01'", - "properties/date", null, null, null, "storage", com.azure.core.util.Context.NONE); + public static void validateTransfer(com.azure.resourcemanager.billing.BillingManager manager) { + manager.recipientTransfers() + .validateWithResponse("aabb123", + new AcceptTransferRequest().withProductDetails(Arrays.asList( + new ProductDetails().withProductType(ProductType.AZURE_SUBSCRIPTION) + .withProductId("subscriptionId"), + new ProductDetails().withProductType(ProductType.AZURE_RESERVATION) + .withProductId("reservedInstanceId"))), + com.azure.core.util.Context.NONE); } } ``` @@ -5647,23 +5654,20 @@ public final class TransactionsListByCustomerSamples { ```java /** - * Samples for Transactions ListByInvoice. + * Samples for Departments Get. */ -public final class TransactionsListByInvoiceSamples { +public final class DepartmentsGetSamples { /* * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/transactionsListByInvoice. - * json + * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/departmentGet.json */ /** - * Sample code: TransactionsListByInvoice. + * Sample code: DepartmentGet. * * @param manager Entry point to BillingManager. */ - public static void transactionsListByInvoice(com.azure.resourcemanager.billing.BillingManager manager) { - manager.transactions() - .listByInvoice("00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "G123456789", null, null, null, null, null, null, com.azure.core.util.Context.NONE); + public static void departmentGet(com.azure.resourcemanager.billing.BillingManager manager) { + manager.departments().getWithResponse("456598", "164821", com.azure.core.util.Context.NONE); } } ``` @@ -5671,29 +5675,24 @@ public final class TransactionsListByInvoiceSamples { ### Transactions_ListByInvoiceSection ```java -import com.azure.resourcemanager.billing.models.TransactionType; -import java.time.LocalDate; - /** - * Samples for Transactions ListByInvoiceSection. + * Samples for PaymentMethods ListByBillingProfile. */ -public final class TransactionsListByInvoiceSectionSamples { +public final class PaymentMethodsListByBillingProfileSamples { /* * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ - * transactionsListByInvoiceSection.json + * paymentMethodsListByBillingProfile.json */ /** - * Sample code: TransactionsListByInvoiceSection. + * Sample code: PaymentMethodsListByBillingProfile. * * @param manager Entry point to BillingManager. */ - public static void transactionsListByInvoiceSection(com.azure.resourcemanager.billing.BillingManager manager) { - manager.transactions() - .listByInvoiceSection( - "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "22000000-0000-0000-0000-000000000000", LocalDate.parse("2024-04-01"), - LocalDate.parse("2023-05-30"), TransactionType.BILLED, "properties/date gt '2020-10-01'", - "properties/date", null, null, null, "storage", com.azure.core.util.Context.NONE); + public static void paymentMethodsListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { + manager.paymentMethods() + .listByBillingProfile( + "00000000-0000-0000-0000-000000000032:00000000-0000-0000-0000-000000000099_2019-05-31", + "ABC1-A1CD-AB1-BP1", com.azure.core.util.Context.NONE); } } ``` @@ -5702,24 +5701,23 @@ public final class TransactionsListByInvoiceSectionSamples { ```java /** - * Samples for Transactions TransactionsDownloadByInvoice. + * Samples for Invoices DownloadByBillingAccount. */ -public final class TransactionsTransactionsDownloadByInvoiceSamples { +public final class InvoicesDownloadByBillingAccountSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/transactionsDownloadByInvoice - * .json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * invoicesDownloadByBillingAccount.json */ /** - * Sample code: TransactionsDownloadByInvoice. + * Sample code: InvoicesDownloadByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void transactionsDownloadByInvoice(com.azure.resourcemanager.billing.BillingManager manager) { - manager.transactions() - .transactionsDownloadByInvoice( + public static void invoicesDownloadByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.invoices() + .downloadByBillingAccount( "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", "G123456789", - com.azure.core.util.Context.NONE); + "12345678", com.azure.core.util.Context.NONE); } } ``` @@ -5728,22 +5726,24 @@ public final class TransactionsTransactionsDownloadByInvoiceSamples { ```java /** - * Samples for Transfers Cancel. + * Samples for BillingAccounts ListInvoiceSectionsByCreateSubscriptionPermission. */ -public final class TransfersCancelSamples { +public final class BillingAccountsListInvoiceSectionsByCreateSubscriptionPermissionSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/transfersCancel.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * invoiceSectionsWithCreateSubscriptionPermissionList.json */ /** - * Sample code: TransferCancel. + * Sample code: InvoiceSectionsWithCreateSubscriptionPermissionList. * * @param manager Entry point to BillingManager. */ - public static void transferCancel(com.azure.resourcemanager.billing.BillingManager manager) { - manager.transfers() - .cancelWithResponse("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", "aabb123", com.azure.core.util.Context.NONE); + public static void + invoiceSectionsWithCreateSubscriptionPermissionList(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingAccounts() + .listInvoiceSectionsByCreateSubscriptionPermission( + "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", null, + com.azure.core.util.Context.NONE); } } ``` @@ -5751,23 +5751,29 @@ public final class TransfersCancelSamples { ### Transfers_Get ```java +import com.azure.resourcemanager.billing.models.TransactionType; +import java.time.LocalDate; + /** - * Samples for Transfers Get. + * Samples for Transactions ListByBillingProfile. */ -public final class TransfersGetSamples { +public final class TransactionsListByBillingProfileSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/transfersGet.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * transactionsListByBillingProfile.json */ /** - * Sample code: TransferGet. + * Sample code: TransactionsListByBillingProfile. * * @param manager Entry point to BillingManager. */ - public static void transferGet(com.azure.resourcemanager.billing.BillingManager manager) { - manager.transfers() - .getWithResponse("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", "aabb123", com.azure.core.util.Context.NONE); + public static void transactionsListByBillingProfile(com.azure.resourcemanager.billing.BillingManager manager) { + manager.transactions() + .listByBillingProfile( + "00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", + "xxxx-xxxx-xxx-xxx", LocalDate.parse("2024-04-01"), LocalDate.parse("2023-05-30"), + TransactionType.BILLED, "properties/date gt '2020-10-01'", "properties/date", null, null, null, + "storage", com.azure.core.util.Context.NONE); } } ``` @@ -5775,28 +5781,22 @@ public final class TransfersGetSamples { ### Transfers_Initiate ```java -import com.azure.resourcemanager.billing.models.InitiateTransferRequest; - /** - * Samples for Transfers Initiate. + * Samples for BillingRoleAssignments ListByEnrollmentAccount. */ -public final class TransfersInitiateSamples { +public final class BillingRoleAssignmentsListByEnrollmentAccountSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/transfersInitiate.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * billingRoleAssignmentListByEnrollmentAccount.json */ /** - * Sample code: InitiateTransfer. + * Sample code: BillingRoleAssignmentListByEnrollmentAccount. * * @param manager Entry point to BillingManager. */ - public static void initiateTransfer(com.azure.resourcemanager.billing.BillingManager manager) { - manager.transfers() - .initiateWithResponse( - "10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", "aabb123", - new InitiateTransferRequest().withRecipientEmailId("user@contoso.com"), - com.azure.core.util.Context.NONE); + public static void + billingRoleAssignmentListByEnrollmentAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.billingRoleAssignments().listByEnrollmentAccount("6100092", "123456", com.azure.core.util.Context.NONE); } } ``` @@ -5805,22 +5805,22 @@ public final class TransfersInitiateSamples { ```java /** - * Samples for Transfers List. + * Samples for EnrollmentAccounts ListByBillingAccount. */ -public final class TransfersListSamples { +public final class EnrollmentAccountsListByBillingAccountSamples { /* - * x-ms-original-file: - * specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/transfersList.json + * x-ms-original-file: specification/billing/resource-manager/Microsoft.Billing/stable/2024-04-01/examples/ + * enrollmentAccountsListByBillingAccount.json */ /** - * Sample code: TransfersList. + * Sample code: EnrollmentAccountsListByBillingAccount. * * @param manager Entry point to BillingManager. */ - public static void transfersList(com.azure.resourcemanager.billing.BillingManager manager) { - manager.transfers() - .list("10000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000_2019-05-31", - "xxxx-xxxx-xxx-xxx", "yyyy-yyyy-yyy-yyy", com.azure.core.util.Context.NONE); + public static void + enrollmentAccountsListByBillingAccount(com.azure.resourcemanager.billing.BillingManager manager) { + manager.enrollmentAccounts() + .listByBillingAccount("6564892", null, null, null, null, null, null, com.azure.core.util.Context.NONE); } } ``` diff --git a/sdk/billing/azure-resourcemanager-billing/pom.xml b/sdk/billing/azure-resourcemanager-billing/pom.xml index 8279d8aa5158..de8f4cb52c3f 100644 --- a/sdk/billing/azure-resourcemanager-billing/pom.xml +++ b/sdk/billing/azure-resourcemanager-billing/pom.xml @@ -45,13 +45,9 @@ UTF-8 0 0 + true - - com.azure - azure-json - 1.5.0 - com.azure azure-core @@ -62,6 +58,11 @@ azure-core-management 1.17.0 + + com.azure + azure-json + 1.5.0 + com.azure azure-core-test 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 index a9cb8b8fc9e4..d8f82bbb641b 100644 --- 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 @@ -11,17 +11,18 @@ import com.azure.core.http.HttpPipelinePosition; import com.azure.core.http.policy.AddDatePolicy; import com.azure.core.http.policy.AddHeadersFromContextPolicy; -import com.azure.core.http.policy.HttpLoggingPolicy; +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.RetryOptions; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.billing.fluent.BillingManagementClient; import com.azure.resourcemanager.billing.implementation.AddressImpl; @@ -71,8 +72,8 @@ import com.azure.resourcemanager.billing.models.Customers; import com.azure.resourcemanager.billing.models.Departments; import com.azure.resourcemanager.billing.models.EnrollmentAccounts; -import com.azure.resourcemanager.billing.models.Invoices; 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.PartnerTransfers; import com.azure.resourcemanager.billing.models.PaymentMethods; @@ -89,6 +90,7 @@ import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; @@ -209,6 +211,9 @@ public static Configurable configure() { */ public static final class Configurable { private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-billing.properties"); private HttpClient httpClient; private HttpLogOptions httpLogOptions; @@ -316,12 +321,14 @@ public BillingManager authenticate(TokenCredential credential, AzureProfile prof Objects.requireNonNull(credential, "'credential' cannot be null."); Objects.requireNonNull(profile, "'profile' cannot be null."); + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + StringBuilder userAgentBuilder = new StringBuilder(); userAgentBuilder.append("azsdk-java") .append("-") .append("com.azure.resourcemanager.billing") .append("/") - .append("1.0.0"); + .append(clientVersion); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version")) @@ -354,7 +361,7 @@ public BillingManager authenticate(TokenCredential credential, AzureProfile prof HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new AddDatePolicy()); - policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); policies.addAll(this.policies.stream() .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) .collect(Collectors.toList())); diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingSubscriptionAliasInner.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingSubscriptionAliasInner.java index e959191adbf0..18044fbbeadb 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingSubscriptionAliasInner.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingSubscriptionAliasInner.java @@ -475,7 +475,7 @@ public NextBillingCycleDetails nextBillingCycleDetails() { /** * Get the offerId property: The offer ID for the subscription. This field is only available for the Microsoft - * Online Services Program billing accounts. + * Online Services Program billing accounts or billing accounts with agreement type Enterprise Agreement. * * @return the offerId value. */ diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingSubscriptionAliasProperties.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingSubscriptionAliasProperties.java index bc05c76bceb2..2d6483409243 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingSubscriptionAliasProperties.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingSubscriptionAliasProperties.java @@ -117,7 +117,7 @@ public final class BillingSubscriptionAliasProperties extends BillingSubscriptio /* * The offer ID for the subscription. This field is only available for the Microsoft Online Services Program billing - * accounts. + * accounts or billing accounts with agreement type Enterprise Agreement. */ private String offerId; @@ -367,7 +367,7 @@ public String productCategory() { /** * Get the offerId property: The offer ID for the subscription. This field is only available for the Microsoft - * Online Services Program billing accounts. + * Online Services Program billing accounts or billing accounts with agreement type Enterprise Agreement. * * @return the offerId value. */ 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 index b70644fcbabe..d740c351a57c 100644 --- 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 @@ -446,7 +446,7 @@ public NextBillingCycleDetails nextBillingCycleDetails() { /** * Get the offerId property: The offer ID for the subscription. This field is only available for the Microsoft - * Online Services Program billing accounts. + * Online Services Program billing accounts or billing accounts with agreement type Enterprise Agreement. * * @return the offerId value. */ diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingSubscriptionProperties.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingSubscriptionProperties.java index 242ee07573d0..4bd810575693 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingSubscriptionProperties.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/fluent/models/BillingSubscriptionProperties.java @@ -150,7 +150,7 @@ public class BillingSubscriptionProperties implements JsonSerializable> validate(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @BodyParam("application/json") AddressDetails parameters, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/validateAddress") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response validateSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @BodyParam("application/json") AddressDetails parameters, + @HeaderParam("Accept") String accept, Context context); } /** @@ -93,33 +102,6 @@ private Mono> validateWithResponseAsync .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 parameters 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 along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> validateWithResponseAsync(AddressDetails parameters, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.validate(this.client.getEndpoint(), this.client.getApiVersion(), parameters, accept, context); - } - /** * Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address. * @@ -146,7 +128,20 @@ private Mono validateAsync(AddressDetails parame */ @ServiceMethod(returns = ReturnType.SINGLE) public Response validateWithResponse(AddressDetails parameters, Context context) { - return validateWithResponseAsync(parameters, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.validateSync(this.client.getEndpoint(), this.client.getApiVersion(), parameters, accept, + context); } /** @@ -162,4 +157,6 @@ public Response validateWithResponse(AddressDeta public AddressValidationResponseInner validate(AddressDetails parameters) { return validateWithResponse(parameters, Context.NONE).getValue(); } + + private static final ClientLogger LOGGER = new ClientLogger(AddressClientImpl.class); } 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 index a562a59b39ee..30d2bd8874ee 100644 --- 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 @@ -25,6 +25,7 @@ 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; @@ -71,6 +72,15 @@ Mono> get(@HostParam("$host") String endpoint, @PathParam("agreementName") String agreementName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements/{agreementName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("agreementName") String agreementName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements") @ExpectedResponses({ 200 }) @@ -79,6 +89,14 @@ Mono> listByBillingAccount(@HostParam("$host") Str @PathParam("billingAccountName") String billingAccountName, @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}/agreements") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @QueryParam("api-version") String apiVersion, + @QueryParam("expand") String expand, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -86,6 +104,14 @@ Mono> listByBillingAccount(@HostParam("$host") Str 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) + Response listByBillingAccountNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -118,37 +144,6 @@ private Mono> getWithResponseAsync(String billingAccoun .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 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 along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String billingAccountName, String agreementName, - 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), billingAccountName, agreementName, this.client.getApiVersion(), - accept, context); - } - /** * Gets an agreement by ID. * @@ -177,7 +172,22 @@ private Mono getAsync(String billingAccountName, String agreemen */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String billingAccountName, String agreementName, Context context) { - return getWithResponseAsync(billingAccountName, agreementName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (agreementName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter agreementName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), billingAccountName, agreementName, + this.client.getApiVersion(), accept, context); } /** @@ -231,45 +241,29 @@ private Mono> listByBillingAccountSinglePageAsync( * * @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 a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources as paginated response with {@link PagedFlux}. */ - @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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingAccount(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), expand, - accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @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. - * @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 a container for a list of resources as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName, String expand) { + private PagedFlux listByBillingAccountAsync(String billingAccountName) { + final String expand = null; return new PagedFlux<>(() -> listByBillingAccountSinglePageAsync(billingAccountName, expand), nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); } @@ -278,16 +272,28 @@ private PagedFlux listByBillingAccountAsync(String billingAccoun * 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 a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName) { - final String expand = null; - return new PagedFlux<>(() -> listByBillingAccountSinglePageAsync(billingAccountName, expand), - nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, String expand) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingAccountSync(this.client.getEndpoint(), + billingAccountName, this.client.getApiVersion(), expand, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -299,13 +305,25 @@ private PagedFlux listByBillingAccountAsync(String billingAccoun * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName, String expand, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, String expand, Context context) { - return new PagedFlux<>(() -> listByBillingAccountSinglePageAsync(billingAccountName, expand, context), - nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingAccountSync(this.client.getEndpoint(), + billingAccountName, this.client.getApiVersion(), expand, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -320,7 +338,8 @@ private PagedFlux listByBillingAccountAsync(String billingAccoun @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingAccount(String billingAccountName) { final String expand = null; - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, expand)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, expand), + nextLink -> listByBillingAccountNextSinglePage(nextLink)); } /** @@ -337,7 +356,8 @@ public PagedIterable listByBillingAccount(String billingAccountN @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingAccount(String billingAccountName, String expand, Context context) { - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, expand, context)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, expand, context), + nextLink -> listByBillingAccountNextSinglePage(nextLink, context)); } /** @@ -368,6 +388,33 @@ private Mono> listByBillingAccountNextSinglePageAs .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -376,23 +423,25 @@ private Mono> listByBillingAccountNextSinglePageAs * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingAccountNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(AgreementsClientImpl.class); } diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AssociatedTenantsClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AssociatedTenantsClientImpl.java index 1bda65fe0cd1..06f58bcb87b3 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AssociatedTenantsClientImpl.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AssociatedTenantsClientImpl.java @@ -27,8 +27,10 @@ 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.BinaryData; 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.AssociatedTenantsClient; @@ -79,6 +81,15 @@ Mono>> delete(@HostParam("$host") String endpoint, @PathParam("associatedTenantName") String associatedTenantName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/associatedTenants/{associatedTenantName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("associatedTenantName") String associatedTenantName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/associatedTenants/{associatedTenantName}") @ExpectedResponses({ 200 }) @@ -88,6 +99,15 @@ Mono> get(@HostParam("$host") String endpoint, @PathParam("associatedTenantName") String associatedTenantName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/associatedTenants/{associatedTenantName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("associatedTenantName") String associatedTenantName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/associatedTenants/{associatedTenantName}") @ExpectedResponses({ 200, 201 }) @@ -99,6 +119,17 @@ Mono>> createOrUpdate(@HostParam("$host") String endpo @BodyParam("application/json") AssociatedTenantInner parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/associatedTenants/{associatedTenantName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("associatedTenantName") String associatedTenantName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AssociatedTenantInner parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/associatedTenants") @ExpectedResponses({ 200 }) @@ -110,6 +141,17 @@ Mono> listByBillingAccount(@HostParam("$hos @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/associatedTenants") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @QueryParam("includeRevoked") Boolean includeRevoked, @QueryParam("api-version") String apiVersion, + @QueryParam("filter") String filter, @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, + @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -117,6 +159,14 @@ Mono> listByBillingAccount(@HostParam("$hos 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) + Response listByBillingAccountNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -156,31 +206,29 @@ private Mono>> deleteWithResponseAsync(String billingA * * @param billingAccountName The ID that uniquely identifies a billing account. * @param associatedTenantName The ID that uniquely identifies a tenant. - * @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 {@link Response} on successful completion of {@link Mono}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String billingAccountName, - String associatedTenantName, Context context) { + private Response deleteWithResponse(String billingAccountName, String associatedTenantName) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); } if (associatedTenantName == null) { - return Mono - .error(new IllegalArgumentException("Parameter associatedTenantName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter associatedTenantName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), billingAccountName, associatedTenantName, - this.client.getApiVersion(), accept, context); + return service.deleteSync(this.client.getEndpoint(), billingAccountName, associatedTenantName, + this.client.getApiVersion(), accept, Context.NONE); } /** @@ -188,17 +236,31 @@ private Mono>> deleteWithResponseAsync(String billingA * * @param billingAccountName The ID that uniquely identifies a billing account. * @param associatedTenantName The ID that uniquely identifies a tenant. + * @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 {@link PollerFlux} for polling of long-running operation. + * @return the response body along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String billingAccountName, - String associatedTenantName) { - Mono>> mono = deleteWithResponseAsync(billingAccountName, associatedTenantName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String billingAccountName, String associatedTenantName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (associatedTenantName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter associatedTenantName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), billingAccountName, associatedTenantName, + this.client.getApiVersion(), accept, context); } /** @@ -206,20 +268,17 @@ private PollerFlux, Void> beginDeleteAsync(String billingAccoun * * @param billingAccountName The ID that uniquely identifies a billing account. * @param associatedTenantName The ID that uniquely identifies a tenant. - * @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 {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String billingAccountName, String associatedTenantName, - Context context) { - context = this.client.mergeContext(context); - Mono>> mono - = deleteWithResponseAsync(billingAccountName, associatedTenantName, context); + private PollerFlux, Void> beginDeleteAsync(String billingAccountName, + String associatedTenantName) { + Mono>> mono = deleteWithResponseAsync(billingAccountName, associatedTenantName); return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + this.client.getContext()); } /** @@ -234,7 +293,8 @@ private PollerFlux, Void> beginDeleteAsync(String billingAccoun */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String billingAccountName, String associatedTenantName) { - return this.beginDeleteAsync(billingAccountName, associatedTenantName).getSyncPoller(); + Response response = deleteWithResponse(billingAccountName, associatedTenantName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -251,7 +311,8 @@ public SyncPoller, Void> beginDelete(String billingAccountName, @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String billingAccountName, String associatedTenantName, Context context) { - return this.beginDeleteAsync(billingAccountName, associatedTenantName, context).getSyncPoller(); + Response response = deleteWithResponse(billingAccountName, associatedTenantName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); } /** @@ -270,23 +331,6 @@ private Mono deleteAsync(String billingAccountName, String associatedTenan .flatMap(this.client::getLroFinalResultOrError); } - /** - * Deletes an associated tenant for a billing account. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param associatedTenantName The ID that uniquely identifies a tenant. - * @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 {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String billingAccountName, String associatedTenantName, Context context) { - return beginDeleteAsync(billingAccountName, associatedTenantName, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Deletes an associated tenant for a billing account. * @@ -298,7 +342,7 @@ private Mono deleteAsync(String billingAccountName, String associatedTenan */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String billingAccountName, String associatedTenantName) { - deleteAsync(billingAccountName, associatedTenantName).block(); + beginDelete(billingAccountName, associatedTenantName).getFinalResult(); } /** @@ -313,7 +357,7 @@ public void delete(String billingAccountName, String associatedTenantName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String billingAccountName, String associatedTenantName, Context context) { - deleteAsync(billingAccountName, associatedTenantName, context).block(); + beginDelete(billingAccountName, associatedTenantName, context).getFinalResult(); } /** @@ -348,38 +392,6 @@ private Mono> getWithResponseAsync(String billin .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets an associated tenant by ID. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param associatedTenantName The ID that uniquely identifies a tenant. - * @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 associated tenant by ID along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String billingAccountName, - String associatedTenantName, 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 (associatedTenantName == null) { - return Mono - .error(new IllegalArgumentException("Parameter associatedTenantName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), billingAccountName, associatedTenantName, - this.client.getApiVersion(), accept, context); - } - /** * Gets an associated tenant by ID. * @@ -410,7 +422,22 @@ private Mono getAsync(String billingAccountName, String a @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String billingAccountName, String associatedTenantName, Context context) { - return getWithResponseAsync(billingAccountName, associatedTenantName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (associatedTenantName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter associatedTenantName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), billingAccountName, associatedTenantName, + this.client.getApiVersion(), accept, context); } /** @@ -472,36 +499,36 @@ private Mono>> createOrUpdateWithResponseAsync(String * @param billingAccountName The ID that uniquely identifies a billing account. * @param associatedTenantName The ID that uniquely identifies a tenant. * @param parameters An associated tenant. - * @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 associated tenant along with {@link Response} on successful completion of {@link Mono}. + * @return an associated tenant along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateWithResponseAsync(String billingAccountName, - String associatedTenantName, AssociatedTenantInner parameters, Context context) { + private Response createOrUpdateWithResponse(String billingAccountName, String associatedTenantName, + AssociatedTenantInner parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); } if (associatedTenantName == null) { - return Mono - .error(new IllegalArgumentException("Parameter associatedTenantName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter associatedTenantName is required and cannot be null.")); } if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), billingAccountName, associatedTenantName, - this.client.getApiVersion(), parameters, accept, context); + return service.createOrUpdateSync(this.client.getEndpoint(), billingAccountName, associatedTenantName, + this.client.getApiVersion(), parameters, accept, Context.NONE); } /** @@ -510,19 +537,37 @@ private Mono>> createOrUpdateWithResponseAsync(String * @param billingAccountName The ID that uniquely identifies a billing account. * @param associatedTenantName The ID that uniquely identifies a tenant. * @param parameters An associated tenant. + * @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 {@link PollerFlux} for polling of an associated tenant. + * @return an associated tenant along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, AssociatedTenantInner> beginCreateOrUpdateAsync( - String billingAccountName, String associatedTenantName, AssociatedTenantInner parameters) { - Mono>> mono - = createOrUpdateWithResponseAsync(billingAccountName, associatedTenantName, parameters); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), AssociatedTenantInner.class, AssociatedTenantInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String billingAccountName, String associatedTenantName, + AssociatedTenantInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (associatedTenantName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter associatedTenantName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), billingAccountName, associatedTenantName, + this.client.getApiVersion(), parameters, accept, context); } /** @@ -531,7 +576,6 @@ private PollerFlux, AssociatedTenantInner> beg * @param billingAccountName The ID that uniquely identifies a billing account. * @param associatedTenantName The ID that uniquely identifies a tenant. * @param parameters An associated tenant. - * @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. @@ -539,12 +583,12 @@ private PollerFlux, AssociatedTenantInner> beg */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, AssociatedTenantInner> beginCreateOrUpdateAsync( - String billingAccountName, String associatedTenantName, AssociatedTenantInner parameters, Context context) { - context = this.client.mergeContext(context); + String billingAccountName, String associatedTenantName, AssociatedTenantInner parameters) { Mono>> mono - = createOrUpdateWithResponseAsync(billingAccountName, associatedTenantName, parameters, context); + = createOrUpdateWithResponseAsync(billingAccountName, associatedTenantName, parameters); return this.client.getLroResult(mono, - this.client.getHttpPipeline(), AssociatedTenantInner.class, AssociatedTenantInner.class, context); + this.client.getHttpPipeline(), AssociatedTenantInner.class, AssociatedTenantInner.class, + this.client.getContext()); } /** @@ -561,7 +605,10 @@ private PollerFlux, AssociatedTenantInner> beg @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, AssociatedTenantInner> beginCreateOrUpdate(String billingAccountName, String associatedTenantName, AssociatedTenantInner parameters) { - return this.beginCreateOrUpdateAsync(billingAccountName, associatedTenantName, parameters).getSyncPoller(); + Response response + = createOrUpdateWithResponse(billingAccountName, associatedTenantName, parameters); + return this.client.getLroResult(response, + AssociatedTenantInner.class, AssociatedTenantInner.class, Context.NONE); } /** @@ -579,8 +626,10 @@ private PollerFlux, AssociatedTenantInner> beg @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, AssociatedTenantInner> beginCreateOrUpdate( String billingAccountName, String associatedTenantName, AssociatedTenantInner parameters, Context context) { - return this.beginCreateOrUpdateAsync(billingAccountName, associatedTenantName, parameters, context) - .getSyncPoller(); + Response response + = createOrUpdateWithResponse(billingAccountName, associatedTenantName, parameters, context); + return this.client.getLroResult(response, + AssociatedTenantInner.class, AssociatedTenantInner.class, context); } /** @@ -601,25 +650,6 @@ private Mono createOrUpdateAsync(String billingAccountNam .flatMap(this.client::getLroFinalResultOrError); } - /** - * Create or update an associated tenant for the billing account. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param associatedTenantName The ID that uniquely identifies a tenant. - * @param parameters An associated tenant. - * @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 associated tenant on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String billingAccountName, String associatedTenantName, - AssociatedTenantInner parameters, Context context) { - return beginCreateOrUpdateAsync(billingAccountName, associatedTenantName, parameters, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Create or update an associated tenant for the billing account. * @@ -634,7 +664,7 @@ private Mono createOrUpdateAsync(String billingAccountNam @ServiceMethod(returns = ReturnType.SINGLE) public AssociatedTenantInner createOrUpdate(String billingAccountName, String associatedTenantName, AssociatedTenantInner parameters) { - return createOrUpdateAsync(billingAccountName, associatedTenantName, parameters).block(); + return beginCreateOrUpdate(billingAccountName, associatedTenantName, parameters).getFinalResult(); } /** @@ -652,7 +682,7 @@ public AssociatedTenantInner createOrUpdate(String billingAccountName, String as @ServiceMethod(returns = ReturnType.SINGLE) public AssociatedTenantInner createOrUpdate(String billingAccountName, String associatedTenantName, AssociatedTenantInner parameters, Context context) { - return createOrUpdateAsync(billingAccountName, associatedTenantName, parameters, context).block(); + return beginCreateOrUpdate(billingAccountName, associatedTenantName, parameters, context).getFinalResult(); } /** @@ -699,51 +729,6 @@ private Mono> listByBillingAccountSinglePag .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Lists the associated tenants that can collaborate with the billing account on commerce activities like viewing - * and downloading invoices, managing payments, making purchases, and managing or provisioning licenses. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param includeRevoked Can be used to get revoked associated tenants. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountSinglePageAsync(String billingAccountName, - Boolean includeRevoked, String filter, String orderBy, Long top, Long skip, Boolean count, String search, - 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingAccount(this.client.getEndpoint(), billingAccountName, includeRevoked, - this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - /** * Lists the associated tenants that can collaborate with the billing account on commerce activities like viewing * and downloading invoices, managing payments, making purchases, and managing or provisioning licenses. @@ -796,6 +781,48 @@ private PagedFlux listByBillingAccountAsync(String billin orderBy, top, skip, count, search), nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); } + /** + * Lists the associated tenants that can collaborate with the billing account on commerce activities like viewing + * and downloading invoices, managing payments, making purchases, and managing or provisioning licenses. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param includeRevoked Can be used to get revoked associated tenants. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, + Boolean includeRevoked, String filter, String orderBy, Long top, Long skip, Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountSync(this.client.getEndpoint(), billingAccountName, includeRevoked, + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Lists the associated tenants that can collaborate with the billing account on commerce activities like viewing * and downloading invoices, managing payments, making purchases, and managing or provisioning licenses. @@ -817,15 +844,27 @@ private PagedFlux listByBillingAccountAsync(String billin * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, Boolean includeRevoked, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>(() -> listByBillingAccountSinglePageAsync(billingAccountName, includeRevoked, filter, - orderBy, top, skip, count, search, context), - nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountSync(this.client.getEndpoint(), billingAccountName, includeRevoked, + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -847,8 +886,8 @@ public PagedIterable listByBillingAccount(String billingA final Long skip = null; final Boolean count = null; final String search = null; - return new PagedIterable<>( - listByBillingAccountAsync(billingAccountName, includeRevoked, filter, orderBy, top, skip, count, search)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, includeRevoked, filter, + orderBy, top, skip, count, search), nextLink -> listByBillingAccountNextSinglePage(nextLink)); } /** @@ -877,8 +916,9 @@ public PagedIterable listByBillingAccount(String billingA @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingAccount(String billingAccountName, Boolean includeRevoked, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, includeRevoked, filter, orderBy, top, - skip, count, search, context)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, includeRevoked, filter, + orderBy, top, skip, count, search, context), + nextLink -> listByBillingAccountNextSinglePage(nextLink, context)); } /** @@ -909,6 +949,33 @@ private Mono> listByBillingAccountNextSingl .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -917,23 +984,25 @@ private Mono> listByBillingAccountNextSingl * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingAccountNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(AssociatedTenantsClientImpl.class); } 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 index d31f64fc2edd..e5a6ba58d10f 100644 --- 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 @@ -21,6 +21,7 @@ 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; @@ -65,6 +66,14 @@ Mono> getByBillingAccount(@HostParam("$host") St @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}/availableBalance/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByBillingAccountSync(@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}/availableBalance/default") @ExpectedResponses({ 200 }) @@ -73,6 +82,15 @@ Mono> getByBillingProfile(@HostParam("$host") St @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}/availableBalance/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByBillingProfileSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); } /** @@ -105,37 +123,6 @@ private Mono> getByBillingAccountWithResponseAsy .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * The Available Credit or Payment on Account Balance for a billing account. The credit balance can be used to - * settle due or past due invoices and is supported for billing accounts with agreement type Microsoft Customer - * Agreement. The payment on account balance is supported for billing accounts with agreement type Microsoft - * Customer Agreement or Microsoft Online Services Program. - * - * @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 Available Credit or Payment on Account Balance along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByBillingAccountWithResponseAsync(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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByBillingAccount(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), - accept, context); - } - /** * The Available Credit or Payment on Account Balance for a billing account. The credit balance can be used to * settle due or past due invoices and is supported for billing accounts with agreement type Microsoft Customer @@ -169,7 +156,18 @@ private Mono getByBillingAccountAsync(String billingAccou */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getByBillingAccountWithResponse(String billingAccountName, Context context) { - return getByBillingAccountWithResponseAsync(billingAccountName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByBillingAccountSync(this.client.getEndpoint(), billingAccountName, + this.client.getApiVersion(), accept, context); } /** @@ -225,42 +223,6 @@ private Mono> getByBillingProfileWithResponseAsy .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * The Available Credit or Payment on Account Balance for a billing profile. The credit balance can be used to - * settle due or past due invoices and is supported for billing accounts with agreement type Microsoft Customer - * Agreement. The payment on account balance 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 Available Credit or Payment on Account Balance along with {@link Response} on successful completion - * of {@link Mono}. - */ - @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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByBillingProfile(this.client.getEndpoint(), billingAccountName, billingProfileName, - this.client.getApiVersion(), accept, context); - } - /** * The Available Credit or Payment on Account Balance for a billing profile. The credit balance can be used to * settle due or past due invoices and is supported for billing accounts with agreement type Microsoft Customer @@ -297,7 +259,22 @@ private Mono getByBillingProfileAsync(String billingAccou @ServiceMethod(returns = ReturnType.SINGLE) public Response getByBillingProfileWithResponse(String billingAccountName, String billingProfileName, Context context) { - return getByBillingProfileWithResponseAsync(billingAccountName, billingProfileName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByBillingProfileSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + this.client.getApiVersion(), accept, context); } /** @@ -317,4 +294,6 @@ public Response getByBillingProfileWithResponse(String bi public AvailableBalanceInner getByBillingProfile(String billingAccountName, String billingProfileName) { return getByBillingProfileWithResponse(billingAccountName, billingProfileName, Context.NONE).getValue(); } + + private static final ClientLogger LOGGER = new ClientLogger(AvailableBalancesClientImpl.class); } 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 index 1200ef7360a0..8c23fe12b6bf 100644 --- 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 @@ -27,8 +27,10 @@ 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.BinaryData; 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; @@ -87,6 +89,15 @@ Mono>> addPaymentTerms(@HostParam("$host") String endp @BodyParam("application/json") List parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/addPaymentTerms") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response addPaymentTermsSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") List parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/cancelPaymentTerms") @ExpectedResponses({ 200, 202 }) @@ -96,6 +107,15 @@ Mono>> cancelPaymentTerms(@HostParam("$host") String e @BodyParam("application/json") OffsetDateTime parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/cancelPaymentTerms") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response cancelPaymentTermsSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") OffsetDateTime parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/confirmTransition") @ExpectedResponses({ 200 }) @@ -104,6 +124,14 @@ Mono> confirmTransition(@HostParam("$host") Str @PathParam("billingAccountName") String billingAccountName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/confirmTransition") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response confirmTransitionSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/listInvoiceSectionsWithCreateSubscriptionPermission") @ExpectedResponses({ 200 }) @@ -114,6 +142,15 @@ Mono> confirmTransition(@HostParam("$host") Str @QueryParam("api-version") String apiVersion, @QueryParam("filter") String filter, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/listInvoiceSectionsWithCreateSubscriptionPermission") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listInvoiceSectionsByCreateSubscriptionPermissionSync( + @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" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/validatePaymentTerms") @ExpectedResponses({ 200 }) @@ -123,6 +160,15 @@ Mono> validatePaymentTerms(@HostPar @BodyParam("application/json") List parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/validatePaymentTerms") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response validatePaymentTermsSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") List parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}") @ExpectedResponses({ 200 }) @@ -131,6 +177,14 @@ Mono> get(@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}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Patch("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}") @ExpectedResponses({ 200, 202 }) @@ -140,6 +194,15 @@ Mono>> update(@HostParam("$host") String endpoint, @BodyParam("application/json") BillingAccountPatch parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Patch("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BillingAccountPatch parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts") @ExpectedResponses({ 200 }) @@ -155,6 +218,21 @@ Mono> list(@HostParam("$host") String endpoin @QueryParam("skip") Long skip, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("includeAll") Boolean includeAll, + @QueryParam("includeAllWithoutBillingProfiles") Boolean includeAllWithoutBillingProfiles, + @QueryParam("includeDeleted") Boolean includeDeleted, + @QueryParam("includePendingAgreement") Boolean includePendingAgreement, + @QueryParam("includeResellee") Boolean includeResellee, @QueryParam("legalOwnerTID") String legalOwnerTid, + @QueryParam("legalOwnerOID") String legalOwnerOid, @QueryParam("api-version") String apiVersion, + @QueryParam("filter") String filter, @QueryParam("expand") String expand, @QueryParam("top") Long top, + @QueryParam("skip") Long skip, @QueryParam("search") String search, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -164,6 +242,15 @@ Mono> list(@HostParam("$host") String endpoin @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) + Response + listInvoiceSectionsByCreateSubscriptionPermissionNextSync( + @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 }) @@ -171,6 +258,13 @@ Mono> list(@HostParam("$host") String endpoin 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) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** @@ -217,32 +311,31 @@ private Mono>> addPaymentTermsWithResponseAsync(String * * @param billingAccountName The ID that uniquely identifies a billing account. * @param parameters The properties of payment term. - * @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 along with {@link Response} on successful completion of {@link Mono}. + * @return a billing account along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> addPaymentTermsWithResponseAsync(String billingAccountName, - List parameters, Context context) { + private Response addPaymentTermsWithResponse(String billingAccountName, List parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.forEach(e -> e.validate()); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.addPaymentTerms(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), - parameters, accept, context); + return service.addPaymentTermsSync(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), + parameters, accept, Context.NONE); } /** @@ -253,17 +346,33 @@ private Mono>> addPaymentTermsWithResponseAsync(String * * @param billingAccountName The ID that uniquely identifies a billing account. * @param parameters The properties of payment term. + * @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 {@link PollerFlux} for polling of a billing account. + * @return a billing account along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, BillingAccountInner> - beginAddPaymentTermsAsync(String billingAccountName, List parameters) { - Mono>> mono = addPaymentTermsWithResponseAsync(billingAccountName, parameters); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), - BillingAccountInner.class, BillingAccountInner.class, this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response addPaymentTermsWithResponse(String billingAccountName, List parameters, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.forEach(e -> e.validate()); + } + final String accept = "application/json"; + return service.addPaymentTermsSync(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), + parameters, accept, context); } /** @@ -274,7 +383,6 @@ private Mono>> addPaymentTermsWithResponseAsync(String * * @param billingAccountName The ID that uniquely identifies a billing account. * @param parameters The properties of payment term. - * @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. @@ -282,12 +390,10 @@ private Mono>> addPaymentTermsWithResponseAsync(String */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, BillingAccountInner> - beginAddPaymentTermsAsync(String billingAccountName, List parameters, Context context) { - context = this.client.mergeContext(context); - Mono>> mono - = addPaymentTermsWithResponseAsync(billingAccountName, parameters, context); + beginAddPaymentTermsAsync(String billingAccountName, List parameters) { + Mono>> mono = addPaymentTermsWithResponseAsync(billingAccountName, parameters); return this.client.getLroResult(mono, this.client.getHttpPipeline(), - BillingAccountInner.class, BillingAccountInner.class, context); + BillingAccountInner.class, BillingAccountInner.class, this.client.getContext()); } /** @@ -306,7 +412,9 @@ private Mono>> addPaymentTermsWithResponseAsync(String @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, BillingAccountInner> beginAddPaymentTerms(String billingAccountName, List parameters) { - return this.beginAddPaymentTermsAsync(billingAccountName, parameters).getSyncPoller(); + Response response = addPaymentTermsWithResponse(billingAccountName, parameters); + return this.client.getLroResult(response, BillingAccountInner.class, + BillingAccountInner.class, Context.NONE); } /** @@ -326,7 +434,9 @@ private Mono>> addPaymentTermsWithResponseAsync(String @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, BillingAccountInner> beginAddPaymentTerms(String billingAccountName, List parameters, Context context) { - return this.beginAddPaymentTermsAsync(billingAccountName, parameters, context).getSyncPoller(); + Response response = addPaymentTermsWithResponse(billingAccountName, parameters, context); + return this.client.getLroResult(response, BillingAccountInner.class, + BillingAccountInner.class, context); } /** @@ -348,27 +458,6 @@ private Mono addPaymentTermsAsync(String billingAccountName .flatMap(this.client::getLroFinalResultOrError); } - /** - * Adds payment terms to all the billing profiles under the billing account. Currently, payment terms can be added - * only on billing accounts that have Agreement Type as 'Microsoft Customer Agreement' and AccountType as - * 'Enterprise'. This action needs pre-authorization and only Field Sellers are authorized to add the payment terms - * and is not a self-serve action. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param parameters The properties of payment term. - * @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 on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono addPaymentTermsAsync(String billingAccountName, List parameters, - Context context) { - return beginAddPaymentTermsAsync(billingAccountName, parameters, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Adds payment terms to all the billing profiles under the billing account. Currently, payment terms can be added * only on billing accounts that have Agreement Type as 'Microsoft Customer Agreement' and AccountType as @@ -384,7 +473,7 @@ private Mono addPaymentTermsAsync(String billingAccountName */ @ServiceMethod(returns = ReturnType.SINGLE) public BillingAccountInner addPaymentTerms(String billingAccountName, List parameters) { - return addPaymentTermsAsync(billingAccountName, parameters).block(); + return beginAddPaymentTerms(billingAccountName, parameters).getFinalResult(); } /** @@ -404,7 +493,7 @@ public BillingAccountInner addPaymentTerms(String billingAccountName, List parameters, Context context) { - return addPaymentTermsAsync(billingAccountName, parameters, context).block(); + return beginAddPaymentTerms(billingAccountName, parameters, context).getFinalResult(); } /** @@ -445,30 +534,29 @@ private Mono>> cancelPaymentTermsWithResponseAsync(Str * * @param billingAccountName The ID that uniquely identifies a billing account. * @param parameters Date after which any payment terms that needs to be cancelled. - * @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 along with {@link Response} on successful completion of {@link Mono}. + * @return a billing account along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> cancelPaymentTermsWithResponseAsync(String billingAccountName, - OffsetDateTime parameters, Context context) { + private Response cancelPaymentTermsWithResponse(String billingAccountName, OffsetDateTime parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.cancelPaymentTerms(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), - parameters, accept, context); + return service.cancelPaymentTermsSync(this.client.getEndpoint(), billingAccountName, + this.client.getApiVersion(), parameters, accept, Context.NONE); } /** @@ -477,17 +565,31 @@ private Mono>> cancelPaymentTermsWithResponseAsync(Str * * @param billingAccountName The ID that uniquely identifies a billing account. * @param parameters Date after which any payment terms that needs to be cancelled. + * @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 {@link PollerFlux} for polling of a billing account. + * @return a billing account along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, BillingAccountInner> - beginCancelPaymentTermsAsync(String billingAccountName, OffsetDateTime parameters) { - Mono>> mono = cancelPaymentTermsWithResponseAsync(billingAccountName, parameters); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), - BillingAccountInner.class, BillingAccountInner.class, this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response cancelPaymentTermsWithResponse(String billingAccountName, OffsetDateTime parameters, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } + final String accept = "application/json"; + return service.cancelPaymentTermsSync(this.client.getEndpoint(), billingAccountName, + this.client.getApiVersion(), parameters, accept, context); } /** @@ -496,7 +598,6 @@ private Mono>> cancelPaymentTermsWithResponseAsync(Str * * @param billingAccountName The ID that uniquely identifies a billing account. * @param parameters Date after which any payment terms that needs to be cancelled. - * @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. @@ -504,12 +605,10 @@ private Mono>> cancelPaymentTermsWithResponseAsync(Str */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, BillingAccountInner> - beginCancelPaymentTermsAsync(String billingAccountName, OffsetDateTime parameters, Context context) { - context = this.client.mergeContext(context); - Mono>> mono - = cancelPaymentTermsWithResponseAsync(billingAccountName, parameters, context); + beginCancelPaymentTermsAsync(String billingAccountName, OffsetDateTime parameters) { + Mono>> mono = cancelPaymentTermsWithResponseAsync(billingAccountName, parameters); return this.client.getLroResult(mono, this.client.getHttpPipeline(), - BillingAccountInner.class, BillingAccountInner.class, context); + BillingAccountInner.class, BillingAccountInner.class, this.client.getContext()); } /** @@ -526,7 +625,9 @@ private Mono>> cancelPaymentTermsWithResponseAsync(Str @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, BillingAccountInner> beginCancelPaymentTerms(String billingAccountName, OffsetDateTime parameters) { - return this.beginCancelPaymentTermsAsync(billingAccountName, parameters).getSyncPoller(); + Response response = cancelPaymentTermsWithResponse(billingAccountName, parameters); + return this.client.getLroResult(response, BillingAccountInner.class, + BillingAccountInner.class, Context.NONE); } /** @@ -544,7 +645,9 @@ private Mono>> cancelPaymentTermsWithResponseAsync(Str @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, BillingAccountInner> beginCancelPaymentTerms(String billingAccountName, OffsetDateTime parameters, Context context) { - return this.beginCancelPaymentTermsAsync(billingAccountName, parameters, context).getSyncPoller(); + Response response = cancelPaymentTermsWithResponse(billingAccountName, parameters, context); + return this.client.getLroResult(response, BillingAccountInner.class, + BillingAccountInner.class, context); } /** @@ -564,25 +667,6 @@ private Mono cancelPaymentTermsAsync(String billingAccountN .flatMap(this.client::getLroFinalResultOrError); } - /** - * Cancels all the payment terms on billing account that falls after the cancellation date in the request. - * Currently, cancel payment terms is only served by admin actions and is not a self-serve action. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param parameters Date after which any payment terms that needs to be cancelled. - * @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 on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono cancelPaymentTermsAsync(String billingAccountName, OffsetDateTime parameters, - Context context) { - return beginCancelPaymentTermsAsync(billingAccountName, parameters, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Cancels all the payment terms on billing account that falls after the cancellation date in the request. * Currently, cancel payment terms is only served by admin actions and is not a self-serve action. @@ -596,7 +680,7 @@ private Mono cancelPaymentTermsAsync(String billingAccountN */ @ServiceMethod(returns = ReturnType.SINGLE) public BillingAccountInner cancelPaymentTerms(String billingAccountName, OffsetDateTime parameters) { - return cancelPaymentTermsAsync(billingAccountName, parameters).block(); + return beginCancelPaymentTerms(billingAccountName, parameters).getFinalResult(); } /** @@ -614,7 +698,7 @@ public BillingAccountInner cancelPaymentTerms(String billingAccountName, OffsetD @ServiceMethod(returns = ReturnType.SINGLE) public BillingAccountInner cancelPaymentTerms(String billingAccountName, OffsetDateTime parameters, Context context) { - return cancelPaymentTermsAsync(billingAccountName, parameters, context).block(); + return beginCancelPaymentTerms(billingAccountName, parameters, context).getFinalResult(); } /** @@ -646,36 +730,6 @@ private Mono> confirmTransitionWithResponseAsyn .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets the transition details for a billing account that has transitioned from agreement type Microsoft Online - * Services Program to 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 transition details for a billing account that has transitioned from agreement type Microsoft Online - * Services Program to agreement type Microsoft Customer Agreement along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> confirmTransitionWithResponseAsync(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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.confirmTransition(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), - accept, context); - } - /** * Gets the transition details for a billing account that has transitioned from agreement type Microsoft Online * Services Program to agreement type Microsoft Customer Agreement. @@ -706,7 +760,18 @@ private Mono confirmTransitionAsync(String billingAccoun */ @ServiceMethod(returns = ReturnType.SINGLE) public Response confirmTransitionWithResponse(String billingAccountName, Context context) { - return confirmTransitionWithResponseAsync(billingAccountName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.confirmTransitionSync(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), + accept, context); } /** @@ -759,41 +824,6 @@ public TransitionDetailsInner confirmTransition(String billingAccountName) { .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 filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listInvoiceSectionsByCreateSubscriptionPermissionSinglePageAsync(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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listInvoiceSectionsByCreateSubscriptionPermission(this.client.getEndpoint(), billingAccountName, - this.client.getApiVersion(), filter, 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. @@ -840,19 +870,29 @@ public TransitionDetailsInner confirmTransition(String billingAccountName) { * @param billingAccountName The ID that uniquely identifies a billing account. * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a * request URL. - * @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 container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux - listInvoiceSectionsByCreateSubscriptionPermissionAsync(String billingAccountName, String filter, - Context context) { - return new PagedFlux<>( - () -> listInvoiceSectionsByCreateSubscriptionPermissionSinglePageAsync(billingAccountName, filter, context), - nextLink -> listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse + listInvoiceSectionsByCreateSubscriptionPermissionSinglePage(String billingAccountName, String filter) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listInvoiceSectionsByCreateSubscriptionPermissionSync(this.client.getEndpoint(), + billingAccountName, this.client.getApiVersion(), filter, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -860,16 +900,33 @@ public TransitionDetailsInner confirmTransition(String billingAccountName) { * supported only for billing accounts with agreement type Microsoft Customer Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @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 container for a list of resources as paginated response with {@link PagedIterable}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable - listInvoiceSectionsByCreateSubscriptionPermission(String billingAccountName) { - final String filter = null; - return new PagedIterable<>(listInvoiceSectionsByCreateSubscriptionPermissionAsync(billingAccountName, filter)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse + listInvoiceSectionsByCreateSubscriptionPermissionSinglePage(String billingAccountName, String filter, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listInvoiceSectionsByCreateSubscriptionPermissionSync(this.client.getEndpoint(), + billingAccountName, this.client.getApiVersion(), filter, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -877,9 +934,6 @@ public TransitionDetailsInner confirmTransition(String billingAccountName) { * supported only for billing accounts with agreement type Microsoft Customer Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @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. @@ -887,44 +941,32 @@ public TransitionDetailsInner confirmTransition(String billingAccountName) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable - listInvoiceSectionsByCreateSubscriptionPermission(String billingAccountName, String filter, Context context) { + listInvoiceSectionsByCreateSubscriptionPermission(String billingAccountName) { + final String filter = null; return new PagedIterable<>( - listInvoiceSectionsByCreateSubscriptionPermissionAsync(billingAccountName, filter, context)); + () -> listInvoiceSectionsByCreateSubscriptionPermissionSinglePage(billingAccountName, filter), + nextLink -> listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePage(nextLink)); } /** - * Validates payment terms on a billing account with agreement type 'Microsoft Customer Agreement' and account type - * 'Enterprise'. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param parameters The properties of payment term. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws 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 payment terms eligibility along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - validatePaymentTermsWithResponseAsync(String billingAccountName, List 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.forEach(e -> e.validate()); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.validatePaymentTerms(this.client.getEndpoint(), billingAccountName, - this.client.getApiVersion(), parameters, accept, context)) - .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 filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @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 container for a list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable + listInvoiceSectionsByCreateSubscriptionPermission(String billingAccountName, String filter, Context context) { + return new PagedIterable<>( + () -> listInvoiceSectionsByCreateSubscriptionPermissionSinglePage(billingAccountName, filter, context), + nextLink -> listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePage(nextLink, context)); } /** @@ -933,7 +975,6 @@ public TransitionDetailsInner confirmTransition(String billingAccountName) { * * @param billingAccountName The ID that uniquely identifies a billing account. * @param parameters The properties of payment term. - * @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. @@ -941,8 +982,8 @@ public TransitionDetailsInner confirmTransition(String billingAccountName) { * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> validatePaymentTermsWithResponseAsync( - String billingAccountName, List parameters, Context context) { + private Mono> + validatePaymentTermsWithResponseAsync(String billingAccountName, List parameters) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -957,9 +998,10 @@ private Mono> validatePaymentTermsW parameters.forEach(e -> e.validate()); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.validatePaymentTerms(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), - parameters, accept, context); + return FluxUtil + .withContext(context -> service.validatePaymentTerms(this.client.getEndpoint(), billingAccountName, + this.client.getApiVersion(), parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -995,7 +1037,24 @@ private Mono validatePaymentTermsAsync(Strin @ServiceMethod(returns = ReturnType.SINGLE) public Response validatePaymentTermsWithResponse(String billingAccountName, List parameters, Context context) { - return validatePaymentTermsWithResponseAsync(billingAccountName, parameters, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.forEach(e -> e.validate()); + } + final String accept = "application/json"; + return service.validatePaymentTermsSync(this.client.getEndpoint(), billingAccountName, + this.client.getApiVersion(), parameters, accept, context); } /** @@ -1041,31 +1100,6 @@ private Mono> getWithResponseAsync(String billingA .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 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 along with {@link Response} on successful completion of {@link Mono}. - */ - @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.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), accept, context); - } - /** * Gets a billing account by its ID. * @@ -1092,7 +1126,18 @@ private Mono getAsync(String billingAccountName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String billingAccountName, Context context) { - return getWithResponseAsync(billingAccountName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), accept, + context); } /** @@ -1153,32 +1198,31 @@ private Mono>> updateWithResponseAsync(String billingA * * @param billingAccountName The ID that uniquely identifies a billing account. * @param parameters 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 billing account along with {@link Response} on successful completion of {@link Mono}. + * @return a billing account along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> updateWithResponseAsync(String billingAccountName, - BillingAccountPatch parameters, Context context) { + private Response updateWithResponse(String billingAccountName, BillingAccountPatch parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.update(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), parameters, - accept, context); + return service.updateSync(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), + parameters, accept, Context.NONE); } /** @@ -1189,17 +1233,33 @@ private Mono>> updateWithResponseAsync(String billingA * * @param billingAccountName The ID that uniquely identifies a billing account. * @param parameters 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 {@link PollerFlux} for polling of a billing account. + * @return a billing account along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, BillingAccountInner> beginUpdateAsync(String billingAccountName, - BillingAccountPatch parameters) { - Mono>> mono = updateWithResponseAsync(billingAccountName, parameters); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), - BillingAccountInner.class, BillingAccountInner.class, this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String billingAccountName, BillingAccountPatch parameters, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), + parameters, accept, context); } /** @@ -1210,7 +1270,6 @@ private PollerFlux, BillingAccountInner> beginUp * * @param billingAccountName The ID that uniquely identifies a billing account. * @param parameters 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. @@ -1218,11 +1277,10 @@ private PollerFlux, BillingAccountInner> beginUp */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, BillingAccountInner> beginUpdateAsync(String billingAccountName, - BillingAccountPatch parameters, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = updateWithResponseAsync(billingAccountName, parameters, context); + BillingAccountPatch parameters) { + Mono>> mono = updateWithResponseAsync(billingAccountName, parameters); return this.client.getLroResult(mono, this.client.getHttpPipeline(), - BillingAccountInner.class, BillingAccountInner.class, context); + BillingAccountInner.class, BillingAccountInner.class, this.client.getContext()); } /** @@ -1241,7 +1299,9 @@ private PollerFlux, BillingAccountInner> beginUp @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, BillingAccountInner> beginUpdate(String billingAccountName, BillingAccountPatch parameters) { - return this.beginUpdateAsync(billingAccountName, parameters).getSyncPoller(); + Response response = updateWithResponse(billingAccountName, parameters); + return this.client.getLroResult(response, BillingAccountInner.class, + BillingAccountInner.class, Context.NONE); } /** @@ -1261,7 +1321,9 @@ public SyncPoller, BillingAccountInner> beginUpd @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, BillingAccountInner> beginUpdate(String billingAccountName, BillingAccountPatch parameters, Context context) { - return this.beginUpdateAsync(billingAccountName, parameters, context).getSyncPoller(); + Response response = updateWithResponse(billingAccountName, parameters, context); + return this.client.getLroResult(response, BillingAccountInner.class, + BillingAccountInner.class, context); } /** @@ -1282,27 +1344,6 @@ private Mono updateAsync(String billingAccountName, Billing return beginUpdateAsync(billingAccountName, parameters).last().flatMap(this.client::getLroFinalResultOrError); } - /** - * Updates the properties of a billing account. Currently, displayName and address can be updated for billing - * accounts with agreement type Microsoft Customer Agreement. Currently address and notification email address can - * be updated for billing accounts with agreement type Microsoft Online Services Agreement. Currently, purchase - * order number can be edited for billing accounts with agreement type Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param parameters 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 billing account on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync(String billingAccountName, BillingAccountPatch 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 for billing * accounts with agreement type Microsoft Customer Agreement. Currently address and notification email address can @@ -1318,7 +1359,7 @@ private Mono updateAsync(String billingAccountName, Billing */ @ServiceMethod(returns = ReturnType.SINGLE) public BillingAccountInner update(String billingAccountName, BillingAccountPatch parameters) { - return updateAsync(billingAccountName, parameters).block(); + return beginUpdate(billingAccountName, parameters).getFinalResult(); } /** @@ -1337,7 +1378,7 @@ public BillingAccountInner update(String billingAccountName, BillingAccountPatch */ @ServiceMethod(returns = ReturnType.SINGLE) public BillingAccountInner update(String billingAccountName, BillingAccountPatch parameters, Context context) { - return updateAsync(billingAccountName, parameters, context).block(); + return beginUpdate(billingAccountName, parameters, context).getFinalResult(); } /** @@ -1393,59 +1434,6 @@ private Mono> listSinglePageAsync(Boolean inc .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Lists the billing accounts that a user has access to. - * - * @param includeAll When true, results will include Billing Accounts that the user does not have a direct role - * assignment on if the user has one of the following AAD roles: Global Administrator, Global Reader, Billing - * Administrator. - * @param includeAllWithoutBillingProfiles When true, results will include Billing Accounts that are not fully - * created if the user has one of the following AAD roles: Global Administrator, Global Reader, Billing - * Administrator. - * @param includeDeleted When true, results will include any billing accounts in a deleted state. - * @param includePendingAgreement Includes billing accounts with agreement pending signature that the user has - * access to. - * @param includeResellee Includes the customer's billing account of Microsoft Partner Agreement that the user has - * access to. - * @param legalOwnerTid Must be combined with legalOwnerOID, results will only include Billing Accounts for whom is - * legally responsible for the Billing Accounts. Optional. - * @param legalOwnerOid Must be combined with legalOwnerTID, results will only include Billing Accounts for whom is - * legally responsible for the Billing Accounts. Optional. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param expand Expand is allowed for SoldTo and EnrollmentDetails/PONumber. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(Boolean includeAll, - Boolean includeAllWithoutBillingProfiles, Boolean includeDeleted, Boolean includePendingAgreement, - Boolean includeResellee, String legalOwnerTid, String legalOwnerOid, String filter, String expand, Long top, - Long skip, String search, Context context) { - 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 - .list(this.client.getEndpoint(), includeAll, includeAllWithoutBillingProfiles, includeDeleted, - includePendingAgreement, includeResellee, legalOwnerTid, legalOwnerOid, this.client.getApiVersion(), - filter, expand, top, skip, search, 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. * @@ -1513,6 +1501,56 @@ private PagedFlux listAsync() { nextLink -> listNextSinglePageAsync(nextLink)); } + /** + * Lists the billing accounts that a user has access to. + * + * @param includeAll When true, results will include Billing Accounts that the user does not have a direct role + * assignment on if the user has one of the following AAD roles: Global Administrator, Global Reader, Billing + * Administrator. + * @param includeAllWithoutBillingProfiles When true, results will include Billing Accounts that are not fully + * created if the user has one of the following AAD roles: Global Administrator, Global Reader, Billing + * Administrator. + * @param includeDeleted When true, results will include any billing accounts in a deleted state. + * @param includePendingAgreement Includes billing accounts with agreement pending signature that the user has + * access to. + * @param includeResellee Includes the customer's billing account of Microsoft Partner Agreement that the user has + * access to. + * @param legalOwnerTid Must be combined with legalOwnerOID, results will only include Billing Accounts for whom is + * legally responsible for the Billing Accounts. Optional. + * @param legalOwnerOid Must be combined with legalOwnerTID, results will only include Billing Accounts for whom is + * legally responsible for the Billing Accounts. Optional. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param expand Expand is allowed for SoldTo and EnrollmentDetails/PONumber. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Boolean includeAll, + Boolean includeAllWithoutBillingProfiles, Boolean includeDeleted, Boolean includePendingAgreement, + Boolean includeResellee, String legalOwnerTid, String legalOwnerOid, String filter, String expand, Long top, + Long skip, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), includeAll, + includeAllWithoutBillingProfiles, includeDeleted, includePendingAgreement, includeResellee, legalOwnerTid, + legalOwnerOid, this.client.getApiVersion(), filter, expand, top, skip, search, accept, Context.NONE); + return 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. * @@ -1544,15 +1582,24 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Boolean includeAll, Boolean includeAllWithoutBillingProfiles, - Boolean includeDeleted, Boolean includePendingAgreement, Boolean includeResellee, String legalOwnerTid, - String legalOwnerOid, String filter, String expand, Long top, Long skip, String search, Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(includeAll, includeAllWithoutBillingProfiles, includeDeleted, - includePendingAgreement, includeResellee, legalOwnerTid, legalOwnerOid, filter, expand, top, skip, search, - context), nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Boolean includeAll, + Boolean includeAllWithoutBillingProfiles, Boolean includeDeleted, Boolean includePendingAgreement, + Boolean includeResellee, String legalOwnerTid, String legalOwnerOid, String filter, String expand, Long top, + Long skip, String search, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), includeAll, + includeAllWithoutBillingProfiles, includeDeleted, includePendingAgreement, includeResellee, legalOwnerTid, + legalOwnerOid, this.client.getApiVersion(), filter, expand, top, skip, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1576,8 +1623,10 @@ public PagedIterable list() { final Long top = null; final Long skip = null; final String search = null; - return new PagedIterable<>(listAsync(includeAll, includeAllWithoutBillingProfiles, includeDeleted, - includePendingAgreement, includeResellee, legalOwnerTid, legalOwnerOid, filter, expand, top, skip, search)); + return new PagedIterable<>( + () -> listSinglePage(includeAll, includeAllWithoutBillingProfiles, includeDeleted, includePendingAgreement, + includeResellee, legalOwnerTid, legalOwnerOid, filter, expand, top, skip, search), + nextLink -> listNextSinglePage(nextLink)); } /** @@ -1618,8 +1667,9 @@ public PagedIterable list(Boolean includeAll, Boolean inclu Boolean includeDeleted, Boolean includePendingAgreement, Boolean includeResellee, String legalOwnerTid, String legalOwnerOid, String filter, String expand, Long top, Long skip, String search, Context context) { return new PagedIterable<>( - listAsync(includeAll, includeAllWithoutBillingProfiles, includeDeleted, includePendingAgreement, - includeResellee, legalOwnerTid, legalOwnerOid, filter, expand, top, skip, search, context)); + () -> listSinglePage(includeAll, includeAllWithoutBillingProfiles, includeDeleted, includePendingAgreement, + includeResellee, legalOwnerTid, legalOwnerOid, filter, expand, top, skip, search, context), + nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -1652,6 +1702,35 @@ public PagedIterable list(Boolean includeAll, Boolean inclu .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse + listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listInvoiceSectionsByCreateSubscriptionPermissionNextSync(nextLink, this.client.getEndpoint(), + accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1660,25 +1739,26 @@ public PagedIterable list(Boolean includeAll, Boolean inclu * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse + listInvoiceSectionsByCreateSubscriptionPermissionNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listInvoiceSectionsByCreateSubscriptionPermissionNextSync(nextLink, this.client.getEndpoint(), + accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1707,6 +1787,33 @@ private Mono> listNextSinglePageAsync(String .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1715,22 +1822,25 @@ private Mono> listNextSinglePageAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(BillingAccountsClientImpl.class); } 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 index 5acf93fa0b71..6b445124f559 100644 --- 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 @@ -13,14 +13,17 @@ 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.PollerFactory; import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.CoreUtils; 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.polling.SyncPoller; import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.SerializerEncoding; import com.azure.resourcemanager.billing.fluent.AddressClient; @@ -40,8 +43,8 @@ import com.azure.resourcemanager.billing.fluent.CustomersClient; import com.azure.resourcemanager.billing.fluent.DepartmentsClient; import com.azure.resourcemanager.billing.fluent.EnrollmentAccountsClient; -import com.azure.resourcemanager.billing.fluent.InvoicesClient; 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.PartnerTransfersClient; import com.azure.resourcemanager.billing.fluent.PaymentMethodsClient; @@ -659,6 +662,23 @@ public PollerFlux, U> getLroResult(Mono type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + /** * Gets the final result, or an error, based on last async poll response. * 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 index 46773bab130a..2755c85a04a6 100644 --- 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 @@ -27,6 +27,7 @@ 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.BillingPermissionInner; import com.azure.resourcemanager.billing.fluent.models.CheckAccessResponseInner; @@ -75,6 +76,14 @@ Mono> listByBillingAccount(@HostParam("$ho @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}/billingPermissions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingAccountSync(@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}/billingPermissions") @ExpectedResponses({ 200 }) @@ -84,6 +93,15 @@ Mono> listByBillingProfile(@HostParam("$ho @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}/billingPermissions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingProfileSync(@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" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/checkAccess") @ExpectedResponses({ 200 }) @@ -94,6 +112,16 @@ Mono>> checkAccessByBillingProfile(@Host @BodyParam("application/json") CheckAccessRequest parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/checkAccess") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response> checkAccessByBillingProfileSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CheckAccessRequest parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/billingPermissions") @ExpectedResponses({ 200 }) @@ -103,6 +131,15 @@ Mono> listByCustomer(@HostParam("$host") S @PathParam("billingProfileName") String billingProfileName, @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}/billingProfiles/{billingProfileName}/customers/{customerName}/billingPermissions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByCustomerSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @PathParam("customerName") String customerName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/checkAccess") @ExpectedResponses({ 200 }) @@ -113,6 +150,16 @@ Mono>> checkAccessByCustomer(@HostParam( @QueryParam("api-version") String apiVersion, @BodyParam("application/json") CheckAccessRequest parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/checkAccess") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response> checkAccessByCustomerSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @PathParam("customerName") String customerName, + @QueryParam("api-version") String apiVersion, @BodyParam("application/json") CheckAccessRequest parameters, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingPermissions") @ExpectedResponses({ 200 }) @@ -123,6 +170,16 @@ Mono> listByInvoiceSection(@HostParam("$ho @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}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingPermissions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByInvoiceSectionSync(@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" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/checkAccess") @ExpectedResponses({ 200 }) @@ -134,6 +191,17 @@ Mono>> checkAccessByInvoiceSection(@Host @BodyParam("application/json") CheckAccessRequest parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/checkAccess") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response> checkAccessByInvoiceSectionSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("invoiceSectionName") String invoiceSectionName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CheckAccessRequest parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/checkAccess") @ExpectedResponses({ 200 }) @@ -143,6 +211,15 @@ Mono>> checkAccessByBillingAccount(@Host @BodyParam("application/json") CheckAccessRequest parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/checkAccess") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response> checkAccessByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CheckAccessRequest parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingPermissions") @ExpectedResponses({ 200 }) @@ -151,6 +228,14 @@ Mono> listByCustomerAtBillingAccount(@Host @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}/customers/{customerName}/billingPermissions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByCustomerAtBillingAccountSync(@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}/departments/{departmentName}/billingPermissions") @ExpectedResponses({ 200 }) @@ -160,6 +245,15 @@ Mono> listByDepartment(@HostParam("$host") @PathParam("departmentName") String departmentName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingPermissions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByDepartmentSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("departmentName") String departmentName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/checkAccess") @ExpectedResponses({ 200 }) @@ -170,6 +264,16 @@ Mono>> checkAccessByDepartment(@HostPara @BodyParam("application/json") CheckAccessRequest parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/checkAccess") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response> checkAccessByDepartmentSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("departmentName") String departmentName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CheckAccessRequest parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingPermissions") @ExpectedResponses({ 200 }) @@ -179,6 +283,15 @@ Mono> listByEnrollmentAccount(@HostParam(" @PathParam("enrollmentAccountName") String enrollmentAccountName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingPermissions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByEnrollmentAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("enrollmentAccountName") String enrollmentAccountName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/checkAccess") @ExpectedResponses({ 200 }) @@ -189,6 +302,16 @@ Mono>> checkAccessByEnrollmentAccount( @QueryParam("api-version") String apiVersion, @BodyParam("application/json") CheckAccessRequest parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/checkAccess") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response> checkAccessByEnrollmentAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("enrollmentAccountName") String enrollmentAccountName, + @QueryParam("api-version") String apiVersion, @BodyParam("application/json") CheckAccessRequest parameters, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -197,6 +320,14 @@ 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) + Response listByBillingAccountNextSync( + @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 }) @@ -205,6 +336,14 @@ 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) + Response listByBillingProfileNextSync( + @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 }) @@ -213,6 +352,14 @@ 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) + Response listByCustomerNextSync( + @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 }) @@ -221,6 +368,14 @@ 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) + Response listByInvoiceSectionNextSync( + @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 }) @@ -229,6 +384,14 @@ Mono> listByCustomerAtBillingAccountNext( @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) + Response listByCustomerAtBillingAccountNextSync( + @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 }) @@ -237,6 +400,14 @@ Mono> listByDepartmentNext( @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) + Response listByDepartmentNextSync( + @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 }) @@ -244,6 +415,14 @@ Mono> listByDepartmentNext( Mono> listByEnrollmentAccountNext( @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) + Response listByEnrollmentAccountNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -279,31 +458,15 @@ private Mono> listByBillingAccountSinglePa * 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 a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources as paginated response with {@link PagedFlux}. */ - @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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingAccount(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), accept, - context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync(String billingAccountName) { + return new PagedFlux<>(() -> listByBillingAccountSinglePageAsync(billingAccountName), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); } /** @@ -313,12 +476,24 @@ private Mono> listByBillingAccountSinglePa * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName) { - return new PagedFlux<>(() -> listByBillingAccountSinglePageAsync(billingAccountName), - nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingAccountSync(this.client.getEndpoint(), + billingAccountName, this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -329,12 +504,25 @@ private PagedFlux listByBillingAccountAsync(String billi * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName, Context context) { - return new PagedFlux<>(() -> listByBillingAccountSinglePageAsync(billingAccountName, context), - nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingAccountSync(this.client.getEndpoint(), + billingAccountName, this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -348,7 +536,8 @@ private PagedFlux listByBillingAccountAsync(String billi */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingAccount(String billingAccountName) { - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName), + nextLink -> listByBillingAccountNextSinglePage(nextLink)); } /** @@ -363,7 +552,8 @@ public PagedIterable listByBillingAccount(String billing */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingAccount(String billingAccountName, Context context) { - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, context)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, context), + nextLink -> listByBillingAccountNextSinglePage(nextLink, context)); } /** @@ -406,35 +596,16 @@ private Mono> listByBillingProfileSinglePa * * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources as paginated response with {@link PagedFlux}. */ - @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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingProfile(this.client.getEndpoint(), billingAccountName, billingProfileName, - this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync(String billingAccountName, + String billingProfileName) { + return new PagedFlux<>(() -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); } /** @@ -445,13 +616,29 @@ private Mono> listByBillingProfileSinglePa * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingProfileAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, String billingProfileName) { - return new PagedFlux<>(() -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName), - nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingProfileSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -463,14 +650,29 @@ private PagedFlux listByBillingProfileAsync(String billi * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingProfileAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, String billingProfileName, Context context) { - return new PagedFlux<>( - () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, context), - nextLink -> listByBillingProfileNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingProfileSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -486,7 +688,8 @@ private PagedFlux listByBillingProfileAsync(String billi @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName) { - return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName)); + return new PagedIterable<>(() -> listByBillingProfileSinglePage(billingAccountName, billingProfileName), + nextLink -> listByBillingProfileNextSinglePage(nextLink)); } /** @@ -503,7 +706,9 @@ public PagedIterable listByBillingProfile(String billing @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName, Context context) { - return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, context)); + return new PagedIterable<>( + () -> listByBillingProfileSinglePage(billingAccountName, billingProfileName, context), + nextLink -> listByBillingProfileNextSinglePage(nextLink, context)); } /** @@ -544,44 +749,6 @@ private Mono>> checkAccessByBillingProfi .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Provides a list of check access response objects for a billing profile. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param parameters The request object against which access of the caller will be checked. - * @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 array of CheckAccessResponse along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> checkAccessByBillingProfileWithResponseAsync( - String billingAccountName, String billingProfileName, CheckAccessRequest 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.checkAccessByBillingProfile(this.client.getEndpoint(), billingAccountName, billingProfileName, - this.client.getApiVersion(), parameters, accept, context); - } - /** * Provides a list of check access response objects for a billing profile. * @@ -615,8 +782,28 @@ private Mono> checkAccessByBillingProfileAsync(St @ServiceMethod(returns = ReturnType.SINGLE) public Response> checkAccessByBillingProfileWithResponse(String billingAccountName, String billingProfileName, CheckAccessRequest parameters, Context context) { - return checkAccessByBillingProfileWithResponseAsync(billingAccountName, billingProfileName, parameters, context) - .block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.checkAccessByBillingProfileSync(this.client.getEndpoint(), billingAccountName, + billingProfileName, this.client.getApiVersion(), parameters, accept, context); } /** @@ -682,38 +869,17 @@ private Mono> listByCustomerSinglePageAsyn * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingProfileName The ID that uniquely identifies a billing profile. * @param customerName The ID that uniquely identifies a customer. - * @param 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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByCustomerSinglePageAsync(String billingAccountName, - String billingProfileName, 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 (billingProfileName == null) { - return Mono - .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); - } - if (customerName == null) { - return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByCustomer(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName, - this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCustomerAsync(String billingAccountName, String billingProfileName, + String customerName) { + return new PagedFlux<>( + () -> listByCustomerSinglePageAsync(billingAccountName, billingProfileName, customerName), + nextLink -> listByCustomerNextSinglePageAsync(nextLink)); } /** @@ -725,14 +891,33 @@ private Mono> listByCustomerSinglePageAsyn * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByCustomerAsync(String billingAccountName, String billingProfileName, - String customerName) { - return new PagedFlux<>( - () -> listByCustomerSinglePageAsync(billingAccountName, billingProfileName, customerName), - nextLink -> listByCustomerNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerSinglePage(String billingAccountName, + String billingProfileName, String customerName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByCustomerSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, customerName, this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -745,14 +930,33 @@ private PagedFlux listByCustomerAsync(String billingAcco * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByCustomerAsync(String billingAccountName, String billingProfileName, - String customerName, Context context) { - return new PagedFlux<>( - () -> listByCustomerSinglePageAsync(billingAccountName, billingProfileName, customerName, context), - nextLink -> listByCustomerNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerSinglePage(String billingAccountName, + String billingProfileName, String customerName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByCustomerSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, customerName, this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -769,7 +973,8 @@ private PagedFlux listByCustomerAsync(String billingAcco @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByCustomer(String billingAccountName, String billingProfileName, String customerName) { - return new PagedIterable<>(listByCustomerAsync(billingAccountName, billingProfileName, customerName)); + return new PagedIterable<>(() -> listByCustomerSinglePage(billingAccountName, billingProfileName, customerName), + nextLink -> listByCustomerNextSinglePage(nextLink)); } /** @@ -787,7 +992,9 @@ public PagedIterable listByCustomer(String billingAccoun @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByCustomer(String billingAccountName, String billingProfileName, String customerName, Context context) { - return new PagedIterable<>(listByCustomerAsync(billingAccountName, billingProfileName, customerName, context)); + return new PagedIterable<>( + () -> listByCustomerSinglePage(billingAccountName, billingProfileName, customerName, context), + nextLink -> listByCustomerNextSinglePage(nextLink, context)); } /** @@ -832,49 +1039,6 @@ private Mono>> checkAccessByCustomerWith .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Provides a list of check access response objects for a customer. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param customerName The ID that uniquely identifies a customer. - * @param parameters The request object against which access of the caller will be checked. - * @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 array of CheckAccessResponse along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> checkAccessByCustomerWithResponseAsync( - String billingAccountName, String billingProfileName, String customerName, CheckAccessRequest 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 (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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.checkAccessByCustomer(this.client.getEndpoint(), billingAccountName, billingProfileName, - customerName, this.client.getApiVersion(), parameters, accept, context); - } - /** * Provides a list of check access response objects for a customer. * @@ -910,8 +1074,32 @@ private Mono> checkAccessByCustomerAsync(String b @ServiceMethod(returns = ReturnType.SINGLE) public Response> checkAccessByCustomerWithResponse(String billingAccountName, String billingProfileName, String customerName, CheckAccessRequest parameters, Context context) { - return checkAccessByCustomerWithResponseAsync(billingAccountName, billingProfileName, customerName, parameters, - context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.checkAccessByCustomerSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + customerName, this.client.getApiVersion(), parameters, accept, context); } /** @@ -979,39 +1167,17 @@ private Mono> listByInvoiceSectionSinglePa * @param billingAccountName The ID that uniquely 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 a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources as paginated response with {@link PagedFlux}. */ - @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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByInvoiceSection(this.client.getEndpoint(), billingAccountName, billingProfileName, invoiceSectionName, - this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInvoiceSectionAsync(String billingAccountName, + String billingProfileName, String invoiceSectionName) { + return new PagedFlux<>( + () -> listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName), + nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink)); } /** @@ -1023,14 +1189,34 @@ private Mono> listByInvoiceSectionSinglePa * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByInvoiceSectionAsync(String billingAccountName, - String billingProfileName, String invoiceSectionName) { - return new PagedFlux<>( - () -> listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName), - nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceSectionSinglePage(String billingAccountName, + String billingProfileName, String invoiceSectionName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByInvoiceSectionSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + invoiceSectionName, this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1043,13 +1229,33 @@ private PagedFlux listByInvoiceSectionAsync(String billi * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByInvoiceSectionAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceSectionSinglePage(String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { - return new PagedFlux<>(() -> listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, - invoiceSectionName, context), nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByInvoiceSectionSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, invoiceSectionName, this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1067,7 +1273,8 @@ private PagedFlux listByInvoiceSectionAsync(String billi public PagedIterable listByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName) { return new PagedIterable<>( - listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName)); + () -> listByInvoiceSectionSinglePage(billingAccountName, billingProfileName, invoiceSectionName), + nextLink -> listByInvoiceSectionNextSinglePage(nextLink)); } /** @@ -1086,7 +1293,8 @@ public PagedIterable listByInvoiceSection(String billing public PagedIterable listByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { return new PagedIterable<>( - listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, context)); + () -> listByInvoiceSectionSinglePage(billingAccountName, billingProfileName, invoiceSectionName, context), + nextLink -> listByInvoiceSectionNextSinglePage(nextLink, context)); } /** @@ -1133,50 +1341,6 @@ private Mono>> checkAccessByInvoiceSecti .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Provides a list of check access response objects for 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 parameters The request object against which access of the caller will be checked. - * @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 array of CheckAccessResponse along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> checkAccessByInvoiceSectionWithResponseAsync( - String billingAccountName, String billingProfileName, String invoiceSectionName, CheckAccessRequest 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.checkAccessByInvoiceSection(this.client.getEndpoint(), billingAccountName, billingProfileName, - invoiceSectionName, this.client.getApiVersion(), parameters, accept, context); - } - /** * Provides a list of check access response objects for an invoice section. * @@ -1212,8 +1376,32 @@ private Mono> checkAccessByInvoiceSectionAsync(St @ServiceMethod(returns = ReturnType.SINGLE) public Response> checkAccessByInvoiceSectionWithResponse(String billingAccountName, String billingProfileName, String invoiceSectionName, CheckAccessRequest parameters, Context context) { - return checkAccessByInvoiceSectionWithResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, - parameters, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.checkAccessByInvoiceSectionSync(this.client.getEndpoint(), billingAccountName, + billingProfileName, invoiceSectionName, this.client.getApiVersion(), parameters, accept, context); } /** @@ -1268,39 +1456,6 @@ public List checkAccessByInvoiceSection(String billing .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Provides a list of check access response objects for a billing account. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param parameters The request object against which access of the caller will be checked. - * @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 array of CheckAccessResponse along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> checkAccessByBillingAccountWithResponseAsync( - String billingAccountName, CheckAccessRequest 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.checkAccessByBillingAccount(this.client.getEndpoint(), billingAccountName, - this.client.getApiVersion(), parameters, accept, context); - } - /** * Provides a list of check access response objects for a billing account. * @@ -1332,7 +1487,24 @@ private Mono> checkAccessByBillingAccountAsync(St @ServiceMethod(returns = ReturnType.SINGLE) public Response> checkAccessByBillingAccountWithResponse(String billingAccountName, CheckAccessRequest parameters, Context context) { - return checkAccessByBillingAccountWithResponseAsync(billingAccountName, parameters, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.checkAccessByBillingAccountSync(this.client.getEndpoint(), billingAccountName, + this.client.getApiVersion(), parameters, accept, context); } /** @@ -1390,34 +1562,16 @@ public List checkAccessByBillingAccount(String billing * * @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 a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByCustomerAtBillingAccountSinglePageAsync(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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByCustomerAtBillingAccount(this.client.getEndpoint(), billingAccountName, customerName, - this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCustomerAtBillingAccountAsync(String billingAccountName, + String customerName) { + return new PagedFlux<>(() -> listByCustomerAtBillingAccountSinglePageAsync(billingAccountName, customerName), + nextLink -> listByCustomerAtBillingAccountNextSinglePageAsync(nextLink)); } /** @@ -1428,13 +1582,30 @@ public List checkAccessByBillingAccount(String billing * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByCustomerAtBillingAccountAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerAtBillingAccountSinglePage(String billingAccountName, String customerName) { - return new PagedFlux<>(() -> listByCustomerAtBillingAccountSinglePageAsync(billingAccountName, customerName), - nextLink -> listByCustomerAtBillingAccountNextSinglePageAsync(nextLink)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByCustomerAtBillingAccountSync(this.client.getEndpoint(), billingAccountName, customerName, + this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1446,14 +1617,29 @@ private PagedFlux listByCustomerAtBillingAccountAsync(St * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByCustomerAtBillingAccountAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerAtBillingAccountSinglePage(String billingAccountName, String customerName, Context context) { - return new PagedFlux<>( - () -> listByCustomerAtBillingAccountSinglePageAsync(billingAccountName, customerName, context), - nextLink -> listByCustomerAtBillingAccountNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByCustomerAtBillingAccountSync( + this.client.getEndpoint(), billingAccountName, customerName, this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1469,7 +1655,8 @@ private PagedFlux listByCustomerAtBillingAccountAsync(St @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByCustomerAtBillingAccount(String billingAccountName, String customerName) { - return new PagedIterable<>(listByCustomerAtBillingAccountAsync(billingAccountName, customerName)); + return new PagedIterable<>(() -> listByCustomerAtBillingAccountSinglePage(billingAccountName, customerName), + nextLink -> listByCustomerAtBillingAccountNextSinglePage(nextLink)); } /** @@ -1486,7 +1673,9 @@ public PagedIterable listByCustomerAtBillingAccount(Stri @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByCustomerAtBillingAccount(String billingAccountName, String customerName, Context context) { - return new PagedIterable<>(listByCustomerAtBillingAccountAsync(billingAccountName, customerName, context)); + return new PagedIterable<>( + () -> listByCustomerAtBillingAccountSinglePage(billingAccountName, customerName, context), + nextLink -> listByCustomerAtBillingAccountNextSinglePage(nextLink, context)); } /** @@ -1528,34 +1717,15 @@ private Mono> listByDepartmentSinglePageAs * * @param billingAccountName The ID that uniquely identifies a billing account. * @param departmentName The name of the department. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByDepartmentSinglePageAsync(String billingAccountName, - String departmentName, 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 (departmentName == null) { - return Mono.error(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByDepartment(this.client.getEndpoint(), billingAccountName, departmentName, - this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDepartmentAsync(String billingAccountName, String departmentName) { + return new PagedFlux<>(() -> listByDepartmentSinglePageAsync(billingAccountName, departmentName), + nextLink -> listByDepartmentNextSinglePageAsync(nextLink)); } /** @@ -1566,12 +1736,29 @@ private Mono> listByDepartmentSinglePageAs * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByDepartmentAsync(String billingAccountName, String departmentName) { - return new PagedFlux<>(() -> listByDepartmentSinglePageAsync(billingAccountName, departmentName), - nextLink -> listByDepartmentNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByDepartmentSinglePage(String billingAccountName, + String departmentName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (departmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByDepartmentSync(this.client.getEndpoint(), + billingAccountName, departmentName, this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1583,13 +1770,29 @@ private PagedFlux listByDepartmentAsync(String billingAc * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByDepartmentAsync(String billingAccountName, String departmentName, - Context context) { - return new PagedFlux<>(() -> listByDepartmentSinglePageAsync(billingAccountName, departmentName, context), - nextLink -> listByDepartmentNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByDepartmentSinglePage(String billingAccountName, + String departmentName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (departmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByDepartmentSync(this.client.getEndpoint(), + billingAccountName, departmentName, this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1604,7 +1807,8 @@ private PagedFlux listByDepartmentAsync(String billingAc */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByDepartment(String billingAccountName, String departmentName) { - return new PagedIterable<>(listByDepartmentAsync(billingAccountName, departmentName)); + return new PagedIterable<>(() -> listByDepartmentSinglePage(billingAccountName, departmentName), + nextLink -> listByDepartmentNextSinglePage(nextLink)); } /** @@ -1621,7 +1825,8 @@ public PagedIterable listByDepartment(String billingAcco @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByDepartment(String billingAccountName, String departmentName, Context context) { - return new PagedIterable<>(listByDepartmentAsync(billingAccountName, departmentName, context)); + return new PagedIterable<>(() -> listByDepartmentSinglePage(billingAccountName, departmentName, context), + nextLink -> listByDepartmentNextSinglePage(nextLink, context)); } /** @@ -1661,43 +1866,6 @@ private Mono>> checkAccessByDepartmentWi .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Provides a list of check access response objects for a department. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param departmentName The name of the department. - * @param parameters The request object against which access of the caller will be checked. - * @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 array of CheckAccessResponse along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> checkAccessByDepartmentWithResponseAsync( - String billingAccountName, String departmentName, CheckAccessRequest 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 (departmentName == null) { - return Mono.error(new IllegalArgumentException("Parameter departmentName 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.checkAccessByDepartment(this.client.getEndpoint(), billingAccountName, departmentName, - this.client.getApiVersion(), parameters, accept, context); - } - /** * Provides a list of check access response objects for a department. * @@ -1731,8 +1899,28 @@ private Mono> checkAccessByDepartmentAsync(String @ServiceMethod(returns = ReturnType.SINGLE) public Response> checkAccessByDepartmentWithResponse(String billingAccountName, String departmentName, CheckAccessRequest parameters, Context context) { - return checkAccessByDepartmentWithResponseAsync(billingAccountName, departmentName, parameters, context) - .block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (departmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.checkAccessByDepartmentSync(this.client.getEndpoint(), billingAccountName, departmentName, + this.client.getApiVersion(), parameters, accept, context); } /** @@ -1793,35 +1981,16 @@ public List checkAccessByDepartment(String billingAcco * * @param billingAccountName The ID that uniquely identifies a billing account. * @param enrollmentAccountName The name of the enrollment 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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByEnrollmentAccountSinglePageAsync( - String billingAccountName, String enrollmentAccountName, 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 (enrollmentAccountName == null) { - return Mono - .error(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByEnrollmentAccount(this.client.getEndpoint(), billingAccountName, enrollmentAccountName, - this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByEnrollmentAccountAsync(String billingAccountName, + String enrollmentAccountName) { + return new PagedFlux<>(() -> listByEnrollmentAccountSinglePageAsync(billingAccountName, enrollmentAccountName), + nextLink -> listByEnrollmentAccountNextSinglePageAsync(nextLink)); } /** @@ -1832,13 +2001,29 @@ private Mono> listByEnrollmentAccountSingl * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByEnrollmentAccountAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByEnrollmentAccountSinglePage(String billingAccountName, String enrollmentAccountName) { - return new PagedFlux<>(() -> listByEnrollmentAccountSinglePageAsync(billingAccountName, enrollmentAccountName), - nextLink -> listByEnrollmentAccountNextSinglePageAsync(nextLink)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (enrollmentAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByEnrollmentAccountSync(this.client.getEndpoint(), + billingAccountName, enrollmentAccountName, this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1850,14 +2035,29 @@ private PagedFlux listByEnrollmentAccountAsync(String bi * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByEnrollmentAccountAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByEnrollmentAccountSinglePage(String billingAccountName, String enrollmentAccountName, Context context) { - return new PagedFlux<>( - () -> listByEnrollmentAccountSinglePageAsync(billingAccountName, enrollmentAccountName, context), - nextLink -> listByEnrollmentAccountNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (enrollmentAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByEnrollmentAccountSync(this.client.getEndpoint(), + billingAccountName, enrollmentAccountName, this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1873,7 +2073,8 @@ private PagedFlux listByEnrollmentAccountAsync(String bi @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByEnrollmentAccount(String billingAccountName, String enrollmentAccountName) { - return new PagedIterable<>(listByEnrollmentAccountAsync(billingAccountName, enrollmentAccountName)); + return new PagedIterable<>(() -> listByEnrollmentAccountSinglePage(billingAccountName, enrollmentAccountName), + nextLink -> listByEnrollmentAccountNextSinglePage(nextLink)); } /** @@ -1890,7 +2091,9 @@ public PagedIterable listByEnrollmentAccount(String bill @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByEnrollmentAccount(String billingAccountName, String enrollmentAccountName, Context context) { - return new PagedIterable<>(listByEnrollmentAccountAsync(billingAccountName, enrollmentAccountName, context)); + return new PagedIterable<>( + () -> listByEnrollmentAccountSinglePage(billingAccountName, enrollmentAccountName, context), + nextLink -> listByEnrollmentAccountNextSinglePage(nextLink, context)); } /** @@ -1931,44 +2134,6 @@ private Mono>> checkAccessByEnrollmentAc .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Provides a list of check access response objects for an enrollment account. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param enrollmentAccountName The name of the enrollment account. - * @param parameters The request object against which access of the caller will be checked. - * @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 array of CheckAccessResponse along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> checkAccessByEnrollmentAccountWithResponseAsync( - String billingAccountName, String enrollmentAccountName, CheckAccessRequest 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 (enrollmentAccountName == null) { - return Mono - .error(new IllegalArgumentException("Parameter enrollmentAccountName 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.checkAccessByEnrollmentAccount(this.client.getEndpoint(), billingAccountName, - enrollmentAccountName, this.client.getApiVersion(), parameters, accept, context); - } - /** * Provides a list of check access response objects for an enrollment account. * @@ -2002,8 +2167,28 @@ private Mono> checkAccessByEnrollmentAccountAsync @ServiceMethod(returns = ReturnType.SINGLE) public Response> checkAccessByEnrollmentAccountWithResponse( String billingAccountName, String enrollmentAccountName, CheckAccessRequest parameters, Context context) { - return checkAccessByEnrollmentAccountWithResponseAsync(billingAccountName, enrollmentAccountName, parameters, - context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (enrollmentAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.checkAccessByEnrollmentAccountSync(this.client.getEndpoint(), billingAccountName, + enrollmentAccountName, this.client.getApiVersion(), parameters, accept, context); } /** @@ -2052,6 +2237,33 @@ private Mono> listByBillingAccountNextSing .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -2060,24 +2272,24 @@ private Mono> listByBillingAccountNextSing * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingAccountNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -2108,6 +2320,33 @@ private Mono> listByBillingProfileNextSing .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -2116,24 +2355,24 @@ private Mono> listByBillingProfileNextSing * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingProfileNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingProfileNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -2163,6 +2402,33 @@ private Mono> listByCustomerNextSinglePage .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByCustomerNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -2171,24 +2437,24 @@ private Mono> listByCustomerNextSinglePage * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByCustomerNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByCustomerNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByCustomerNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -2219,6 +2485,33 @@ private Mono> listByInvoiceSectionNextSing .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceSectionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByInvoiceSectionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -2227,24 +2520,24 @@ private Mono> listByInvoiceSectionNextSing * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByInvoiceSectionNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByInvoiceSectionNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByInvoiceSectionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -2275,6 +2568,33 @@ private Mono> listByInvoiceSectionNextSing .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerAtBillingAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByCustomerAtBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -2283,24 +2603,25 @@ private Mono> listByInvoiceSectionNextSing * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByCustomerAtBillingAccountNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listByCustomerAtBillingAccountNextSinglePage(String nextLink, + Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listByCustomerAtBillingAccountNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listByCustomerAtBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -2330,6 +2651,33 @@ private Mono> listByDepartmentNextSinglePa .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByDepartmentNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByDepartmentNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -2338,24 +2686,24 @@ private Mono> listByDepartmentNextSinglePa * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByDepartmentNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByDepartmentNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listByDepartmentNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listByDepartmentNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -2386,6 +2734,33 @@ private Mono> listByEnrollmentAccountNextS .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByEnrollmentAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByEnrollmentAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -2394,23 +2769,26 @@ private Mono> listByEnrollmentAccountNextS * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByEnrollmentAccountNextSinglePageAsync(String nextLink, + private PagedResponse listByEnrollmentAccountNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listByEnrollmentAccountNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listByEnrollmentAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(BillingPermissionsClientImpl.class); } 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 index f4382e2dcbe2..df1aac121fcf 100644 --- 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 @@ -28,8 +28,10 @@ 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.BinaryData; 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; @@ -81,6 +83,15 @@ Mono> validateDeleteEligibi @PathParam("billingProfileName") String billingProfileName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/validateDeleteEligibility") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response validateDeleteEligibilitySync( + @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" }) @Delete("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}") @ExpectedResponses({ 202, 204 }) @@ -90,6 +101,15 @@ Mono>> delete(@HostParam("$host") String endpoint, @PathParam("billingProfileName") String billingProfileName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@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}") @ExpectedResponses({ 200 }) @@ -99,6 +119,15 @@ Mono> get(@HostParam("$host") String endpoint, @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}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@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}") @ExpectedResponses({ 200, 201, 202 }) @@ -109,6 +138,16 @@ Mono>> createOrUpdate(@HostParam("$host") String endpo @BodyParam("application/json") BillingProfileInner parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}") + @ExpectedResponses({ 200, 201, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BillingProfileInner parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles") @ExpectedResponses({ 200 }) @@ -120,6 +159,17 @@ Mono> listByBillingAccount(@HostParam("$host" @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @QueryParam("includeDeleted") Boolean includeDeleted, @QueryParam("api-version") String apiVersion, + @QueryParam("filter") String filter, @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, + @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -127,6 +177,14 @@ Mono> listByBillingAccount(@HostParam("$host" 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) + Response listByBillingAccountNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -163,40 +221,6 @@ Mono> listByBillingAccountNext( .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Validates if the billing profile can be deleted. 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 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 eligibility to delete a billing profile result along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> validateDeleteEligibilityWithResponseAsync( - 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.validateDeleteEligibility(this.client.getEndpoint(), billingAccountName, billingProfileName, - this.client.getApiVersion(), accept, context); - } - /** * Validates if the billing profile can be deleted. The operation is supported for billing accounts with agreement * type Microsoft Customer Agreement and Microsoft Partner Agreement. @@ -230,7 +254,22 @@ private Mono validateDeleteEligibili @ServiceMethod(returns = ReturnType.SINGLE) public Response validateDeleteEligibilityWithResponse(String billingAccountName, String billingProfileName, Context context) { - return validateDeleteEligibilityWithResponseAsync(billingAccountName, billingProfileName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.validateDeleteEligibilitySync(this.client.getEndpoint(), billingAccountName, billingProfileName, + this.client.getApiVersion(), accept, context); } /** @@ -289,31 +328,29 @@ private Mono>> deleteWithResponseAsync(String billingA * * @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 {@link Response} on successful completion of {@link Mono}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String billingAccountName, - String billingProfileName, Context context) { + private Response deleteWithResponse(String billingAccountName, String billingProfileName) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), billingAccountName, billingProfileName, - this.client.getApiVersion(), accept, context); + return service.deleteSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + this.client.getApiVersion(), accept, Context.NONE); } /** @@ -322,16 +359,31 @@ private Mono>> deleteWithResponseAsync(String billingA * * @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 {@link PollerFlux} for polling of long-running operation. + * @return the response body along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String billingAccountName, String billingProfileName) { - Mono>> mono = deleteWithResponseAsync(billingAccountName, billingProfileName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String billingAccountName, String billingProfileName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + this.client.getApiVersion(), accept, context); } /** @@ -340,20 +392,16 @@ private PollerFlux, Void> beginDeleteAsync(String billingAccoun * * @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 {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String billingAccountName, String billingProfileName, - Context context) { - context = this.client.mergeContext(context); - Mono>> mono - = deleteWithResponseAsync(billingAccountName, billingProfileName, context); + private PollerFlux, Void> beginDeleteAsync(String billingAccountName, String billingProfileName) { + Mono>> mono = deleteWithResponseAsync(billingAccountName, billingProfileName); return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + this.client.getContext()); } /** @@ -369,7 +417,8 @@ private PollerFlux, Void> beginDeleteAsync(String billingAccoun */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String billingAccountName, String billingProfileName) { - return this.beginDeleteAsync(billingAccountName, billingProfileName).getSyncPoller(); + Response response = deleteWithResponse(billingAccountName, billingProfileName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -387,7 +436,8 @@ public SyncPoller, Void> beginDelete(String billingAccountName, @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String billingAccountName, String billingProfileName, Context context) { - return this.beginDeleteAsync(billingAccountName, billingProfileName, context).getSyncPoller(); + Response response = deleteWithResponse(billingAccountName, billingProfileName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); } /** @@ -407,24 +457,6 @@ private Mono deleteAsync(String billingAccountName, String billingProfileN .flatMap(this.client::getLroFinalResultOrError); } - /** - * Deletes a billing profile. 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 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 {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String billingAccountName, String billingProfileName, Context context) { - return beginDeleteAsync(billingAccountName, billingProfileName, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Deletes a billing profile. The operation is supported for billing accounts with agreement type Microsoft Customer * Agreement and Microsoft Partner Agreement. @@ -437,7 +469,7 @@ private Mono deleteAsync(String billingAccountName, String billingProfileN */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String billingAccountName, String billingProfileName) { - deleteAsync(billingAccountName, billingProfileName).block(); + beginDelete(billingAccountName, billingProfileName).getFinalResult(); } /** @@ -453,7 +485,7 @@ public void delete(String billingAccountName, String billingProfileName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String billingAccountName, String billingProfileName, Context context) { - deleteAsync(billingAccountName, billingProfileName, context).block(); + beginDelete(billingAccountName, billingProfileName, context).getFinalResult(); } /** @@ -489,39 +521,6 @@ private Mono> getWithResponseAsync(String billingA .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 and 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 a billing profile by its ID along with {@link Response} on successful completion of {@link Mono}. - */ - @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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), billingAccountName, billingProfileName, - this.client.getApiVersion(), accept, context); - } - /** * Gets a billing profile by its ID. The operation is supported for billing accounts with agreement type Microsoft * Customer Agreement and Microsoft Partner Agreement. @@ -554,7 +553,22 @@ private Mono getAsync(String billingAccountName, String bil @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String billingAccountName, String billingProfileName, Context context) { - return getWithResponseAsync(billingAccountName, billingProfileName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + this.client.getApiVersion(), accept, context); } /** @@ -621,36 +635,36 @@ private Mono>> createOrUpdateWithResponseAsync(String * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingProfileName The ID that uniquely identifies a billing profile. * @param parameters 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 billing profile along with {@link Response} on successful completion of {@link Mono}. + * @return a billing profile along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateWithResponseAsync(String billingAccountName, - String billingProfileName, BillingProfileInner parameters, Context context) { + private Response createOrUpdateWithResponse(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), billingAccountName, billingProfileName, - this.client.getApiVersion(), parameters, accept, context); + return service.createOrUpdateSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + this.client.getApiVersion(), parameters, accept, Context.NONE); } /** @@ -661,18 +675,37 @@ private Mono>> createOrUpdateWithResponseAsync(String * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingProfileName The ID that uniquely identifies a billing profile. * @param parameters 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 {@link PollerFlux} for polling of a billing profile. + * @return a billing profile along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - 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, this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String billingAccountName, String billingProfileName, + BillingProfileInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + this.client.getApiVersion(), parameters, accept, context); } /** @@ -683,20 +716,18 @@ private Mono>> createOrUpdateWithResponseAsync(String * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingProfileName The ID that uniquely identifies a billing profile. * @param parameters 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 {@link PollerFlux} for polling of a billing profile. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, BillingProfileInner> beginCreateOrUpdateAsync( - String billingAccountName, String billingProfileName, BillingProfileInner parameters, Context context) { - context = this.client.mergeContext(context); + private PollerFlux, BillingProfileInner> + beginCreateOrUpdateAsync(String billingAccountName, String billingProfileName, BillingProfileInner parameters) { Mono>> mono - = createOrUpdateWithResponseAsync(billingAccountName, billingProfileName, parameters, context); + = createOrUpdateWithResponseAsync(billingAccountName, billingProfileName, parameters); return this.client.getLroResult(mono, this.client.getHttpPipeline(), - BillingProfileInner.class, BillingProfileInner.class, context); + BillingProfileInner.class, BillingProfileInner.class, this.client.getContext()); } /** @@ -715,7 +746,9 @@ private PollerFlux, BillingProfileInner> beginCr @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, BillingProfileInner> beginCreateOrUpdate(String billingAccountName, String billingProfileName, BillingProfileInner parameters) { - return this.beginCreateOrUpdateAsync(billingAccountName, billingProfileName, parameters).getSyncPoller(); + Response response = createOrUpdateWithResponse(billingAccountName, billingProfileName, parameters); + return this.client.getLroResult(response, BillingProfileInner.class, + BillingProfileInner.class, Context.NONE); } /** @@ -735,8 +768,10 @@ private PollerFlux, BillingProfileInner> beginCr @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, BillingProfileInner> beginCreateOrUpdate( String billingAccountName, String billingProfileName, BillingProfileInner parameters, Context context) { - return this.beginCreateOrUpdateAsync(billingAccountName, billingProfileName, parameters, context) - .getSyncPoller(); + Response response + = createOrUpdateWithResponse(billingAccountName, billingProfileName, parameters, context); + return this.client.getLroResult(response, BillingProfileInner.class, + BillingProfileInner.class, context); } /** @@ -759,27 +794,6 @@ private Mono createOrUpdateAsync(String billingAccountName, .flatMap(this.client::getLroFinalResultOrError); } - /** - * Creates or updates a billing profile. The operation is supported for billing accounts with agreement type - * Microsoft Customer Agreement and Microsoft Partner Agreement. If you are a MCA Individual (Pay-as-you-go) - * customer, then please use the Azure portal experience to create the billing profile. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param parameters 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 billing profile on successful completion of {@link Mono}. - */ - @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 and Microsoft Partner Agreement. If you are a MCA Individual (Pay-as-you-go) @@ -796,7 +810,7 @@ private Mono createOrUpdateAsync(String billingAccountName, @ServiceMethod(returns = ReturnType.SINGLE) public BillingProfileInner createOrUpdate(String billingAccountName, String billingProfileName, BillingProfileInner parameters) { - return createOrUpdateAsync(billingAccountName, billingProfileName, parameters).block(); + return beginCreateOrUpdate(billingAccountName, billingProfileName, parameters).getFinalResult(); } /** @@ -816,7 +830,7 @@ public BillingProfileInner createOrUpdate(String billingAccountName, String bill @ServiceMethod(returns = ReturnType.SINGLE) public BillingProfileInner createOrUpdate(String billingAccountName, String billingProfileName, BillingProfileInner parameters, Context context) { - return createOrUpdateAsync(billingAccountName, billingProfileName, parameters, context).block(); + return beginCreateOrUpdate(billingAccountName, billingProfileName, parameters, context).getFinalResult(); } /** @@ -863,51 +877,6 @@ private Mono> listByBillingAccountSinglePageA .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 of type Microsoft Customer Agreement and Microsoft Partner Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param includeDeleted Can be used to get deleted billing profiles. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountSinglePageAsync(String billingAccountName, - Boolean includeDeleted, String filter, String orderBy, Long top, Long skip, Boolean count, String search, - 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingAccount(this.client.getEndpoint(), billingAccountName, includeDeleted, - this.client.getApiVersion(), filter, orderBy, top, skip, count, search, 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 of type Microsoft Customer Agreement and Microsoft Partner Agreement. @@ -960,6 +929,48 @@ private PagedFlux listByBillingAccountAsync(String billingA orderBy, top, skip, count, search), nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); } + /** + * Lists the billing profiles that a user has access to. The operation is supported for billing accounts with + * agreement of type Microsoft Customer Agreement and Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param includeDeleted Can be used to get deleted billing profiles. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, + Boolean includeDeleted, String filter, String orderBy, Long top, Long skip, Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountSync(this.client.getEndpoint(), billingAccountName, includeDeleted, + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, Context.NONE); + return 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 of type Microsoft Customer Agreement and Microsoft Partner Agreement. @@ -981,14 +992,27 @@ private PagedFlux listByBillingAccountAsync(String billingA * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName, Boolean includeDeleted, - String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>(() -> listByBillingAccountSinglePageAsync(billingAccountName, includeDeleted, filter, - orderBy, top, skip, count, search, context), - nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, + Boolean includeDeleted, String filter, String orderBy, Long top, Long skip, Boolean count, String search, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountSync(this.client.getEndpoint(), billingAccountName, includeDeleted, + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1010,8 +1034,8 @@ public PagedIterable listByBillingAccount(String billingAcc final Long skip = null; final Boolean count = null; final String search = null; - return new PagedIterable<>( - listByBillingAccountAsync(billingAccountName, includeDeleted, filter, orderBy, top, skip, count, search)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, includeDeleted, filter, + orderBy, top, skip, count, search), nextLink -> listByBillingAccountNextSinglePage(nextLink)); } /** @@ -1040,8 +1064,9 @@ public PagedIterable listByBillingAccount(String billingAcc @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingAccount(String billingAccountName, Boolean includeDeleted, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, includeDeleted, filter, orderBy, top, - skip, count, search, context)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, includeDeleted, filter, + orderBy, top, skip, count, search, context), + nextLink -> listByBillingAccountNextSinglePage(nextLink, context)); } /** @@ -1072,6 +1097,33 @@ private Mono> listByBillingAccountNextSingleP .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1080,23 +1132,25 @@ private Mono> listByBillingAccountNextSingleP * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingAccountNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(BillingProfilesClientImpl.class); } 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 index cdde1c6addd6..b5e2d937178f 100644 --- 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 @@ -23,6 +23,7 @@ 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; @@ -69,6 +70,16 @@ Mono> get(@HostParam("$host") String endpoint, @QueryParam("includeTransitionStatus") Boolean includeTransitionStatus, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("includeBillingCountry") Boolean includeBillingCountry, + @QueryParam("includeTransitionStatus") Boolean includeTransitionStatus, + @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 }) @@ -77,6 +88,15 @@ 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); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/providers/Microsoft.Billing/billingProperty/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BillingPropertyInner parameters, @HeaderParam("Accept") String accept, + Context context); } /** @@ -109,36 +129,6 @@ private Mono> getWithResponseAsync(Boolean includ .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets the billing properties for a subscription. - * - * @param includeBillingCountry A flag that specifies whether or not to include billing country. - * @param includeTransitionStatus A flag that specifies whether or not to include transition status for billing - * accounts with agreement type Microsoft Customer 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 along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(Boolean includeBillingCountry, - Boolean includeTransitionStatus, 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), includeBillingCountry, - includeTransitionStatus, this.client.getApiVersion(), accept, context); - } - /** * Gets the billing properties for a subscription. * @@ -169,7 +159,19 @@ private Mono getAsync() { @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(Boolean includeBillingCountry, Boolean includeTransitionStatus, Context context) { - return getWithResponseAsync(includeBillingCountry, includeTransitionStatus, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getSubscriptionId(), includeBillingCountry, + includeTransitionStatus, this.client.getApiVersion(), accept, context); } /** @@ -219,40 +221,6 @@ private Mono> updateWithResponseAsync(BillingProp .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Updates the billing property of a subscription. Currently, cost center can be updated for billing accounts with - * agreement type Microsoft Customer Agreement and subscription service usage address can be updated for billing - * accounts with agreement type Microsoft Online Service Program. - * - * @param parameters A billing property. - * @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 along with {@link Response} on successful completion of {@link Mono}. - */ - @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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), this.client.getApiVersion(), - parameters, accept, context); - } - /** * Updates the billing property of a subscription. Currently, cost center can be updated for billing accounts with * agreement type Microsoft Customer Agreement and subscription service usage address can be updated for billing @@ -283,7 +251,25 @@ private Mono updateAsync(BillingPropertyInner parameters) */ @ServiceMethod(returns = ReturnType.SINGLE) public Response updateWithResponse(BillingPropertyInner parameters, Context context) { - return updateWithResponseAsync(parameters, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getApiVersion(), parameters, accept, context); } /** @@ -301,4 +287,6 @@ public Response updateWithResponse(BillingPropertyInner pa public BillingPropertyInner update(BillingPropertyInner parameters) { return updateWithResponse(parameters, Context.NONE).getValue(); } + + private static final ClientLogger LOGGER = new ClientLogger(BillingPropertiesClientImpl.class); } diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRequestsClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRequestsClientImpl.java index dd33be1e3acd..e8b024372864 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRequestsClientImpl.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingRequestsClientImpl.java @@ -26,8 +26,10 @@ 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.BinaryData; 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.BillingRequestsClient; @@ -80,6 +82,17 @@ Mono> listByBillingProfile(@HostParam("$host" @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRequests") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingProfileSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @QueryParam("api-version") String apiVersion, + @QueryParam("filter") String filter, @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, + @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/billingRequests") @ExpectedResponses({ 200 }) @@ -92,6 +105,18 @@ Mono> listByCustomer(@HostParam("$host") Stri @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/billingRequests") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByCustomerSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @PathParam("customerName") String customerName, + @QueryParam("api-version") String apiVersion, @QueryParam("filter") String filter, + @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, @QueryParam("skip") Long skip, + @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRequests") @ExpectedResponses({ 200 }) @@ -104,6 +129,18 @@ Mono> listByInvoiceSection(@HostParam("$host" @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRequests") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByInvoiceSectionSync(@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, @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, + @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRequests") @ExpectedResponses({ 200 }) @@ -114,6 +151,16 @@ Mono> listByBillingAccount(@HostParam("$host" @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRequests") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @QueryParam("api-version") String apiVersion, + @QueryParam("filter") String filter, @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, + @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingRequests/{billingRequestName}") @ExpectedResponses({ 200 }) @@ -122,6 +169,14 @@ Mono> get(@HostParam("$host") String endpoint, @PathParam("billingRequestName") String billingRequestName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingRequests/{billingRequestName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("billingRequestName") String billingRequestName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Put("/providers/Microsoft.Billing/billingRequests/{billingRequestName}") @ExpectedResponses({ 200, 201 }) @@ -131,6 +186,15 @@ Mono>> createOrUpdate(@HostParam("$host") String endpo @BodyParam("application/json") BillingRequestInner parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/providers/Microsoft.Billing/billingRequests/{billingRequestName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @PathParam("billingRequestName") String billingRequestName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BillingRequestInner parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingRequests") @ExpectedResponses({ 200 }) @@ -141,6 +205,16 @@ Mono> listByUser(@HostParam("$host") String e @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingRequests") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByUserSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @QueryParam("filter") String filter, + @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, @QueryParam("skip") Long skip, + @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -149,6 +223,14 @@ 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) + Response listByBillingProfileNextSync( + @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 }) @@ -157,6 +239,14 @@ 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) + Response listByCustomerNextSync( + @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 }) @@ -165,6 +255,14 @@ 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) + Response listByInvoiceSectionNextSync( + @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 }) @@ -173,6 +271,14 @@ 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) + Response listByBillingAccountNextSync( + @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 }) @@ -180,6 +286,14 @@ Mono> listByBillingAccountNext( Mono> listByUserNext( @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) + Response listByUserNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -229,54 +343,6 @@ private Mono> listByBillingProfileSinglePageA .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * The list of billing requests submitted for the billing profile. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingProfileSinglePageAsync(String billingAccountName, - String billingProfileName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, - 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingProfile(this.client.getEndpoint(), billingAccountName, billingProfileName, - this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - /** * The list of billing requests submitted for the billing profile. * @@ -328,6 +394,51 @@ private PagedFlux listByBillingProfileAsync(String billingA orderBy, top, skip, count, search), nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); } + /** + * The list of billing requests submitted for the billing profile. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, + String billingProfileName, String filter, String orderBy, Long top, Long skip, Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingProfileSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * The list of billing requests submitted for the billing profile. * @@ -348,15 +459,31 @@ private PagedFlux listByBillingProfileAsync(String billingA * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingProfileAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, String billingProfileName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>(() -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, filter, - orderBy, top, skip, count, search, context), - nextLink -> listByBillingProfileNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingProfileSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -378,8 +505,8 @@ public PagedIterable listByBillingProfile(String billingAcc final Long skip = null; final Boolean count = null; final String search = null; - return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, filter, orderBy, - top, skip, count, search)); + return new PagedIterable<>(() -> listByBillingProfileSinglePage(billingAccountName, billingProfileName, filter, + orderBy, top, skip, count, search), nextLink -> listByBillingProfileNextSinglePage(nextLink)); } /** @@ -407,8 +534,9 @@ public PagedIterable listByBillingProfile(String billingAcc @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, filter, orderBy, - top, skip, count, search, context)); + return new PagedIterable<>(() -> listByBillingProfileSinglePage(billingAccountName, billingProfileName, filter, + orderBy, top, skip, count, search, context), + nextLink -> listByBillingProfileNextSinglePage(nextLink, context)); } /** @@ -463,58 +591,6 @@ private Mono> listByCustomerSinglePageAsync(S .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * The list of billing requests submitted for the customer. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param customerName The ID that uniquely identifies a customer. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByCustomerSinglePageAsync(String billingAccountName, - String billingProfileName, String customerName, String filter, String orderBy, Long top, Long skip, - Boolean count, String search, 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 (customerName == null) { - return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByCustomer(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName, - this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - /** * The list of billing requests submitted for the customer. * @@ -568,6 +644,57 @@ private PagedFlux listByCustomerAsync(String billingAccount filter, orderBy, top, skip, count, search), nextLink -> listByCustomerNextSinglePageAsync(nextLink)); } + /** + * The list of billing requests submitted for the customer. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerSinglePage(String billingAccountName, + String billingProfileName, String customerName, String filter, String orderBy, Long top, Long skip, + Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByCustomerSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, customerName, this.client.getApiVersion(), filter, orderBy, top, + skip, count, search, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * The list of billing requests submitted for the customer. * @@ -589,15 +716,35 @@ private PagedFlux listByCustomerAsync(String billingAccount * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByCustomerAsync(String billingAccountName, String billingProfileName, - String customerName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, - Context context) { - return new PagedFlux<>(() -> listByCustomerSinglePageAsync(billingAccountName, billingProfileName, customerName, - filter, orderBy, top, skip, count, search, context), - nextLink -> listByCustomerNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerSinglePage(String billingAccountName, + String billingProfileName, String customerName, String filter, String orderBy, Long top, Long skip, + Boolean count, String search, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByCustomerSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + customerName, this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -620,8 +767,8 @@ public PagedIterable listByCustomer(String billingAccountNa final Long skip = null; final Boolean count = null; final String search = null; - return new PagedIterable<>(listByCustomerAsync(billingAccountName, billingProfileName, customerName, filter, - orderBy, top, skip, count, search)); + return new PagedIterable<>(() -> listByCustomerSinglePage(billingAccountName, billingProfileName, customerName, + filter, orderBy, top, skip, count, search), nextLink -> listByCustomerNextSinglePage(nextLink)); } /** @@ -651,8 +798,9 @@ public PagedIterable listByCustomer(String billingAccountNa public PagedIterable listByCustomer(String billingAccountName, String billingProfileName, String customerName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByCustomerAsync(billingAccountName, billingProfileName, customerName, filter, - orderBy, top, skip, count, search, context)); + return new PagedIterable<>(() -> listByCustomerSinglePage(billingAccountName, billingProfileName, customerName, + filter, orderBy, top, skip, count, search, context), + nextLink -> listByCustomerNextSinglePage(nextLink, context)); } /** @@ -708,59 +856,6 @@ private Mono> listByInvoiceSectionSinglePageA .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * The list of billing requests submitted for the 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 filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByInvoiceSectionSinglePageAsync(String billingAccountName, - String billingProfileName, String invoiceSectionName, String filter, String orderBy, Long top, Long skip, - Boolean count, String search, 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByInvoiceSection(this.client.getEndpoint(), billingAccountName, billingProfileName, invoiceSectionName, - this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - /** * The list of billing requests submitted for the invoice section. * @@ -819,6 +914,57 @@ private PagedFlux listByInvoiceSectionAsync(String billingA nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink)); } + /** + * The list of billing requests submitted for the 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 filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceSectionSinglePage(String billingAccountName, + String billingProfileName, String invoiceSectionName, String filter, String orderBy, Long top, Long skip, + Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByInvoiceSectionSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, invoiceSectionName, this.client.getApiVersion(), filter, orderBy, + top, skip, count, search, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * The list of billing requests submitted for the invoice section. * @@ -840,16 +986,35 @@ private PagedFlux listByInvoiceSectionAsync(String billingA * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByInvoiceSectionAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceSectionSinglePage(String billingAccountName, String billingProfileName, String invoiceSectionName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>( - () -> listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName, - filter, orderBy, top, skip, count, search, context), - nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByInvoiceSectionSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, invoiceSectionName, this.client.getApiVersion(), filter, orderBy, + top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -872,8 +1037,9 @@ public PagedIterable listByInvoiceSection(String billingAcc final Long skip = null; final Boolean count = null; final String search = null; - return new PagedIterable<>(listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, - filter, orderBy, top, skip, count, search)); + return new PagedIterable<>(() -> listByInvoiceSectionSinglePage(billingAccountName, billingProfileName, + invoiceSectionName, filter, orderBy, top, skip, count, search), + nextLink -> listByInvoiceSectionNextSinglePage(nextLink)); } /** @@ -903,8 +1069,10 @@ public PagedIterable listByInvoiceSection(String billingAcc public PagedIterable listByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, - filter, orderBy, top, skip, count, search, context)); + return new PagedIterable<>( + () -> listByInvoiceSectionSinglePage(billingAccountName, billingProfileName, invoiceSectionName, filter, + orderBy, top, skip, count, search, context), + nextLink -> listByInvoiceSectionNextSinglePage(nextLink, context)); } /** @@ -948,48 +1116,6 @@ private Mono> listByBillingAccountSinglePageA .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * The list of billing requests submitted for the billing account. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountSinglePageAsync(String billingAccountName, - String filter, String orderBy, Long top, Long skip, Boolean count, String search, 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingAccount(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), filter, - orderBy, top, skip, count, search, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - /** * The list of billing requests submitted for the billing account. * @@ -1040,6 +1166,46 @@ private PagedFlux listByBillingAccountAsync(String billingA nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); } + /** + * The list of billing requests submitted for the billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, String filter, + String orderBy, Long top, Long skip, Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountSync(this.client.getEndpoint(), billingAccountName, + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * The list of billing requests submitted for the billing account. * @@ -1059,13 +1225,26 @@ private PagedFlux listByBillingAccountAsync(String billingA * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName, String filter, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>(() -> listByBillingAccountSinglePageAsync(billingAccountName, filter, orderBy, top, skip, - count, search, context), nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountSync(this.client.getEndpoint(), billingAccountName, + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1086,7 +1265,8 @@ public PagedIterable listByBillingAccount(String billingAcc final Boolean count = null; final String search = null; return new PagedIterable<>( - listByBillingAccountAsync(billingAccountName, filter, orderBy, top, skip, count, search)); + () -> listByBillingAccountSinglePage(billingAccountName, filter, orderBy, top, skip, count, search), + nextLink -> listByBillingAccountNextSinglePage(nextLink)); } /** @@ -1113,8 +1293,8 @@ public PagedIterable listByBillingAccount(String billingAcc @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingAccount(String billingAccountName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>( - listByBillingAccountAsync(billingAccountName, filter, orderBy, top, skip, count, search, context)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, filter, orderBy, top, skip, + count, search, context), nextLink -> listByBillingAccountNextSinglePage(nextLink, context)); } /** @@ -1143,31 +1323,6 @@ private Mono> getWithResponseAsync(String billingR .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets a billing request by its ID. - * - * @param billingRequestName The ID that uniquely identifies a billing request. - * @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 request by its ID along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String billingRequestName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (billingRequestName == null) { - return Mono - .error(new IllegalArgumentException("Parameter billingRequestName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), billingRequestName, this.client.getApiVersion(), accept, context); - } - /** * Gets a billing request by its ID. * @@ -1194,7 +1349,18 @@ private Mono getAsync(String billingRequestName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String billingRequestName, Context context) { - return getWithResponseAsync(billingRequestName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingRequestName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingRequestName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), billingRequestName, this.client.getApiVersion(), accept, + context); } /** @@ -1252,33 +1418,31 @@ private Mono>> createOrUpdateWithResponseAsync(String * @param billingRequestName The ID that uniquely identifies a billing request. * @param parameters A request submitted by a user to manage billing. Users with an owner role on the scope can * approve or decline these requests. - * @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 request submitted by a user to manage billing along with {@link Response} on successful completion of - * {@link Mono}. + * @return a request submitted by a user to manage billing along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateWithResponseAsync(String billingRequestName, - BillingRequestInner parameters, Context context) { + private Response createOrUpdateWithResponse(String billingRequestName, BillingRequestInner parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (billingRequestName == null) { - return Mono - .error(new IllegalArgumentException("Parameter billingRequestName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingRequestName is required and cannot be null.")); } if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), billingRequestName, this.client.getApiVersion(), - parameters, accept, context); + return service.createOrUpdateSync(this.client.getEndpoint(), billingRequestName, this.client.getApiVersion(), + parameters, accept, Context.NONE); } /** @@ -1287,17 +1451,33 @@ private Mono>> createOrUpdateWithResponseAsync(String * @param billingRequestName The ID that uniquely identifies a billing request. * @param parameters A request submitted by a user to manage billing. Users with an owner role on the scope can * approve or decline these requests. + * @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 {@link PollerFlux} for polling of a request submitted by a user to manage billing. + * @return a request submitted by a user to manage billing along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, BillingRequestInner> - beginCreateOrUpdateAsync(String billingRequestName, BillingRequestInner parameters) { - Mono>> mono = createOrUpdateWithResponseAsync(billingRequestName, parameters); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), - BillingRequestInner.class, BillingRequestInner.class, this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String billingRequestName, BillingRequestInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingRequestName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingRequestName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), billingRequestName, this.client.getApiVersion(), + parameters, accept, context); } /** @@ -1306,7 +1486,6 @@ private Mono>> createOrUpdateWithResponseAsync(String * @param billingRequestName The ID that uniquely identifies a billing request. * @param parameters A request submitted by a user to manage billing. Users with an owner role on the scope can * approve or decline these requests. - * @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. @@ -1314,12 +1493,10 @@ private Mono>> createOrUpdateWithResponseAsync(String */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, BillingRequestInner> - beginCreateOrUpdateAsync(String billingRequestName, BillingRequestInner parameters, Context context) { - context = this.client.mergeContext(context); - Mono>> mono - = createOrUpdateWithResponseAsync(billingRequestName, parameters, context); + beginCreateOrUpdateAsync(String billingRequestName, BillingRequestInner parameters) { + Mono>> mono = createOrUpdateWithResponseAsync(billingRequestName, parameters); return this.client.getLroResult(mono, this.client.getHttpPipeline(), - BillingRequestInner.class, BillingRequestInner.class, context); + BillingRequestInner.class, BillingRequestInner.class, this.client.getContext()); } /** @@ -1336,7 +1513,9 @@ private Mono>> createOrUpdateWithResponseAsync(String @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, BillingRequestInner> beginCreateOrUpdate(String billingRequestName, BillingRequestInner parameters) { - return this.beginCreateOrUpdateAsync(billingRequestName, parameters).getSyncPoller(); + Response response = createOrUpdateWithResponse(billingRequestName, parameters); + return this.client.getLroResult(response, BillingRequestInner.class, + BillingRequestInner.class, Context.NONE); } /** @@ -1354,7 +1533,9 @@ private Mono>> createOrUpdateWithResponseAsync(String @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, BillingRequestInner> beginCreateOrUpdate(String billingRequestName, BillingRequestInner parameters, Context context) { - return this.beginCreateOrUpdateAsync(billingRequestName, parameters, context).getSyncPoller(); + Response response = createOrUpdateWithResponse(billingRequestName, parameters, context); + return this.client.getLroResult(response, BillingRequestInner.class, + BillingRequestInner.class, context); } /** @@ -1374,25 +1555,6 @@ private Mono createOrUpdateAsync(String billingRequestName, .flatMap(this.client::getLroFinalResultOrError); } - /** - * Create or update a billing request. - * - * @param billingRequestName The ID that uniquely identifies a billing request. - * @param parameters A request submitted by a user to manage billing. Users with an owner role on the scope can - * approve or decline these requests. - * @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 request submitted by a user to manage billing on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String billingRequestName, BillingRequestInner parameters, - Context context) { - return beginCreateOrUpdateAsync(billingRequestName, parameters, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Create or update a billing request. * @@ -1406,7 +1568,7 @@ private Mono createOrUpdateAsync(String billingRequestName, */ @ServiceMethod(returns = ReturnType.SINGLE) public BillingRequestInner createOrUpdate(String billingRequestName, BillingRequestInner parameters) { - return createOrUpdateAsync(billingRequestName, parameters).block(); + return beginCreateOrUpdate(billingRequestName, parameters).getFinalResult(); } /** @@ -1424,7 +1586,7 @@ public BillingRequestInner createOrUpdate(String billingRequestName, BillingRequ @ServiceMethod(returns = ReturnType.SINGLE) public BillingRequestInner createOrUpdate(String billingRequestName, BillingRequestInner parameters, Context context) { - return createOrUpdateAsync(billingRequestName, parameters, context).block(); + return beginCreateOrUpdate(billingRequestName, parameters, context).getFinalResult(); } /** @@ -1463,43 +1625,6 @@ private Mono> listByUserSinglePageAsync(Strin .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * The list of billing requests submitted by a user. - * - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByUserSinglePageAsync(String filter, String orderBy, Long top, - Long skip, Boolean count, String search, Context context) { - 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 - .listByUser(this.client.getEndpoint(), this.client.getApiVersion(), filter, orderBy, top, skip, count, - search, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - /** * The list of billing requests submitted by a user. * @@ -1545,6 +1670,40 @@ private PagedFlux listByUserAsync() { nextLink -> listByUserNextSinglePageAsync(nextLink)); } + /** + * The list of billing requests submitted by a user. + * + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByUserSinglePage(String filter, String orderBy, Long top, Long skip, + Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByUserSync(this.client.getEndpoint(), + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * The list of billing requests submitted by a user. * @@ -1563,13 +1722,21 @@ private PagedFlux listByUserAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByUserAsync(String filter, String orderBy, Long top, Long skip, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByUserSinglePage(String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>(() -> listByUserSinglePageAsync(filter, orderBy, top, skip, count, search, context), - nextLink -> listByUserNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByUserSync(this.client.getEndpoint(), + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1587,7 +1754,8 @@ public PagedIterable listByUser() { final Long skip = null; final Boolean count = null; final String search = null; - return new PagedIterable<>(listByUserAsync(filter, orderBy, top, skip, count, search)); + return new PagedIterable<>(() -> listByUserSinglePage(filter, orderBy, top, skip, count, search), + nextLink -> listByUserNextSinglePage(nextLink)); } /** @@ -1613,7 +1781,8 @@ public PagedIterable listByUser() { @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByUser(String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByUserAsync(filter, orderBy, top, skip, count, search, context)); + return new PagedIterable<>(() -> listByUserSinglePage(filter, orderBy, top, skip, count, search, context), + nextLink -> listByUserNextSinglePage(nextLink, context)); } /** @@ -1644,6 +1813,33 @@ private Mono> listByBillingProfileNextSingleP .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1652,24 +1848,24 @@ private Mono> listByBillingProfileNextSingleP * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingProfileNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingProfileNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1699,6 +1895,33 @@ private Mono> listByCustomerNextSinglePageAsy .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByCustomerNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1707,24 +1930,24 @@ private Mono> listByCustomerNextSinglePageAsy * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByCustomerNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByCustomerNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByCustomerNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1755,6 +1978,33 @@ private Mono> listByInvoiceSectionNextSingleP .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceSectionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByInvoiceSectionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1763,24 +2013,24 @@ private Mono> listByInvoiceSectionNextSingleP * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByInvoiceSectionNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByInvoiceSectionNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByInvoiceSectionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1811,6 +2061,33 @@ private Mono> listByBillingAccountNextSingleP .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1819,24 +2096,24 @@ private Mono> listByBillingAccountNextSingleP * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingAccountNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1866,6 +2143,33 @@ private Mono> listByUserNextSinglePageAsync(S .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByUserNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByUserNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1874,22 +2178,25 @@ private Mono> listByUserNextSinglePageAsync(S * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByUserNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listByUserNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listByUserNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listByUserNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(BillingRequestsClientImpl.class); } 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 index fd41bf8ef65c..285791d4631b 100644 --- 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 @@ -28,8 +28,10 @@ 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.BinaryData; 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.BillingRoleAssignmentsClient; @@ -82,6 +84,16 @@ Mono> deleteByBillingProfile(@HostParam("$host") String endpoint, @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteByBillingProfileSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments/{billingRoleAssignmentName}") @ExpectedResponses({ 200 }) @@ -92,6 +104,16 @@ Mono> getByBillingProfile(@HostParam("$host @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, @QueryParam("api-version") String apiVersion, @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) + Response getByBillingProfileSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleAssignments") @ExpectedResponses({ 200 }) @@ -102,6 +124,16 @@ Mono> listByBillingProfile(@HostP @QueryParam("filter") String filter, @QueryParam("top") Long top, @QueryParam("skip") Long skip, @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) + Response listByBillingProfileSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @QueryParam("api-version") String apiVersion, + @QueryParam("filter") String filter, @QueryParam("top") Long top, @QueryParam("skip") Long skip, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/createBillingRoleAssignment") @ExpectedResponses({ 200, 202 }) @@ -112,6 +144,16 @@ Mono>> createByBillingProfile(@HostParam("$host") Stri @BodyParam("application/json") BillingRoleAssignmentProperties parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/createBillingRoleAssignment") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createByBillingProfileSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BillingRoleAssignmentProperties parameters, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Delete("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/billingRoleAssignments/{billingRoleAssignmentName}") @ExpectedResponses({ 200, 204 }) @@ -122,6 +164,16 @@ Mono> deleteByCustomer(@HostParam("$host") String endpoint, @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/billingRoleAssignments/{billingRoleAssignmentName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteByCustomerSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @PathParam("customerName") String customerName, + @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/billingRoleAssignments/{billingRoleAssignmentName}") @ExpectedResponses({ 200 }) @@ -132,6 +184,16 @@ Mono> getByCustomer(@HostParam("$host") Str @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/billingRoleAssignments/{billingRoleAssignmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByCustomerSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @PathParam("customerName") String customerName, + @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/billingRoleAssignments") @ExpectedResponses({ 200 }) @@ -143,6 +205,17 @@ Mono> listByCustomer(@HostParam(" @QueryParam("top") Long top, @QueryParam("skip") Long skip, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/billingRoleAssignments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByCustomerSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @PathParam("customerName") String customerName, + @QueryParam("api-version") String apiVersion, @QueryParam("filter") String filter, + @QueryParam("top") Long top, @QueryParam("skip") Long skip, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/createBillingRoleAssignment") @ExpectedResponses({ 200, 202 }) @@ -154,6 +227,17 @@ Mono>> createByCustomer(@HostParam("$host") String end @BodyParam("application/json") BillingRoleAssignmentProperties parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/createBillingRoleAssignment") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createByCustomerSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @PathParam("customerName") String customerName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BillingRoleAssignmentProperties parameters, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/resolveBillingRoleAssignments") @ExpectedResponses({ 200, 202 }) @@ -165,6 +249,17 @@ Mono>> resolveByCustomer(@HostParam("$host") String en @QueryParam("api-version") String apiVersion, @QueryParam("filter") String filter, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/resolveBillingRoleAssignments") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response resolveByCustomerSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @PathParam("customerName") String customerName, + @QueryParam("resolveScopeDisplayNames") Boolean resolveScopeDisplayNames, + @QueryParam("api-version") String apiVersion, @QueryParam("filter") String filter, + @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, 204 }) @@ -176,6 +271,17 @@ Mono> deleteByInvoiceSection(@HostParam("$host") String endpoint, @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, @QueryParam("api-version") String apiVersion, @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, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteByInvoiceSectionSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("invoiceSectionName") String invoiceSectionName, + @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, + @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}/billingRoleAssignments/{billingRoleAssignmentName}") @ExpectedResponses({ 200 }) @@ -187,6 +293,17 @@ Mono> getByInvoiceSection(@HostParam("$host @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, @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}/billingRoleAssignments/{billingRoleAssignmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByInvoiceSectionSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("invoiceSectionName") String invoiceSectionName, + @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, + @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}/billingRoleAssignments") @ExpectedResponses({ 200 }) @@ -198,6 +315,17 @@ Mono> listByInvoiceSection(@HostP @QueryParam("filter") String filter, @QueryParam("top") Long top, @QueryParam("skip") Long skip, @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) + Response listByInvoiceSectionSync(@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, @QueryParam("top") Long top, @QueryParam("skip") Long skip, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/createBillingRoleAssignment") @ExpectedResponses({ 200, 202 }) @@ -209,6 +337,17 @@ Mono>> createByInvoiceSection(@HostParam("$host") Stri @BodyParam("application/json") BillingRoleAssignmentProperties parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/createBillingRoleAssignment") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createByInvoiceSectionSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("invoiceSectionName") String invoiceSectionName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BillingRoleAssignmentProperties parameters, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/resolveBillingRoleAssignments") @ExpectedResponses({ 200, 202 }) @@ -221,6 +360,18 @@ Mono>> resolveByInvoiceSection(@HostParam("$host") Str @QueryParam("api-version") String apiVersion, @QueryParam("filter") String filter, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/resolveBillingRoleAssignments") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response resolveByInvoiceSectionSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("invoiceSectionName") String invoiceSectionName, + @QueryParam("resolveScopeDisplayNames") Boolean resolveScopeDisplayNames, + @QueryParam("api-version") String apiVersion, @QueryParam("filter") String filter, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/resolveBillingRoleAssignments") @ExpectedResponses({ 200, 202 }) @@ -232,6 +383,17 @@ Mono>> resolveByBillingProfile(@HostParam("$host") Str @QueryParam("api-version") String apiVersion, @QueryParam("filter") String filter, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/resolveBillingRoleAssignments") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response resolveByBillingProfileSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @QueryParam("resolveScopeDisplayNames") Boolean resolveScopeDisplayNames, + @QueryParam("api-version") String apiVersion, @QueryParam("filter") String filter, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Delete("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}") @ExpectedResponses({ 200, 204 }) @@ -241,6 +403,15 @@ Mono> deleteByBillingAccount(@HostParam("$host") String endpoint, @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}") @ExpectedResponses({ 200 }) @@ -250,6 +421,15 @@ Mono> getByBillingAccount(@HostParam("$host @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}") @ExpectedResponses({ 200, 201 }) @@ -261,6 +441,17 @@ Mono>> createOrUpdateByBillingAccount(@HostParam("$hos @BodyParam("application/json") BillingRoleAssignmentInner parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments/{billingRoleAssignmentName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BillingRoleAssignmentInner parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments") @ExpectedResponses({ 200 }) @@ -270,6 +461,15 @@ Mono> listByBillingAccount(@HostP @QueryParam("filter") String filter, @QueryParam("top") Long top, @QueryParam("skip") Long skip, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleAssignments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @QueryParam("api-version") String apiVersion, + @QueryParam("filter") String filter, @QueryParam("top") Long top, @QueryParam("skip") Long skip, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/createBillingRoleAssignment") @ExpectedResponses({ 200, 202 }) @@ -279,6 +479,15 @@ Mono>> createByBillingAccount(@HostParam("$host") Stri @BodyParam("application/json") BillingRoleAssignmentProperties parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/createBillingRoleAssignment") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BillingRoleAssignmentProperties parameters, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Delete("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingRoleAssignments/{billingRoleAssignmentName}") @ExpectedResponses({ 200, 204 }) @@ -289,6 +498,16 @@ Mono> deleteByDepartment(@HostParam("$host") String endpoint, @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingRoleAssignments/{billingRoleAssignmentName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteByDepartmentSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("departmentName") String departmentName, + @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingRoleAssignments/{billingRoleAssignmentName}") @ExpectedResponses({ 200 }) @@ -299,6 +518,16 @@ Mono> getByDepartment(@HostParam("$host") S @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingRoleAssignments/{billingRoleAssignmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByDepartmentSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("departmentName") String departmentName, + @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingRoleAssignments/{billingRoleAssignmentName}") @ExpectedResponses({ 200, 201 }) @@ -311,6 +540,18 @@ Mono>> createOrUpdateByDepartment(@HostParam("$host") @BodyParam("application/json") BillingRoleAssignmentInner parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingRoleAssignments/{billingRoleAssignmentName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateByDepartmentSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("departmentName") String departmentName, + @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BillingRoleAssignmentInner parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingRoleAssignments") @ExpectedResponses({ 200 }) @@ -320,6 +561,15 @@ Mono> listByDepartment(@HostParam @PathParam("departmentName") String departmentName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingRoleAssignments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByDepartmentSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("departmentName") String departmentName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Delete("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleAssignments/{billingRoleAssignmentName}") @ExpectedResponses({ 200, 204 }) @@ -330,6 +580,16 @@ Mono> deleteByEnrollmentAccount(@HostParam("$host") String endpoi @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleAssignments/{billingRoleAssignmentName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteByEnrollmentAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("enrollmentAccountName") String enrollmentAccountName, + @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleAssignments/{billingRoleAssignmentName}") @ExpectedResponses({ 200 }) @@ -340,6 +600,16 @@ Mono> getByEnrollmentAccount(@HostParam("$h @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleAssignments/{billingRoleAssignmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByEnrollmentAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("enrollmentAccountName") String enrollmentAccountName, + @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleAssignments/{billingRoleAssignmentName}") @ExpectedResponses({ 200, 201 }) @@ -352,6 +622,18 @@ Mono>> createOrUpdateByEnrollmentAccount(@HostParam("$ @BodyParam("application/json") BillingRoleAssignmentInner parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleAssignments/{billingRoleAssignmentName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateByEnrollmentAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("enrollmentAccountName") String enrollmentAccountName, + @PathParam("billingRoleAssignmentName") String billingRoleAssignmentName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BillingRoleAssignmentInner parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleAssignments") @ExpectedResponses({ 200 }) @@ -361,6 +643,15 @@ Mono> listByEnrollmentAccount( @PathParam("enrollmentAccountName") String enrollmentAccountName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleAssignments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByEnrollmentAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("enrollmentAccountName") String enrollmentAccountName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/resolveBillingRoleAssignments") @ExpectedResponses({ 200, 202 }) @@ -371,6 +662,16 @@ Mono>> resolveByBillingAccount(@HostParam("$host") Str @QueryParam("api-version") String apiVersion, @QueryParam("filter") String filter, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/resolveBillingRoleAssignments") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response resolveByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @QueryParam("resolveScopeDisplayNames") Boolean resolveScopeDisplayNames, + @QueryParam("api-version") String apiVersion, @QueryParam("filter") String filter, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -379,6 +680,14 @@ 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) + Response listByBillingProfileNextSync( + @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 }) @@ -387,6 +696,14 @@ 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) + Response listByCustomerNextSync( + @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 }) @@ -395,6 +712,14 @@ 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) + Response listByInvoiceSectionNextSync( + @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 }) @@ -403,6 +728,14 @@ 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) + Response listByBillingAccountNextSync( + @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 }) @@ -411,6 +744,14 @@ Mono> listByDepartmentNext( @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) + Response listByDepartmentNextSync( + @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 }) @@ -418,6 +759,14 @@ Mono> listByDepartmentNext( Mono> listByEnrollmentAccountNext( @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) + Response listByEnrollmentAccountNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -458,44 +807,6 @@ private Mono> deleteByBillingProfileWithResponseAsync(String bill .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Deletes a role assignment 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 {@link Response} on successful completion of {@link Mono}. - */ - @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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.deleteByBillingProfile(this.client.getEndpoint(), billingAccountName, billingProfileName, - billingRoleAssignmentName, this.client.getApiVersion(), accept, context); - } - /** * Deletes a role assignment on a billing profile. The operation is supported for billing accounts with agreement * type Microsoft Partner Agreement or Microsoft Customer Agreement. @@ -531,8 +842,27 @@ private Mono deleteByBillingProfileAsync(String billingAccountName, String @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteByBillingProfileWithResponse(String billingAccountName, String billingProfileName, String billingRoleAssignmentName, Context context) { - return deleteByBillingProfileWithResponseAsync(billingAccountName, billingProfileName, - billingRoleAssignmentName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteByBillingProfileSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + billingRoleAssignmentName, this.client.getApiVersion(), accept, context); } /** @@ -592,45 +922,6 @@ private Mono> getByBillingProfileWithRespon .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 along with {@link Response} on successful - * completion of {@link Mono}. - */ - @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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByBillingProfile(this.client.getEndpoint(), billingAccountName, billingProfileName, - billingRoleAssignmentName, this.client.getApiVersion(), 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. @@ -666,8 +957,27 @@ private Mono getByBillingProfileAsync(String billing @ServiceMethod(returns = ReturnType.SINGLE) public Response getByBillingProfileWithResponse(String billingAccountName, String billingProfileName, String billingRoleAssignmentName, Context context) { - return getByBillingProfileWithResponseAsync(billingAccountName, billingProfileName, billingRoleAssignmentName, - context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByBillingProfileSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + billingRoleAssignmentName, this.client.getApiVersion(), accept, context); } /** @@ -743,35 +1053,17 @@ private Mono> listByBillingProfileSing * result. The maximum supported value for top is 50. * @param skip The skip query option requests the number of items in the queried collection that are to be skipped * and not included in the result. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingProfileSinglePageAsync( - String billingAccountName, String billingProfileName, String filter, Long top, Long skip, 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingProfile(this.client.getEndpoint(), billingAccountName, billingProfileName, - this.client.getApiVersion(), filter, top, skip, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync(String billingAccountName, + String billingProfileName, String filter, Long top, Long skip) { + return new PagedFlux<>( + () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, filter, top, skip), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); } /** @@ -780,12 +1072,6 @@ private Mono> listByBillingProfileSing * * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -793,7 +1079,10 @@ private Mono> listByBillingProfileSing */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByBillingProfileAsync(String billingAccountName, - String billingProfileName, String filter, Long top, Long skip) { + String billingProfileName) { + final String filter = null; + final Long top = null; + final Long skip = null; return new PagedFlux<>( () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, filter, top, skip), nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); @@ -805,20 +1094,39 @@ private PagedFlux listByBillingProfileAsync(String b * * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingProfileAsync(String billingAccountName, - String billingProfileName) { - final String filter = null; - final Long top = null; - final Long skip = null; - return new PagedFlux<>( - () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, filter, top, skip), - nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, + String billingProfileName, String filter, Long top, Long skip) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingProfileSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + this.client.getApiVersion(), filter, top, skip, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -837,13 +1145,29 @@ private PagedFlux listByBillingProfileAsync(String b * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingProfileAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, String billingProfileName, String filter, Long top, Long skip, Context context) { - return new PagedFlux<>(() -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, filter, - top, skip, context), nextLink -> listByBillingProfileNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingProfileSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, this.client.getApiVersion(), filter, top, skip, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -864,7 +1188,8 @@ public PagedIterable listByBillingProfile(String bil final Long top = null; final Long skip = null; return new PagedIterable<>( - listByBillingProfileAsync(billingAccountName, billingProfileName, filter, top, skip)); + () -> listByBillingProfileSinglePage(billingAccountName, billingProfileName, filter, top, skip), + nextLink -> listByBillingProfileNextSinglePage(nextLink)); } /** @@ -889,7 +1214,8 @@ public PagedIterable listByBillingProfile(String bil public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName, String filter, Long top, Long skip, Context context) { return new PagedIterable<>( - listByBillingProfileAsync(billingAccountName, billingProfileName, filter, top, skip, context)); + () -> listByBillingProfileSinglePage(billingAccountName, billingProfileName, filter, top, skip, context), + nextLink -> listByBillingProfileNextSinglePage(nextLink, context)); } /** @@ -939,37 +1265,36 @@ private Mono>> createByBillingProfileWithResponseAsync * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingProfileName The ID that uniquely identifies a billing profile. * @param parameters The properties of the billing 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 properties of the billing role assignment along with {@link Response} on successful completion of - * {@link Mono}. + * @return the properties of the billing role assignment along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createByBillingProfileWithResponseAsync(String billingAccountName, - String billingProfileName, BillingRoleAssignmentProperties parameters, Context context) { + private Response createByBillingProfileWithResponse(String billingAccountName, + String billingProfileName, BillingRoleAssignmentProperties parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createByBillingProfile(this.client.getEndpoint(), billingAccountName, billingProfileName, - this.client.getApiVersion(), parameters, accept, context); + return service.createByBillingProfileSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + this.client.getApiVersion(), parameters, accept, Context.NONE); } /** @@ -979,20 +1304,37 @@ private Mono>> createByBillingProfileWithResponseAsync * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingProfileName The ID that uniquely identifies a billing profile. * @param parameters The properties of the billing 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 {@link PollerFlux} for polling of the properties of the billing role assignment. + * @return the properties of the billing role assignment along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, BillingRoleAssignmentInner> - beginCreateByBillingProfileAsync(String billingAccountName, String billingProfileName, - BillingRoleAssignmentProperties parameters) { - Mono>> mono - = createByBillingProfileWithResponseAsync(billingAccountName, billingProfileName, parameters); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createByBillingProfileWithResponse(String billingAccountName, + String billingProfileName, BillingRoleAssignmentProperties parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.createByBillingProfileSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + this.client.getApiVersion(), parameters, accept, context); } /** @@ -1002,7 +1344,6 @@ private Mono>> createByBillingProfileWithResponseAsync * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingProfileName The ID that uniquely identifies a billing profile. * @param parameters The properties of the billing 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. @@ -1011,12 +1352,12 @@ private Mono>> createByBillingProfileWithResponseAsync @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, BillingRoleAssignmentInner> beginCreateByBillingProfileAsync(String billingAccountName, String billingProfileName, - BillingRoleAssignmentProperties parameters, Context context) { - context = this.client.mergeContext(context); + BillingRoleAssignmentProperties parameters) { Mono>> mono - = createByBillingProfileWithResponseAsync(billingAccountName, billingProfileName, parameters, context); + = createByBillingProfileWithResponseAsync(billingAccountName, billingProfileName, parameters); return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, context); + this.client.getHttpPipeline(), BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, + this.client.getContext()); } /** @@ -1034,8 +1375,10 @@ private Mono>> createByBillingProfileWithResponseAsync @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, BillingRoleAssignmentInner> beginCreateByBillingProfile( String billingAccountName, String billingProfileName, BillingRoleAssignmentProperties parameters) { - return this.beginCreateByBillingProfileAsync(billingAccountName, billingProfileName, parameters) - .getSyncPoller(); + Response response + = createByBillingProfileWithResponse(billingAccountName, billingProfileName, parameters); + return this.client.getLroResult(response, + BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, Context.NONE); } /** @@ -1055,8 +1398,10 @@ public SyncPoller, BillingRoleAssignmentI public SyncPoller, BillingRoleAssignmentInner> beginCreateByBillingProfile( String billingAccountName, String billingProfileName, BillingRoleAssignmentProperties parameters, Context context) { - return this.beginCreateByBillingProfileAsync(billingAccountName, billingProfileName, parameters, context) - .getSyncPoller(); + Response response + = createByBillingProfileWithResponse(billingAccountName, billingProfileName, parameters, context); + return this.client.getLroResult(response, + BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, context); } /** @@ -1078,26 +1423,6 @@ private Mono createByBillingProfileAsync(String bill .flatMap(this.client::getLroFinalResultOrError); } - /** - * Adds a role assignment 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 parameters The properties of the billing 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 properties of the billing role assignment on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createByBillingProfileAsync(String billingAccountName, - String billingProfileName, BillingRoleAssignmentProperties parameters, Context context) { - return beginCreateByBillingProfileAsync(billingAccountName, billingProfileName, parameters, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Adds a role assignment on a billing profile. The operation is supported for billing accounts with agreement type * Microsoft Partner Agreement or Microsoft Customer Agreement. @@ -1113,7 +1438,7 @@ private Mono createByBillingProfileAsync(String bill @ServiceMethod(returns = ReturnType.SINGLE) public BillingRoleAssignmentInner createByBillingProfile(String billingAccountName, String billingProfileName, BillingRoleAssignmentProperties parameters) { - return createByBillingProfileAsync(billingAccountName, billingProfileName, parameters).block(); + return beginCreateByBillingProfile(billingAccountName, billingProfileName, parameters).getFinalResult(); } /** @@ -1132,7 +1457,8 @@ public BillingRoleAssignmentInner createByBillingProfile(String billingAccountNa @ServiceMethod(returns = ReturnType.SINGLE) public BillingRoleAssignmentInner createByBillingProfile(String billingAccountName, String billingProfileName, BillingRoleAssignmentProperties parameters, Context context) { - return createByBillingProfileAsync(billingAccountName, billingProfileName, parameters, context).block(); + return beginCreateByBillingProfile(billingAccountName, billingProfileName, parameters, context) + .getFinalResult(); } /** @@ -1178,48 +1504,6 @@ private Mono> deleteByCustomerWithResponseAsync(String billingAcc .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Deletes a role assignment on a customer. The operation is supported for billing accounts with agreement type - * Microsoft Partner Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param customerName The ID that uniquely identifies a customer. - * @param 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 {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteByCustomerWithResponseAsync(String billingAccountName, String billingProfileName, - String customerName, 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 (customerName == null) { - return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); - } - if (billingRoleAssignmentName == null) { - return Mono.error( - new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.deleteByCustomer(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName, - billingRoleAssignmentName, this.client.getApiVersion(), accept, context); - } - /** * Deletes a role assignment on a customer. The operation is supported for billing accounts with agreement type * Microsoft Partner Agreement. @@ -1257,8 +1541,31 @@ private Mono deleteByCustomerAsync(String billingAccountName, String billi @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteByCustomerWithResponse(String billingAccountName, String billingProfileName, String customerName, String billingRoleAssignmentName, Context context) { - return deleteByCustomerWithResponseAsync(billingAccountName, billingProfileName, customerName, - billingRoleAssignmentName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteByCustomerSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + customerName, billingRoleAssignmentName, this.client.getApiVersion(), accept, context); } /** @@ -1324,49 +1631,6 @@ private Mono> getByCustomerWithResponseAsyn .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets a role assignment for the caller on a customer. The operation is supported for billing accounts with - * agreement type Microsoft Partner Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param customerName The ID that uniquely identifies a customer. - * @param 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 customer along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByCustomerWithResponseAsync(String billingAccountName, - String billingProfileName, String customerName, 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 (customerName == null) { - return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); - } - if (billingRoleAssignmentName == null) { - return Mono.error( - new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByCustomer(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName, - billingRoleAssignmentName, this.client.getApiVersion(), accept, context); - } - /** * Gets a role assignment for the caller on a customer. The operation is supported for billing accounts with * agreement type Microsoft Partner Agreement. @@ -1404,74 +1668,51 @@ private Mono getByCustomerAsync(String billingAccoun @ServiceMethod(returns = ReturnType.SINGLE) public Response getByCustomerWithResponse(String billingAccountName, String billingProfileName, String customerName, String billingRoleAssignmentName, Context context) { - return getByCustomerWithResponseAsync(billingAccountName, billingProfileName, customerName, - billingRoleAssignmentName, context).block(); - } - - /** - * Gets a role assignment for the caller on a customer. The operation is supported for billing accounts with - * agreement type Microsoft Partner Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param customerName The ID that uniquely identifies a customer. - * @param 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 customer. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public BillingRoleAssignmentInner getByCustomer(String billingAccountName, String billingProfileName, - String customerName, String billingRoleAssignmentName) { - return getByCustomerWithResponse(billingAccountName, billingProfileName, customerName, - billingRoleAssignmentName, Context.NONE).getValue(); - } - - /** - * Lists the role assignments for the caller on customer. The operation is supported for billing accounts with - * agreement type Microsoft Partner Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param customerName The ID that uniquely identifies a customer. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByCustomerSinglePageAsync(String billingAccountName, - String billingProfileName, String customerName, String filter, Long top, Long skip) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); } if (customerName == null) { - return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); } final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByCustomer(this.client.getEndpoint(), billingAccountName, - billingProfileName, customerName, this.client.getApiVersion(), filter, top, skip, 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())); + return service.getByCustomerSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + customerName, billingRoleAssignmentName, this.client.getApiVersion(), accept, context); + } + + /** + * Gets a role assignment for the caller on a customer. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @param 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 customer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BillingRoleAssignmentInner getByCustomer(String billingAccountName, String billingProfileName, + String customerName, String billingRoleAssignmentName) { + return getByCustomerWithResponse(billingAccountName, billingProfileName, customerName, + billingRoleAssignmentName, Context.NONE).getValue(); } /** @@ -1487,7 +1728,6 @@ private Mono> listByCustomerSinglePage * result. The maximum supported value for top is 50. * @param skip The skip query option requests the number of items in the queried collection that are to be skipped * and not included in the result. - * @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. @@ -1496,7 +1736,7 @@ private Mono> listByCustomerSinglePage */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByCustomerSinglePageAsync(String billingAccountName, - String billingProfileName, String customerName, String filter, Long top, Long skip, Context context) { + String billingProfileName, String customerName, String filter, Long top, Long skip) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1513,12 +1753,12 @@ private Mono> listByCustomerSinglePage return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByCustomer(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName, - this.client.getApiVersion(), filter, top, skip, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + return FluxUtil + .withContext(context -> service.listByCustomer(this.client.getEndpoint(), billingAccountName, + billingProfileName, customerName, this.client.getApiVersion(), filter, top, skip, 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())); } /** @@ -1568,6 +1808,52 @@ private PagedFlux listByCustomerAsync(String billing filter, top, skip), nextLink -> listByCustomerNextSinglePageAsync(nextLink)); } + /** + * Lists the role assignments for the caller on customer. The operation is supported for billing accounts with + * agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerSinglePage(String billingAccountName, + String billingProfileName, String customerName, String filter, Long top, Long skip) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByCustomerSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + customerName, this.client.getApiVersion(), filter, top, skip, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Lists the role assignments for the caller on customer. The operation is supported for billing accounts with * agreement type Microsoft Partner Agreement. @@ -1585,13 +1871,34 @@ private PagedFlux listByCustomerAsync(String billing * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByCustomerAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerSinglePage(String billingAccountName, String billingProfileName, String customerName, String filter, Long top, Long skip, Context context) { - return new PagedFlux<>(() -> listByCustomerSinglePageAsync(billingAccountName, billingProfileName, customerName, - filter, top, skip, context), nextLink -> listByCustomerNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByCustomerSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + customerName, this.client.getApiVersion(), filter, top, skip, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1613,7 +1920,8 @@ public PagedIterable listByCustomer(String billingAc final Long top = null; final Long skip = null; return new PagedIterable<>( - listByCustomerAsync(billingAccountName, billingProfileName, customerName, filter, top, skip)); + () -> listByCustomerSinglePage(billingAccountName, billingProfileName, customerName, filter, top, skip), + nextLink -> listByCustomerNextSinglePage(nextLink)); } /** @@ -1638,8 +1946,8 @@ public PagedIterable listByCustomer(String billingAc @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByCustomer(String billingAccountName, String billingProfileName, String customerName, String filter, Long top, Long skip, Context context) { - return new PagedIterable<>( - listByCustomerAsync(billingAccountName, billingProfileName, customerName, filter, top, skip, context)); + return new PagedIterable<>(() -> listByCustomerSinglePage(billingAccountName, billingProfileName, customerName, + filter, top, skip, context), nextLink -> listByCustomerNextSinglePage(nextLink, context)); } /** @@ -1694,40 +2002,40 @@ private Mono>> createByCustomerWithResponseAsync(Strin * @param billingProfileName The ID that uniquely identifies a billing profile. * @param customerName The ID that uniquely identifies a customer. * @param parameters The properties of the billing 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 properties of the billing role assignment along with {@link Response} on successful completion of - * {@link Mono}. + * @return the properties of the billing role assignment along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createByCustomerWithResponseAsync(String billingAccountName, - String billingProfileName, String customerName, BillingRoleAssignmentProperties parameters, Context context) { + private Response createByCustomerWithResponse(String billingAccountName, String billingProfileName, + String customerName, BillingRoleAssignmentProperties parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); } if (customerName == null) { - return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createByCustomer(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName, - this.client.getApiVersion(), parameters, accept, context); + return service.createByCustomerSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + customerName, this.client.getApiVersion(), parameters, accept, Context.NONE); } /** @@ -1738,20 +2046,41 @@ private Mono>> createByCustomerWithResponseAsync(Strin * @param billingProfileName The ID that uniquely identifies a billing profile. * @param customerName The ID that uniquely identifies a customer. * @param parameters The properties of the billing 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 {@link PollerFlux} for polling of the properties of the billing role assignment. + * @return the properties of the billing role assignment along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, BillingRoleAssignmentInner> beginCreateByCustomerAsync( - String billingAccountName, String billingProfileName, String customerName, - BillingRoleAssignmentProperties parameters) { - Mono>> mono - = createByCustomerWithResponseAsync(billingAccountName, billingProfileName, customerName, parameters); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createByCustomerWithResponse(String billingAccountName, String billingProfileName, + String customerName, BillingRoleAssignmentProperties parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.createByCustomerSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + customerName, this.client.getApiVersion(), parameters, accept, context); } /** @@ -1762,7 +2091,6 @@ private PollerFlux, BillingRoleAssignment * @param billingProfileName The ID that uniquely identifies a billing profile. * @param customerName The ID that uniquely identifies a customer. * @param parameters The properties of the billing 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. @@ -1771,12 +2099,12 @@ private PollerFlux, BillingRoleAssignment @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, BillingRoleAssignmentInner> beginCreateByCustomerAsync( String billingAccountName, String billingProfileName, String customerName, - BillingRoleAssignmentProperties parameters, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = createByCustomerWithResponseAsync(billingAccountName, - billingProfileName, customerName, parameters, context); + BillingRoleAssignmentProperties parameters) { + Mono>> mono + = createByCustomerWithResponseAsync(billingAccountName, billingProfileName, customerName, parameters); return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, context); + this.client.getHttpPipeline(), BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, + this.client.getContext()); } /** @@ -1796,8 +2124,10 @@ private PollerFlux, BillingRoleAssignment public SyncPoller, BillingRoleAssignmentInner> beginCreateByCustomer( String billingAccountName, String billingProfileName, String customerName, BillingRoleAssignmentProperties parameters) { - return this.beginCreateByCustomerAsync(billingAccountName, billingProfileName, customerName, parameters) - .getSyncPoller(); + Response response + = createByCustomerWithResponse(billingAccountName, billingProfileName, customerName, parameters); + return this.client.getLroResult(response, + BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, Context.NONE); } /** @@ -1818,9 +2148,10 @@ public SyncPoller, BillingRoleAssignmentI public SyncPoller, BillingRoleAssignmentInner> beginCreateByCustomer( String billingAccountName, String billingProfileName, String customerName, BillingRoleAssignmentProperties parameters, Context context) { - return this - .beginCreateByCustomerAsync(billingAccountName, billingProfileName, customerName, parameters, context) - .getSyncPoller(); + Response response + = createByCustomerWithResponse(billingAccountName, billingProfileName, customerName, parameters, context); + return this.client.getLroResult(response, + BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, context); } /** @@ -1843,28 +2174,6 @@ private Mono createByCustomerAsync(String billingAcc .flatMap(this.client::getLroFinalResultOrError); } - /** - * Adds a role assignment on a customer. The operation is supported for billing accounts with agreement type - * Microsoft Partner Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param customerName The ID that uniquely identifies a customer. - * @param parameters The properties of the billing 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 properties of the billing role assignment on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createByCustomerAsync(String billingAccountName, String billingProfileName, - String customerName, BillingRoleAssignmentProperties parameters, Context context) { - return beginCreateByCustomerAsync(billingAccountName, billingProfileName, customerName, parameters, context) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Adds a role assignment on a customer. The operation is supported for billing accounts with agreement type * Microsoft Partner Agreement. @@ -1881,7 +2190,7 @@ private Mono createByCustomerAsync(String billingAcc @ServiceMethod(returns = ReturnType.SINGLE) public BillingRoleAssignmentInner createByCustomer(String billingAccountName, String billingProfileName, String customerName, BillingRoleAssignmentProperties parameters) { - return createByCustomerAsync(billingAccountName, billingProfileName, customerName, parameters).block(); + return beginCreateByCustomer(billingAccountName, billingProfileName, customerName, parameters).getFinalResult(); } /** @@ -1901,7 +2210,8 @@ public BillingRoleAssignmentInner createByCustomer(String billingAccountName, St @ServiceMethod(returns = ReturnType.SINGLE) public BillingRoleAssignmentInner createByCustomer(String billingAccountName, String billingProfileName, String customerName, BillingRoleAssignmentProperties parameters, Context context) { - return createByCustomerAsync(billingAccountName, billingProfileName, customerName, parameters, context).block(); + return beginCreateByCustomer(billingAccountName, billingProfileName, customerName, parameters, context) + .getFinalResult(); } /** @@ -1945,6 +2255,46 @@ private Mono>> resolveByCustomerWithResponseAsync(Stri .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Lists the role assignments for the caller on a customer while fetching user info for each role assignment. The + * operation is supported for billing accounts with agreement type Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @param resolveScopeDisplayNames Resolves the scope display name for each of the role assignments. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response resolveByCustomerWithResponse(String billingAccountName, String billingProfileName, + String customerName, Boolean resolveScopeDisplayNames, String filter) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.resolveByCustomerSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + customerName, resolveScopeDisplayNames, this.client.getApiVersion(), filter, accept, Context.NONE); + } + /** * Lists the role assignments for the caller on a customer while fetching user info for each role assignment. The * operation is supported for billing accounts with agreement type Microsoft Partner Agreement. @@ -1959,30 +2309,30 @@ private Mono>> resolveByCustomerWithResponseAsync(Stri * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link Response} on successful completion of {@link Mono}. + * @return a container for a list of resources along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> resolveByCustomerWithResponseAsync(String billingAccountName, - String billingProfileName, String customerName, Boolean resolveScopeDisplayNames, String filter, - Context context) { + private Response resolveByCustomerWithResponse(String billingAccountName, String billingProfileName, + String customerName, Boolean resolveScopeDisplayNames, String filter, Context context) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); } if (customerName == null) { - return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.resolveByCustomer(this.client.getEndpoint(), billingAccountName, billingProfileName, + return service.resolveByCustomerSync(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName, resolveScopeDisplayNames, this.client.getApiVersion(), filter, accept, context); } @@ -2046,22 +2396,20 @@ private Mono>> resolveByCustomerWithResponseAsync(Stri * @param resolveScopeDisplayNames Resolves the scope display name for each of the role assignments. * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a * request URL. - * @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 {@link PollerFlux} for polling of a container for a list of resources. + * @return the {@link SyncPoller} for polling of a container for a list of resources. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, BillingRoleAssignmentListResultInner> - beginResolveByCustomerAsync(String billingAccountName, String billingProfileName, String customerName, - Boolean resolveScopeDisplayNames, String filter, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = resolveByCustomerWithResponseAsync(billingAccountName, - billingProfileName, customerName, resolveScopeDisplayNames, filter, context); + public SyncPoller, BillingRoleAssignmentListResultInner> + beginResolveByCustomer(String billingAccountName, String billingProfileName, String customerName, + Boolean resolveScopeDisplayNames, String filter) { + Response response = resolveByCustomerWithResponse(billingAccountName, billingProfileName, + customerName, resolveScopeDisplayNames, filter); return this.client.getLroResult( - mono, this.client.getHttpPipeline(), BillingRoleAssignmentListResultInner.class, - BillingRoleAssignmentListResultInner.class, context); + response, BillingRoleAssignmentListResultInner.class, BillingRoleAssignmentListResultInner.class, + Context.NONE); } /** @@ -2081,10 +2429,11 @@ private Mono>> resolveByCustomerWithResponseAsync(Stri beginResolveByCustomer(String billingAccountName, String billingProfileName, String customerName) { final Boolean resolveScopeDisplayNames = null; final String filter = null; - return this - .beginResolveByCustomerAsync(billingAccountName, billingProfileName, customerName, resolveScopeDisplayNames, - filter) - .getSyncPoller(); + Response response = resolveByCustomerWithResponse(billingAccountName, billingProfileName, + customerName, resolveScopeDisplayNames, filter); + return this.client.getLroResult( + response, BillingRoleAssignmentListResultInner.class, BillingRoleAssignmentListResultInner.class, + Context.NONE); } /** @@ -2107,10 +2456,10 @@ private Mono>> resolveByCustomerWithResponseAsync(Stri public SyncPoller, BillingRoleAssignmentListResultInner> beginResolveByCustomer(String billingAccountName, String billingProfileName, String customerName, Boolean resolveScopeDisplayNames, String filter, Context context) { - return this - .beginResolveByCustomerAsync(billingAccountName, billingProfileName, customerName, resolveScopeDisplayNames, - filter, context) - .getSyncPoller(); + Response response = resolveByCustomerWithResponse(billingAccountName, billingProfileName, + customerName, resolveScopeDisplayNames, filter, context); + return this.client.getLroResult( + response, BillingRoleAssignmentListResultInner.class, BillingRoleAssignmentListResultInner.class, context); } /** @@ -2156,30 +2505,6 @@ private Mono resolveByCustomerAsync(String resolveScopeDisplayNames, filter).last().flatMap(this.client::getLroFinalResultOrError); } - /** - * Lists the role assignments for the caller on a customer while fetching user info for each role assignment. The - * operation is supported for billing accounts with agreement type Microsoft Partner Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param customerName The ID that uniquely identifies a customer. - * @param resolveScopeDisplayNames Resolves the scope display name for each of the role assignments. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @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 container for a list of resources on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono resolveByCustomerAsync(String billingAccountName, - String billingProfileName, String customerName, Boolean resolveScopeDisplayNames, String filter, - Context context) { - return beginResolveByCustomerAsync(billingAccountName, billingProfileName, customerName, - resolveScopeDisplayNames, filter, context).last().flatMap(this.client::getLroFinalResultOrError); - } - /** * Lists the role assignments for the caller on a customer while fetching user info for each role assignment. The * operation is supported for billing accounts with agreement type Microsoft Partner Agreement. @@ -2197,8 +2522,8 @@ public BillingRoleAssignmentListResultInner resolveByCustomer(String billingAcco String customerName) { final Boolean resolveScopeDisplayNames = null; final String filter = null; - return resolveByCustomerAsync(billingAccountName, billingProfileName, customerName, resolveScopeDisplayNames, - filter).block(); + return beginResolveByCustomer(billingAccountName, billingProfileName, customerName, resolveScopeDisplayNames, + filter).getFinalResult(); } /** @@ -2220,8 +2545,8 @@ public BillingRoleAssignmentListResultInner resolveByCustomer(String billingAcco @ServiceMethod(returns = ReturnType.SINGLE) public BillingRoleAssignmentListResultInner resolveByCustomer(String billingAccountName, String billingProfileName, String customerName, Boolean resolveScopeDisplayNames, String filter, Context context) { - return resolveByCustomerAsync(billingAccountName, billingProfileName, customerName, resolveScopeDisplayNames, - filter, context).block(); + return beginResolveByCustomer(billingAccountName, billingProfileName, customerName, resolveScopeDisplayNames, + filter, context).getFinalResult(); } /** @@ -2268,49 +2593,6 @@ private Mono> deleteByInvoiceSectionWithResponseAsync(String bill .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Deletes a role assignment on an invoice section. The operation is supported for billing accounts with agreement - * type Microsoft Customer Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param invoiceSectionName The ID that uniquely identifies an invoice section. - * @param 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 {@link Response} on successful completion of {@link Mono}. - */ - @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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.deleteByInvoiceSection(this.client.getEndpoint(), billingAccountName, billingProfileName, - invoiceSectionName, billingRoleAssignmentName, this.client.getApiVersion(), accept, context); - } - /** * Deletes a role assignment on an invoice section. The operation is supported for billing accounts with agreement * type Microsoft Customer Agreement. @@ -2348,8 +2630,31 @@ private Mono deleteByInvoiceSectionAsync(String billingAccountName, String @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(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteByInvoiceSectionSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + invoiceSectionName, billingRoleAssignmentName, this.client.getApiVersion(), accept, context); } /** @@ -2416,50 +2721,6 @@ private Mono> getByInvoiceSectionWithRespon .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 along with {@link Response} on successful - * completion of {@link Mono}. - */ - @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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByInvoiceSection(this.client.getEndpoint(), billingAccountName, billingProfileName, - invoiceSectionName, billingRoleAssignmentName, this.client.getApiVersion(), 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. @@ -2497,8 +2758,31 @@ private Mono getByInvoiceSectionAsync(String billing @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(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByInvoiceSectionSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + invoiceSectionName, billingRoleAssignmentName, this.client.getApiVersion(), accept, context); } /** @@ -2583,40 +2867,16 @@ private Mono> listByInvoiceSectionSing * result. The maximum supported value for top is 50. * @param skip The skip query option requests the number of items in the queried collection that are to be skipped * and not included in the result. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByInvoiceSectionSinglePageAsync( - String billingAccountName, String billingProfileName, String invoiceSectionName, String filter, Long top, - Long skip, 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByInvoiceSection(this.client.getEndpoint(), billingAccountName, billingProfileName, invoiceSectionName, - this.client.getApiVersion(), filter, top, skip, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInvoiceSectionAsync(String billingAccountName, + String billingProfileName, String invoiceSectionName, String filter, Long top, Long skip) { + return new PagedFlux<>(() -> listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, + invoiceSectionName, filter, top, skip), nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink)); } /** @@ -2626,12 +2886,6 @@ private Mono> listByInvoiceSectionSing * @param billingAccountName The ID that uniquely 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 The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -2639,7 +2893,10 @@ private Mono> listByInvoiceSectionSing */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByInvoiceSectionAsync(String billingAccountName, - String billingProfileName, String invoiceSectionName, String filter, Long top, Long skip) { + String billingProfileName, String invoiceSectionName) { + final String filter = null; + final Long top = null; + final Long skip = null; return new PagedFlux<>(() -> listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName, filter, top, skip), nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink)); } @@ -2651,19 +2908,43 @@ private PagedFlux listByInvoiceSectionAsync(String b * @param billingAccountName The ID that uniquely 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 The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByInvoiceSectionAsync(String billingAccountName, - String billingProfileName, String invoiceSectionName) { - final String filter = null; - final Long top = null; - final Long skip = null; - return new PagedFlux<>(() -> listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, - invoiceSectionName, filter, top, skip), nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceSectionSinglePage(String billingAccountName, + String billingProfileName, String invoiceSectionName, String filter, Long top, Long skip) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByInvoiceSectionSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + invoiceSectionName, this.client.getApiVersion(), filter, top, skip, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -2683,14 +2964,34 @@ private PagedFlux listByInvoiceSectionAsync(String b * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByInvoiceSectionAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceSectionSinglePage(String billingAccountName, String billingProfileName, String invoiceSectionName, String filter, Long top, Long skip, Context context) { - return new PagedFlux<>(() -> listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, - invoiceSectionName, filter, top, skip, context), - nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByInvoiceSectionSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + invoiceSectionName, this.client.getApiVersion(), filter, top, skip, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -2711,8 +3012,8 @@ public PagedIterable listByInvoiceSection(String bil final String filter = null; final Long top = null; final Long skip = null; - return new PagedIterable<>( - listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, filter, top, skip)); + return new PagedIterable<>(() -> listByInvoiceSectionSinglePage(billingAccountName, billingProfileName, + invoiceSectionName, filter, top, skip), nextLink -> listByInvoiceSectionNextSinglePage(nextLink)); } /** @@ -2737,8 +3038,9 @@ public PagedIterable listByInvoiceSection(String bil @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, String filter, Long top, Long skip, Context context) { - return new PagedIterable<>(listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, - filter, top, skip, context)); + return new PagedIterable<>(() -> listByInvoiceSectionSinglePage(billingAccountName, billingProfileName, + invoiceSectionName, filter, top, skip, context), + nextLink -> listByInvoiceSectionNextSinglePage(nextLink, context)); } /** @@ -2794,42 +3096,40 @@ private Mono>> createByInvoiceSectionWithResponseAsync * @param billingProfileName The ID that uniquely identifies a billing profile. * @param invoiceSectionName The ID that uniquely identifies an invoice section. * @param parameters The properties of the billing 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 properties of the billing role assignment along with {@link Response} on successful completion of - * {@link Mono}. + * @return the properties of the billing role assignment along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createByInvoiceSectionWithResponseAsync(String billingAccountName, - String billingProfileName, String invoiceSectionName, BillingRoleAssignmentProperties parameters, - Context context) { + private Response createByInvoiceSectionWithResponse(String billingAccountName, + String billingProfileName, String invoiceSectionName, BillingRoleAssignmentProperties parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createByInvoiceSection(this.client.getEndpoint(), billingAccountName, billingProfileName, - invoiceSectionName, this.client.getApiVersion(), parameters, accept, context); + return service.createByInvoiceSectionSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + invoiceSectionName, this.client.getApiVersion(), parameters, accept, Context.NONE); } /** @@ -2840,20 +3140,42 @@ private Mono>> createByInvoiceSectionWithResponseAsync * @param billingProfileName The ID that uniquely identifies a billing profile. * @param invoiceSectionName The ID that uniquely identifies an invoice section. * @param parameters The properties of the billing 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 {@link PollerFlux} for polling of the properties of the billing role assignment. + * @return the properties of the billing role assignment along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, BillingRoleAssignmentInner> - beginCreateByInvoiceSectionAsync(String billingAccountName, String billingProfileName, - String invoiceSectionName, BillingRoleAssignmentProperties parameters) { - Mono>> mono = createByInvoiceSectionWithResponseAsync(billingAccountName, - billingProfileName, invoiceSectionName, parameters); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createByInvoiceSectionWithResponse(String billingAccountName, + String billingProfileName, String invoiceSectionName, BillingRoleAssignmentProperties parameters, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.createByInvoiceSectionSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + invoiceSectionName, this.client.getApiVersion(), parameters, accept, context); } /** @@ -2864,7 +3186,6 @@ private Mono>> createByInvoiceSectionWithResponseAsync * @param billingProfileName The ID that uniquely identifies a billing profile. * @param invoiceSectionName The ID that uniquely identifies an invoice section. * @param parameters The properties of the billing 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. @@ -2873,12 +3194,12 @@ private Mono>> createByInvoiceSectionWithResponseAsync @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, BillingRoleAssignmentInner> beginCreateByInvoiceSectionAsync(String billingAccountName, String billingProfileName, - String invoiceSectionName, BillingRoleAssignmentProperties parameters, Context context) { - context = this.client.mergeContext(context); + String invoiceSectionName, BillingRoleAssignmentProperties parameters) { Mono>> mono = createByInvoiceSectionWithResponseAsync(billingAccountName, - billingProfileName, invoiceSectionName, parameters, context); + billingProfileName, invoiceSectionName, parameters); return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, context); + this.client.getHttpPipeline(), BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, + this.client.getContext()); } /** @@ -2898,9 +3219,10 @@ private Mono>> createByInvoiceSectionWithResponseAsync public SyncPoller, BillingRoleAssignmentInner> beginCreateByInvoiceSection( String billingAccountName, String billingProfileName, String invoiceSectionName, BillingRoleAssignmentProperties parameters) { - return this - .beginCreateByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters) - .getSyncPoller(); + Response response = createByInvoiceSectionWithResponse(billingAccountName, billingProfileName, + invoiceSectionName, parameters); + return this.client.getLroResult(response, + BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, Context.NONE); } /** @@ -2921,10 +3243,10 @@ public SyncPoller, BillingRoleAssignmentI public SyncPoller, BillingRoleAssignmentInner> beginCreateByInvoiceSection( String billingAccountName, String billingProfileName, String invoiceSectionName, BillingRoleAssignmentProperties parameters, Context context) { - return this - .beginCreateByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, - context) - .getSyncPoller(); + Response response = createByInvoiceSectionWithResponse(billingAccountName, billingProfileName, + invoiceSectionName, parameters, context); + return this.client.getLroResult(response, + BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, context); } /** @@ -2948,28 +3270,6 @@ private Mono createByInvoiceSectionAsync(String bill .flatMap(this.client::getLroFinalResultOrError); } - /** - * Adds a role assignment on an invoice section. The operation is supported for billing accounts with agreement type - * Microsoft Customer Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param invoiceSectionName The ID that uniquely identifies an invoice section. - * @param parameters The properties of the billing 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 properties of the billing role assignment on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createByInvoiceSectionAsync(String billingAccountName, - String billingProfileName, String invoiceSectionName, BillingRoleAssignmentProperties parameters, - Context context) { - return beginCreateByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, - context).last().flatMap(this.client::getLroFinalResultOrError); - } - /** * Adds a role assignment on an invoice section. The operation is supported for billing accounts with agreement type * Microsoft Customer Agreement. @@ -2986,8 +3286,8 @@ private Mono createByInvoiceSectionAsync(String bill @ServiceMethod(returns = ReturnType.SINGLE) public BillingRoleAssignmentInner createByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, BillingRoleAssignmentProperties parameters) { - return createByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters) - .block(); + return beginCreateByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, parameters) + .getFinalResult(); } /** @@ -3007,8 +3307,8 @@ public BillingRoleAssignmentInner createByInvoiceSection(String billingAccountNa @ServiceMethod(returns = ReturnType.SINGLE) public BillingRoleAssignmentInner createByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, BillingRoleAssignmentProperties parameters, Context context) { - return createByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, - context).block(); + return beginCreateByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, parameters, + context).getFinalResult(); } /** @@ -3053,6 +3353,46 @@ private Mono>> resolveByInvoiceSectionWithResponseAsyn .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Lists the role assignments for the caller on an invoice section while fetching user info for each role + * assignment. 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 resolveScopeDisplayNames Resolves the scope display name for each of the role assignments. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response resolveByInvoiceSectionWithResponse(String billingAccountName, + String billingProfileName, String invoiceSectionName, Boolean resolveScopeDisplayNames, String filter) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.resolveByInvoiceSectionSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + invoiceSectionName, resolveScopeDisplayNames, this.client.getApiVersion(), filter, accept, Context.NONE); + } + /** * Lists the role assignments for the caller on an invoice section while fetching user info for each role * assignment. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. @@ -3067,31 +3407,31 @@ private Mono>> resolveByInvoiceSectionWithResponseAsyn * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link Response} on successful completion of {@link Mono}. + * @return a container for a list of resources along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> resolveByInvoiceSectionWithResponseAsync(String billingAccountName, + private Response resolveByInvoiceSectionWithResponse(String billingAccountName, String billingProfileName, String invoiceSectionName, Boolean resolveScopeDisplayNames, String filter, Context context) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.resolveByInvoiceSection(this.client.getEndpoint(), billingAccountName, billingProfileName, + return service.resolveByInvoiceSectionSync(this.client.getEndpoint(), billingAccountName, billingProfileName, invoiceSectionName, resolveScopeDisplayNames, this.client.getApiVersion(), filter, accept, context); } @@ -3156,22 +3496,20 @@ private Mono>> resolveByInvoiceSectionWithResponseAsyn * @param resolveScopeDisplayNames Resolves the scope display name for each of the role assignments. * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a * request URL. - * @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 {@link PollerFlux} for polling of a container for a list of resources. + * @return the {@link SyncPoller} for polling of a container for a list of resources. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, BillingRoleAssignmentListResultInner> - beginResolveByInvoiceSectionAsync(String billingAccountName, String billingProfileName, - String invoiceSectionName, Boolean resolveScopeDisplayNames, String filter, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = resolveByInvoiceSectionWithResponseAsync(billingAccountName, - billingProfileName, invoiceSectionName, resolveScopeDisplayNames, filter, context); + public SyncPoller, BillingRoleAssignmentListResultInner> + beginResolveByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, + Boolean resolveScopeDisplayNames, String filter) { + Response response = resolveByInvoiceSectionWithResponse(billingAccountName, billingProfileName, + invoiceSectionName, resolveScopeDisplayNames, filter); return this.client.getLroResult( - mono, this.client.getHttpPipeline(), BillingRoleAssignmentListResultInner.class, - BillingRoleAssignmentListResultInner.class, context); + response, BillingRoleAssignmentListResultInner.class, BillingRoleAssignmentListResultInner.class, + Context.NONE); } /** @@ -3191,10 +3529,11 @@ private Mono>> resolveByInvoiceSectionWithResponseAsyn beginResolveByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName) { final Boolean resolveScopeDisplayNames = null; final String filter = null; - return this - .beginResolveByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, - resolveScopeDisplayNames, filter) - .getSyncPoller(); + Response response = resolveByInvoiceSectionWithResponse(billingAccountName, billingProfileName, + invoiceSectionName, resolveScopeDisplayNames, filter); + return this.client.getLroResult( + response, BillingRoleAssignmentListResultInner.class, BillingRoleAssignmentListResultInner.class, + Context.NONE); } /** @@ -3217,10 +3556,10 @@ private Mono>> resolveByInvoiceSectionWithResponseAsyn public SyncPoller, BillingRoleAssignmentListResultInner> beginResolveByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, Boolean resolveScopeDisplayNames, String filter, Context context) { - return this - .beginResolveByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, - resolveScopeDisplayNames, filter, context) - .getSyncPoller(); + Response response = resolveByInvoiceSectionWithResponse(billingAccountName, billingProfileName, + invoiceSectionName, resolveScopeDisplayNames, filter, context); + return this.client.getLroResult( + response, BillingRoleAssignmentListResultInner.class, BillingRoleAssignmentListResultInner.class, context); } /** @@ -3266,30 +3605,6 @@ private Mono resolveByInvoiceSectionAsync( resolveScopeDisplayNames, filter).last().flatMap(this.client::getLroFinalResultOrError); } - /** - * Lists the role assignments for the caller on an invoice section while fetching user info for each role - * assignment. 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 resolveScopeDisplayNames Resolves the scope display name for each of the role assignments. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @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 container for a list of resources on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono resolveByInvoiceSectionAsync(String billingAccountName, - String billingProfileName, String invoiceSectionName, Boolean resolveScopeDisplayNames, String filter, - Context context) { - return beginResolveByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, - resolveScopeDisplayNames, filter, context).last().flatMap(this.client::getLroFinalResultOrError); - } - /** * Lists the role assignments for the caller on an invoice section while fetching user info for each role * assignment. The operation is supported for billing accounts with agreement type Microsoft Customer Agreement. @@ -3307,8 +3622,8 @@ public BillingRoleAssignmentListResultInner resolveByInvoiceSection(String billi String billingProfileName, String invoiceSectionName) { final Boolean resolveScopeDisplayNames = null; final String filter = null; - return resolveByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, - resolveScopeDisplayNames, filter).block(); + return beginResolveByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, + resolveScopeDisplayNames, filter).getFinalResult(); } /** @@ -3331,8 +3646,8 @@ public BillingRoleAssignmentListResultInner resolveByInvoiceSection(String billi public BillingRoleAssignmentListResultInner resolveByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, Boolean resolveScopeDisplayNames, String filter, Context context) { - return resolveByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, - resolveScopeDisplayNames, filter, context).block(); + return beginResolveByInvoiceSection(billingAccountName, billingProfileName, invoiceSectionName, + resolveScopeDisplayNames, filter, context).getFinalResult(); } /** @@ -3372,6 +3687,42 @@ private Mono>> resolveByBillingProfileWithResponseAsyn .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Lists the role assignments for the caller on an billing profile while fetching user info for each role + * assignment. 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 resolveScopeDisplayNames Resolves the scope display name for each of the role assignments. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response resolveByBillingProfileWithResponse(String billingAccountName, + String billingProfileName, Boolean resolveScopeDisplayNames, String filter) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.resolveByBillingProfileSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + resolveScopeDisplayNames, this.client.getApiVersion(), filter, accept, Context.NONE); + } + /** * Lists the role assignments for the caller on an billing profile while fetching user info for each role * assignment. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or @@ -3386,26 +3737,26 @@ private Mono>> resolveByBillingProfileWithResponseAsyn * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link Response} on successful completion of {@link Mono}. + * @return a container for a list of resources along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> resolveByBillingProfileWithResponseAsync(String billingAccountName, + private Response resolveByBillingProfileWithResponse(String billingAccountName, String billingProfileName, Boolean resolveScopeDisplayNames, String filter, Context context) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.resolveByBillingProfile(this.client.getEndpoint(), billingAccountName, billingProfileName, + return service.resolveByBillingProfileSync(this.client.getEndpoint(), billingAccountName, billingProfileName, resolveScopeDisplayNames, this.client.getApiVersion(), filter, accept, context); } @@ -3469,22 +3820,20 @@ private Mono>> resolveByBillingProfileWithResponseAsyn * @param resolveScopeDisplayNames Resolves the scope display name for each of the role assignments. * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a * request URL. - * @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 {@link PollerFlux} for polling of a container for a list of resources. + * @return the {@link SyncPoller} for polling of a container for a list of resources. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, BillingRoleAssignmentListResultInner> - beginResolveByBillingProfileAsync(String billingAccountName, String billingProfileName, - Boolean resolveScopeDisplayNames, String filter, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = resolveByBillingProfileWithResponseAsync(billingAccountName, - billingProfileName, resolveScopeDisplayNames, filter, context); + public SyncPoller, BillingRoleAssignmentListResultInner> + beginResolveByBillingProfile(String billingAccountName, String billingProfileName, + Boolean resolveScopeDisplayNames, String filter) { + Response response = resolveByBillingProfileWithResponse(billingAccountName, billingProfileName, + resolveScopeDisplayNames, filter); return this.client.getLroResult( - mono, this.client.getHttpPipeline(), BillingRoleAssignmentListResultInner.class, - BillingRoleAssignmentListResultInner.class, context); + response, BillingRoleAssignmentListResultInner.class, BillingRoleAssignmentListResultInner.class, + Context.NONE); } /** @@ -3504,9 +3853,11 @@ private Mono>> resolveByBillingProfileWithResponseAsyn beginResolveByBillingProfile(String billingAccountName, String billingProfileName) { final Boolean resolveScopeDisplayNames = null; final String filter = null; - return this - .beginResolveByBillingProfileAsync(billingAccountName, billingProfileName, resolveScopeDisplayNames, filter) - .getSyncPoller(); + Response response = resolveByBillingProfileWithResponse(billingAccountName, billingProfileName, + resolveScopeDisplayNames, filter); + return this.client.getLroResult( + response, BillingRoleAssignmentListResultInner.class, BillingRoleAssignmentListResultInner.class, + Context.NONE); } /** @@ -3529,10 +3880,10 @@ private Mono>> resolveByBillingProfileWithResponseAsyn public SyncPoller, BillingRoleAssignmentListResultInner> beginResolveByBillingProfile(String billingAccountName, String billingProfileName, Boolean resolveScopeDisplayNames, String filter, Context context) { - return this - .beginResolveByBillingProfileAsync(billingAccountName, billingProfileName, resolveScopeDisplayNames, filter, - context) - .getSyncPoller(); + Response response = resolveByBillingProfileWithResponse(billingAccountName, billingProfileName, + resolveScopeDisplayNames, filter, context); + return this.client.getLroResult( + response, BillingRoleAssignmentListResultInner.class, BillingRoleAssignmentListResultInner.class, context); } /** @@ -3578,29 +3929,6 @@ private Mono resolveByBillingProfileAsync( filter).last().flatMap(this.client::getLroFinalResultOrError); } - /** - * Lists the role assignments for the caller on an billing profile while fetching user info for each role - * assignment. 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 resolveScopeDisplayNames Resolves the scope display name for each of the role assignments. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @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 container for a list of resources on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono resolveByBillingProfileAsync(String billingAccountName, - String billingProfileName, Boolean resolveScopeDisplayNames, String filter, Context context) { - return beginResolveByBillingProfileAsync(billingAccountName, billingProfileName, resolveScopeDisplayNames, - filter, context).last().flatMap(this.client::getLroFinalResultOrError); - } - /** * Lists the role assignments for the caller on an billing profile while fetching user info for each role * assignment. The operation is supported for billing accounts with agreement type Microsoft Partner Agreement or @@ -3618,8 +3946,8 @@ public BillingRoleAssignmentListResultInner resolveByBillingProfile(String billi String billingProfileName) { final Boolean resolveScopeDisplayNames = null; final String filter = null; - return resolveByBillingProfileAsync(billingAccountName, billingProfileName, resolveScopeDisplayNames, filter) - .block(); + return beginResolveByBillingProfile(billingAccountName, billingProfileName, resolveScopeDisplayNames, filter) + .getFinalResult(); } /** @@ -3641,8 +3969,8 @@ public BillingRoleAssignmentListResultInner resolveByBillingProfile(String billi @ServiceMethod(returns = ReturnType.SINGLE) public BillingRoleAssignmentListResultInner resolveByBillingProfile(String billingAccountName, String billingProfileName, Boolean resolveScopeDisplayNames, String filter, Context context) { - return resolveByBillingProfileAsync(billingAccountName, billingProfileName, resolveScopeDisplayNames, filter, - context).block(); + return beginResolveByBillingProfile(billingAccountName, billingProfileName, resolveScopeDisplayNames, filter, + context).getFinalResult(); } /** @@ -3678,39 +4006,6 @@ private Mono> deleteByBillingAccountWithResponseAsync(String bill .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Deletes a role assignment on a billing account. The operation is supported for billing accounts with agreement - * type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. - * @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 {@link Response} on successful completion of {@link Mono}. - */ - @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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.deleteByBillingAccount(this.client.getEndpoint(), billingAccountName, billingRoleAssignmentName, - this.client.getApiVersion(), accept, context); - } - /** * Deletes a role assignment on a billing account. The operation is supported for billing accounts with agreement * type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. @@ -3743,7 +4038,23 @@ private Mono deleteByBillingAccountAsync(String billingAccountName, String @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteByBillingAccountWithResponse(String billingAccountName, String billingRoleAssignmentName, Context context) { - return deleteByBillingAccountWithResponseAsync(billingAccountName, billingRoleAssignmentName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteByBillingAccountSync(this.client.getEndpoint(), billingAccountName, + billingRoleAssignmentName, this.client.getApiVersion(), accept, context); } /** @@ -3795,40 +4106,6 @@ private Mono> getByBillingAccountWithRespon .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, Microsoft Customer Agreement or Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. - * @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 along with {@link Response} on successful - * completion of {@link Mono}. - */ - @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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByBillingAccount(this.client.getEndpoint(), billingAccountName, billingRoleAssignmentName, - this.client.getApiVersion(), 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, Microsoft Customer Agreement or Enterprise Agreement. @@ -3862,7 +4139,23 @@ private Mono getByBillingAccountAsync(String billing @ServiceMethod(returns = ReturnType.SINGLE) public Response getByBillingAccountWithResponse(String billingAccountName, String billingRoleAssignmentName, Context context) { - return getByBillingAccountWithResponseAsync(billingAccountName, billingRoleAssignmentName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByBillingAccountSync(this.client.getEndpoint(), billingAccountName, billingRoleAssignmentName, + this.client.getApiVersion(), accept, context); } /** @@ -3929,37 +4222,37 @@ private Mono>> createOrUpdateByBillingAccountWithRespo * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @param parameters The properties of the billing 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 properties of the billing role assignment along with {@link Response} on successful completion of - * {@link Mono}. + * @return the properties of the billing role assignment along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateByBillingAccountWithResponseAsync(String billingAccountName, - String billingRoleAssignmentName, BillingRoleAssignmentInner parameters, Context context) { + private Response createOrUpdateByBillingAccountWithResponse(String billingAccountName, + String billingRoleAssignmentName, BillingRoleAssignmentInner parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); } if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdateByBillingAccount(this.client.getEndpoint(), billingAccountName, - billingRoleAssignmentName, this.client.getApiVersion(), parameters, accept, context); + return service.createOrUpdateByBillingAccountSync(this.client.getEndpoint(), billingAccountName, + billingRoleAssignmentName, this.client.getApiVersion(), parameters, accept, Context.NONE); } /** @@ -3969,20 +4262,38 @@ private Mono>> createOrUpdateByBillingAccountWithRespo * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @param parameters The properties of the billing 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 {@link PollerFlux} for polling of the properties of the billing role assignment. + * @return the properties of the billing role assignment along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, BillingRoleAssignmentInner> - beginCreateOrUpdateByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName, - BillingRoleAssignmentInner parameters) { - Mono>> mono = createOrUpdateByBillingAccountWithResponseAsync(billingAccountName, - billingRoleAssignmentName, parameters); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateByBillingAccountWithResponse(String billingAccountName, + String billingRoleAssignmentName, BillingRoleAssignmentInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.createOrUpdateByBillingAccountSync(this.client.getEndpoint(), billingAccountName, + billingRoleAssignmentName, this.client.getApiVersion(), parameters, accept, context); } /** @@ -3992,7 +4303,6 @@ private Mono>> createOrUpdateByBillingAccountWithRespo * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @param parameters The properties of the billing 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. @@ -4001,12 +4311,12 @@ private Mono>> createOrUpdateByBillingAccountWithRespo @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, BillingRoleAssignmentInner> beginCreateOrUpdateByBillingAccountAsync(String billingAccountName, String billingRoleAssignmentName, - BillingRoleAssignmentInner parameters, Context context) { - context = this.client.mergeContext(context); + BillingRoleAssignmentInner parameters) { Mono>> mono = createOrUpdateByBillingAccountWithResponseAsync(billingAccountName, - billingRoleAssignmentName, parameters, context); + billingRoleAssignmentName, parameters); return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, context); + this.client.getHttpPipeline(), BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, + this.client.getContext()); } /** @@ -4025,8 +4335,10 @@ private Mono>> createOrUpdateByBillingAccountWithRespo public SyncPoller, BillingRoleAssignmentInner> beginCreateOrUpdateByBillingAccount(String billingAccountName, String billingRoleAssignmentName, BillingRoleAssignmentInner parameters) { - return this.beginCreateOrUpdateByBillingAccountAsync(billingAccountName, billingRoleAssignmentName, parameters) - .getSyncPoller(); + Response response + = createOrUpdateByBillingAccountWithResponse(billingAccountName, billingRoleAssignmentName, parameters); + return this.client.getLroResult(response, + BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, Context.NONE); } /** @@ -4039,37 +4351,17 @@ private Mono>> createOrUpdateByBillingAccountWithRespo * @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 {@link SyncPoller} for polling of the properties of the billing role assignment. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, BillingRoleAssignmentInner> - beginCreateOrUpdateByBillingAccount(String billingAccountName, String billingRoleAssignmentName, - BillingRoleAssignmentInner parameters, Context context) { - return this - .beginCreateOrUpdateByBillingAccountAsync(billingAccountName, billingRoleAssignmentName, parameters, - context) - .getSyncPoller(); - } - - /** - * Create or update a billing role assignment. The operation is supported only for billing accounts with agreement - * type Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. - * @param parameters The properties of the billing 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 properties of the billing role assignment on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateByBillingAccountAsync(String billingAccountName, - String billingRoleAssignmentName, BillingRoleAssignmentInner parameters) { - return beginCreateOrUpdateByBillingAccountAsync(billingAccountName, billingRoleAssignmentName, parameters) - .last() - .flatMap(this.client::getLroFinalResultOrError); + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the properties of the billing role assignment. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BillingRoleAssignmentInner> + beginCreateOrUpdateByBillingAccount(String billingAccountName, String billingRoleAssignmentName, + BillingRoleAssignmentInner parameters, Context context) { + Response response = createOrUpdateByBillingAccountWithResponse(billingAccountName, + billingRoleAssignmentName, parameters, context); + return this.client.getLroResult(response, + BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, context); } /** @@ -4079,7 +4371,6 @@ private Mono createOrUpdateByBillingAccountAsync(Str * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @param parameters The properties of the billing 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. @@ -4087,9 +4378,10 @@ private Mono createOrUpdateByBillingAccountAsync(Str */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createOrUpdateByBillingAccountAsync(String billingAccountName, - String billingRoleAssignmentName, BillingRoleAssignmentInner parameters, Context context) { - return beginCreateOrUpdateByBillingAccountAsync(billingAccountName, billingRoleAssignmentName, parameters, - context).last().flatMap(this.client::getLroFinalResultOrError); + String billingRoleAssignmentName, BillingRoleAssignmentInner parameters) { + return beginCreateOrUpdateByBillingAccountAsync(billingAccountName, billingRoleAssignmentName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); } /** @@ -4107,7 +4399,8 @@ private Mono createOrUpdateByBillingAccountAsync(Str @ServiceMethod(returns = ReturnType.SINGLE) public BillingRoleAssignmentInner createOrUpdateByBillingAccount(String billingAccountName, String billingRoleAssignmentName, BillingRoleAssignmentInner parameters) { - return createOrUpdateByBillingAccountAsync(billingAccountName, billingRoleAssignmentName, parameters).block(); + return beginCreateOrUpdateByBillingAccount(billingAccountName, billingRoleAssignmentName, parameters) + .getFinalResult(); } /** @@ -4126,8 +4419,8 @@ public BillingRoleAssignmentInner createOrUpdateByBillingAccount(String billingA @ServiceMethod(returns = ReturnType.SINGLE) public BillingRoleAssignmentInner createOrUpdateByBillingAccount(String billingAccountName, String billingRoleAssignmentName, BillingRoleAssignmentInner parameters, Context context) { - return createOrUpdateByBillingAccountAsync(billingAccountName, billingRoleAssignmentName, parameters, context) - .block(); + return beginCreateOrUpdateByBillingAccount(billingAccountName, billingRoleAssignmentName, parameters, context) + .getFinalResult(); } /** @@ -4178,31 +4471,16 @@ public BillingRoleAssignmentInner createOrUpdateByBillingAccount(String billingA * result. The maximum supported value for top is 50. * @param skip The skip query option requests the number of items in the queried collection that are to be skipped * and not included in the result. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountSinglePageAsync( - String billingAccountName, String filter, Long top, Long skip, 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingAccount(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), filter, - top, skip, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync(String billingAccountName, String filter, + Long top, Long skip) { + return new PagedFlux<>(() -> listByBillingAccountSinglePageAsync(billingAccountName, filter, top, skip), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); } /** @@ -4210,20 +4488,16 @@ private Mono> listByBillingAccountSing * with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a container for a list of resources as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName, String filter, - Long top, Long skip) { + private PagedFlux listByBillingAccountAsync(String billingAccountName) { + final String filter = null; + final Long top = null; + final Long skip = null; return new PagedFlux<>(() -> listByBillingAccountSinglePageAsync(billingAccountName, filter, top, skip), nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); } @@ -4233,18 +4507,34 @@ private PagedFlux listByBillingAccountAsync(String b * with agreement type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. * * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName) { - final String filter = null; - final Long top = null; - final Long skip = null; - return new PagedFlux<>(() -> listByBillingAccountSinglePageAsync(billingAccountName, filter, top, skip), - nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, + String filter, Long top, Long skip) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingAccountSync(this.client.getEndpoint(), + billingAccountName, this.client.getApiVersion(), filter, top, skip, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -4262,14 +4552,25 @@ private PagedFlux listByBillingAccountAsync(String b * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName, String filter, - Long top, Long skip, Context context) { - return new PagedFlux<>( - () -> listByBillingAccountSinglePageAsync(billingAccountName, filter, top, skip, context), - nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, + String filter, Long top, Long skip, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingAccountSync(this.client.getEndpoint(), + billingAccountName, this.client.getApiVersion(), filter, top, skip, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -4287,7 +4588,8 @@ public PagedIterable listByBillingAccount(String bil final String filter = null; final Long top = null; final Long skip = null; - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, filter, top, skip)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, filter, top, skip), + nextLink -> listByBillingAccountNextSinglePage(nextLink)); } /** @@ -4310,7 +4612,8 @@ public PagedIterable listByBillingAccount(String bil @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingAccount(String billingAccountName, String filter, Long top, Long skip, Context context) { - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, filter, top, skip, context)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, filter, top, skip, context), + nextLink -> listByBillingAccountNextSinglePage(nextLink, context)); } /** @@ -4354,33 +4657,32 @@ private Mono>> createByBillingAccountWithResponseAsync * * @param billingAccountName The ID that uniquely identifies a billing account. * @param parameters The properties of the billing 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 properties of the billing role assignment along with {@link Response} on successful completion of - * {@link Mono}. + * @return the properties of the billing role assignment along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createByBillingAccountWithResponseAsync(String billingAccountName, - BillingRoleAssignmentProperties parameters, Context context) { + private Response createByBillingAccountWithResponse(String billingAccountName, + BillingRoleAssignmentProperties parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createByBillingAccount(this.client.getEndpoint(), billingAccountName, - this.client.getApiVersion(), parameters, accept, context); + return service.createByBillingAccountSync(this.client.getEndpoint(), billingAccountName, + this.client.getApiVersion(), parameters, accept, Context.NONE); } /** @@ -4389,18 +4691,33 @@ private Mono>> createByBillingAccountWithResponseAsync * * @param billingAccountName The ID that uniquely identifies a billing account. * @param parameters The properties of the billing 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 {@link PollerFlux} for polling of the properties of the billing role assignment. + * @return the properties of the billing role assignment along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, BillingRoleAssignmentInner> - beginCreateByBillingAccountAsync(String billingAccountName, BillingRoleAssignmentProperties parameters) { - Mono>> mono = createByBillingAccountWithResponseAsync(billingAccountName, parameters); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createByBillingAccountWithResponse(String billingAccountName, + BillingRoleAssignmentProperties parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.createByBillingAccountSync(this.client.getEndpoint(), billingAccountName, + this.client.getApiVersion(), parameters, accept, context); } /** @@ -4409,7 +4726,6 @@ private Mono>> createByBillingAccountWithResponseAsync * * @param billingAccountName The ID that uniquely identifies a billing account. * @param parameters The properties of the billing 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. @@ -4417,13 +4733,11 @@ private Mono>> createByBillingAccountWithResponseAsync */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, BillingRoleAssignmentInner> - beginCreateByBillingAccountAsync(String billingAccountName, BillingRoleAssignmentProperties parameters, - Context context) { - context = this.client.mergeContext(context); - Mono>> mono - = createByBillingAccountWithResponseAsync(billingAccountName, parameters, context); + beginCreateByBillingAccountAsync(String billingAccountName, BillingRoleAssignmentProperties parameters) { + Mono>> mono = createByBillingAccountWithResponseAsync(billingAccountName, parameters); return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, context); + this.client.getHttpPipeline(), BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, + this.client.getContext()); } /** @@ -4440,7 +4754,9 @@ private Mono>> createByBillingAccountWithResponseAsync @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, BillingRoleAssignmentInner> beginCreateByBillingAccount(String billingAccountName, BillingRoleAssignmentProperties parameters) { - return this.beginCreateByBillingAccountAsync(billingAccountName, parameters).getSyncPoller(); + Response response = createByBillingAccountWithResponse(billingAccountName, parameters); + return this.client.getLroResult(response, + BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, Context.NONE); } /** @@ -4458,7 +4774,9 @@ private Mono>> createByBillingAccountWithResponseAsync @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, BillingRoleAssignmentInner> beginCreateByBillingAccount( String billingAccountName, BillingRoleAssignmentProperties parameters, Context context) { - return this.beginCreateByBillingAccountAsync(billingAccountName, parameters, context).getSyncPoller(); + Response response = createByBillingAccountWithResponse(billingAccountName, parameters, context); + return this.client.getLroResult(response, + BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, context); } /** @@ -4479,25 +4797,6 @@ private Mono createByBillingAccountAsync(String bill .flatMap(this.client::getLroFinalResultOrError); } - /** - * Adds a role assignment 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 parameters The properties of the billing 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 properties of the billing role assignment on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createByBillingAccountAsync(String billingAccountName, - BillingRoleAssignmentProperties parameters, Context context) { - return beginCreateByBillingAccountAsync(billingAccountName, parameters, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Adds a role assignment on a billing account. The operation is supported for billing accounts with agreement type * Microsoft Partner Agreement or Microsoft Customer Agreement. @@ -4512,7 +4811,7 @@ private Mono createByBillingAccountAsync(String bill @ServiceMethod(returns = ReturnType.SINGLE) public BillingRoleAssignmentInner createByBillingAccount(String billingAccountName, BillingRoleAssignmentProperties parameters) { - return createByBillingAccountAsync(billingAccountName, parameters).block(); + return beginCreateByBillingAccount(billingAccountName, parameters).getFinalResult(); } /** @@ -4530,7 +4829,7 @@ public BillingRoleAssignmentInner createByBillingAccount(String billingAccountNa @ServiceMethod(returns = ReturnType.SINGLE) public BillingRoleAssignmentInner createByBillingAccount(String billingAccountName, BillingRoleAssignmentProperties parameters, Context context) { - return createByBillingAccountAsync(billingAccountName, parameters, context).block(); + return beginCreateByBillingAccount(billingAccountName, parameters, context).getFinalResult(); } /** @@ -4570,43 +4869,6 @@ private Mono> deleteByDepartmentWithResponseAsync(String billingA .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Deletes a role assignment on a department. The operation is supported only for billing accounts with agreement - * type Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param departmentName The name of the department. - * @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 {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteByDepartmentWithResponseAsync(String billingAccountName, String departmentName, - 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 (departmentName == null) { - return Mono.error(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); - } - if (billingRoleAssignmentName == null) { - return Mono.error( - new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.deleteByDepartment(this.client.getEndpoint(), billingAccountName, departmentName, - billingRoleAssignmentName, this.client.getApiVersion(), accept, context); - } - /** * Deletes a role assignment on a department. The operation is supported only for billing accounts with agreement * type Enterprise Agreement. @@ -4642,8 +4904,27 @@ private Mono deleteByDepartmentAsync(String billingAccountName, String dep @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteByDepartmentWithResponse(String billingAccountName, String departmentName, String billingRoleAssignmentName, Context context) { - return deleteByDepartmentWithResponseAsync(billingAccountName, departmentName, billingRoleAssignmentName, - context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (departmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteByDepartmentSync(this.client.getEndpoint(), billingAccountName, departmentName, + billingRoleAssignmentName, this.client.getApiVersion(), accept, context); } /** @@ -4700,44 +4981,6 @@ private Mono> getByDepartmentWithResponseAs .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets a role assignment for the caller on a department. The operation is supported only for billing accounts with - * agreement type Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param departmentName The name of the department. - * @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 department along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByDepartmentWithResponseAsync(String billingAccountName, - String departmentName, 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 (departmentName == null) { - return Mono.error(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); - } - if (billingRoleAssignmentName == null) { - return Mono.error( - new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByDepartment(this.client.getEndpoint(), billingAccountName, departmentName, - billingRoleAssignmentName, this.client.getApiVersion(), accept, context); - } - /** * Gets a role assignment for the caller on a department. The operation is supported only for billing accounts with * agreement type Enterprise Agreement. @@ -4773,8 +5016,27 @@ private Mono getByDepartmentAsync(String billingAcco @ServiceMethod(returns = ReturnType.SINGLE) public Response getByDepartmentWithResponse(String billingAccountName, String departmentName, String billingRoleAssignmentName, Context context) { - return getByDepartmentWithResponseAsync(billingAccountName, departmentName, billingRoleAssignmentName, context) - .block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (departmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByDepartmentSync(this.client.getEndpoint(), billingAccountName, departmentName, + billingRoleAssignmentName, this.client.getApiVersion(), accept, context); } /** @@ -4848,41 +5110,41 @@ private Mono>> createOrUpdateByDepartmentWithResponseA * @param departmentName The name of the department. * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @param parameters The properties of the billing 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 properties of the billing role assignment along with {@link Response} on successful completion of - * {@link Mono}. + * @return the properties of the billing role assignment along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateByDepartmentWithResponseAsync(String billingAccountName, - String departmentName, String billingRoleAssignmentName, BillingRoleAssignmentInner parameters, - Context context) { + private Response createOrUpdateByDepartmentWithResponse(String billingAccountName, + String departmentName, String billingRoleAssignmentName, BillingRoleAssignmentInner parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); } if (departmentName == null) { - return Mono.error(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); } if (billingRoleAssignmentName == null) { - return Mono.error( - new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); } if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdateByDepartment(this.client.getEndpoint(), billingAccountName, departmentName, - billingRoleAssignmentName, this.client.getApiVersion(), parameters, accept, context); + return service.createOrUpdateByDepartmentSync(this.client.getEndpoint(), billingAccountName, departmentName, + billingRoleAssignmentName, this.client.getApiVersion(), parameters, accept, Context.NONE); } /** @@ -4893,20 +5155,43 @@ private Mono>> createOrUpdateByDepartmentWithResponseA * @param departmentName The name of the department. * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @param parameters The properties of the billing 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 {@link PollerFlux} for polling of the properties of the billing role assignment. + * @return the properties of the billing role assignment along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, BillingRoleAssignmentInner> - beginCreateOrUpdateByDepartmentAsync(String billingAccountName, String departmentName, - String billingRoleAssignmentName, BillingRoleAssignmentInner parameters) { - Mono>> mono = createOrUpdateByDepartmentWithResponseAsync(billingAccountName, - departmentName, billingRoleAssignmentName, parameters); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateByDepartmentWithResponse(String billingAccountName, + String departmentName, String billingRoleAssignmentName, BillingRoleAssignmentInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (departmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.createOrUpdateByDepartmentSync(this.client.getEndpoint(), billingAccountName, departmentName, + billingRoleAssignmentName, this.client.getApiVersion(), parameters, accept, context); } /** @@ -4917,7 +5202,6 @@ private Mono>> createOrUpdateByDepartmentWithResponseA * @param departmentName The name of the department. * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @param parameters The properties of the billing 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. @@ -4926,12 +5210,12 @@ private Mono>> createOrUpdateByDepartmentWithResponseA @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, BillingRoleAssignmentInner> beginCreateOrUpdateByDepartmentAsync(String billingAccountName, String departmentName, - String billingRoleAssignmentName, BillingRoleAssignmentInner parameters, Context context) { - context = this.client.mergeContext(context); + String billingRoleAssignmentName, BillingRoleAssignmentInner parameters) { Mono>> mono = createOrUpdateByDepartmentWithResponseAsync(billingAccountName, - departmentName, billingRoleAssignmentName, parameters, context); + departmentName, billingRoleAssignmentName, parameters); return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, context); + this.client.getHttpPipeline(), BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, + this.client.getContext()); } /** @@ -4951,10 +5235,10 @@ private Mono>> createOrUpdateByDepartmentWithResponseA public SyncPoller, BillingRoleAssignmentInner> beginCreateOrUpdateByDepartment(String billingAccountName, String departmentName, String billingRoleAssignmentName, BillingRoleAssignmentInner parameters) { - return this - .beginCreateOrUpdateByDepartmentAsync(billingAccountName, departmentName, billingRoleAssignmentName, - parameters) - .getSyncPoller(); + Response response = createOrUpdateByDepartmentWithResponse(billingAccountName, departmentName, + billingRoleAssignmentName, parameters); + return this.client.getLroResult(response, + BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, Context.NONE); } /** @@ -4975,10 +5259,10 @@ private Mono>> createOrUpdateByDepartmentWithResponseA public SyncPoller, BillingRoleAssignmentInner> beginCreateOrUpdateByDepartment(String billingAccountName, String departmentName, String billingRoleAssignmentName, BillingRoleAssignmentInner parameters, Context context) { - return this - .beginCreateOrUpdateByDepartmentAsync(billingAccountName, departmentName, billingRoleAssignmentName, - parameters, context) - .getSyncPoller(); + Response response = createOrUpdateByDepartmentWithResponse(billingAccountName, departmentName, + billingRoleAssignmentName, parameters, context); + return this.client.getLroResult(response, + BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, context); } /** @@ -5001,28 +5285,6 @@ private Mono createOrUpdateByDepartmentAsync(String parameters).last().flatMap(this.client::getLroFinalResultOrError); } - /** - * Create or update a billing role assignment. The operation is supported only for billing accounts with agreement - * type Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param departmentName The name of the department. - * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. - * @param parameters The properties of the billing 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 properties of the billing role assignment on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateByDepartmentAsync(String billingAccountName, - String departmentName, String billingRoleAssignmentName, BillingRoleAssignmentInner parameters, - Context context) { - return beginCreateOrUpdateByDepartmentAsync(billingAccountName, departmentName, billingRoleAssignmentName, - parameters, context).last().flatMap(this.client::getLroFinalResultOrError); - } - /** * Create or update a billing role assignment. The operation is supported only for billing accounts with agreement * type Enterprise Agreement. @@ -5039,8 +5301,8 @@ private Mono createOrUpdateByDepartmentAsync(String @ServiceMethod(returns = ReturnType.SINGLE) public BillingRoleAssignmentInner createOrUpdateByDepartment(String billingAccountName, String departmentName, String billingRoleAssignmentName, BillingRoleAssignmentInner parameters) { - return createOrUpdateByDepartmentAsync(billingAccountName, departmentName, billingRoleAssignmentName, - parameters).block(); + return beginCreateOrUpdateByDepartment(billingAccountName, departmentName, billingRoleAssignmentName, + parameters).getFinalResult(); } /** @@ -5060,8 +5322,8 @@ public BillingRoleAssignmentInner createOrUpdateByDepartment(String billingAccou @ServiceMethod(returns = ReturnType.SINGLE) public BillingRoleAssignmentInner createOrUpdateByDepartment(String billingAccountName, String departmentName, String billingRoleAssignmentName, BillingRoleAssignmentInner parameters, Context context) { - return createOrUpdateByDepartmentAsync(billingAccountName, departmentName, billingRoleAssignmentName, - parameters, context).block(); + return beginCreateOrUpdateByDepartment(billingAccountName, departmentName, billingRoleAssignmentName, + parameters, context).getFinalResult(); } /** @@ -5105,34 +5367,16 @@ private Mono> listByDepartmentSinglePa * * @param billingAccountName The ID that uniquely identifies a billing account. * @param departmentName The name of the department. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByDepartmentSinglePageAsync(String billingAccountName, - String departmentName, 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 (departmentName == null) { - return Mono.error(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByDepartment(this.client.getEndpoint(), billingAccountName, departmentName, - this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDepartmentAsync(String billingAccountName, + String departmentName) { + return new PagedFlux<>(() -> listByDepartmentSinglePageAsync(billingAccountName, departmentName), + nextLink -> listByDepartmentNextSinglePageAsync(nextLink)); } /** @@ -5144,13 +5388,29 @@ private Mono> listByDepartmentSinglePa * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByDepartmentAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByDepartmentSinglePage(String billingAccountName, String departmentName) { - return new PagedFlux<>(() -> listByDepartmentSinglePageAsync(billingAccountName, departmentName), - nextLink -> listByDepartmentNextSinglePageAsync(nextLink)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (departmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByDepartmentSync(this.client.getEndpoint(), + billingAccountName, departmentName, this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -5163,13 +5423,29 @@ private PagedFlux listByDepartmentAsync(String billi * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByDepartmentAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByDepartmentSinglePage(String billingAccountName, String departmentName, Context context) { - return new PagedFlux<>(() -> listByDepartmentSinglePageAsync(billingAccountName, departmentName, context), - nextLink -> listByDepartmentNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (departmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByDepartmentSync(this.client.getEndpoint(), + billingAccountName, departmentName, this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -5186,7 +5462,8 @@ private PagedFlux listByDepartmentAsync(String billi @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByDepartment(String billingAccountName, String departmentName) { - return new PagedIterable<>(listByDepartmentAsync(billingAccountName, departmentName)); + return new PagedIterable<>(() -> listByDepartmentSinglePage(billingAccountName, departmentName), + nextLink -> listByDepartmentNextSinglePage(nextLink)); } /** @@ -5204,7 +5481,8 @@ public PagedIterable listByDepartment(String billing @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByDepartment(String billingAccountName, String departmentName, Context context) { - return new PagedIterable<>(listByDepartmentAsync(billingAccountName, departmentName, context)); + return new PagedIterable<>(() -> listByDepartmentSinglePage(billingAccountName, departmentName, context), + nextLink -> listByDepartmentNextSinglePage(nextLink, context)); } /** @@ -5245,44 +5523,6 @@ private Mono> deleteByEnrollmentAccountWithResponseAsync(String b .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Deletes a role assignment on a enrollment Account. The operation is supported only for billing accounts with - * agreement type Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param enrollmentAccountName The name of the enrollment 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 {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteByEnrollmentAccountWithResponseAsync(String billingAccountName, - String enrollmentAccountName, 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 (enrollmentAccountName == null) { - return Mono - .error(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); - } - if (billingRoleAssignmentName == null) { - return Mono.error( - new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.deleteByEnrollmentAccount(this.client.getEndpoint(), billingAccountName, enrollmentAccountName, - billingRoleAssignmentName, this.client.getApiVersion(), accept, context); - } - /** * Deletes a role assignment on a enrollment Account. The operation is supported only for billing accounts with * agreement type Enterprise Agreement. @@ -5318,8 +5558,27 @@ private Mono deleteByEnrollmentAccountAsync(String billingAccountName, Str @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteByEnrollmentAccountWithResponse(String billingAccountName, String enrollmentAccountName, String billingRoleAssignmentName, Context context) { - return deleteByEnrollmentAccountWithResponseAsync(billingAccountName, enrollmentAccountName, - billingRoleAssignmentName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (enrollmentAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteByEnrollmentAccountSync(this.client.getEndpoint(), billingAccountName, + enrollmentAccountName, billingRoleAssignmentName, this.client.getApiVersion(), accept, context); } /** @@ -5379,45 +5638,6 @@ private Mono> getByEnrollmentAccountWithRes .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets a role assignment for the caller on a enrollment Account. The operation is supported only for billing - * accounts with agreement type Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param enrollmentAccountName The name of the enrollment 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 enrollment Account along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByEnrollmentAccountWithResponseAsync( - String billingAccountName, String enrollmentAccountName, 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 (enrollmentAccountName == null) { - return Mono - .error(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); - } - if (billingRoleAssignmentName == null) { - return Mono.error( - new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByEnrollmentAccount(this.client.getEndpoint(), billingAccountName, enrollmentAccountName, - billingRoleAssignmentName, this.client.getApiVersion(), accept, context); - } - /** * Gets a role assignment for the caller on a enrollment Account. The operation is supported only for billing * accounts with agreement type Enterprise Agreement. @@ -5453,8 +5673,27 @@ private Mono getByEnrollmentAccountAsync(String bill @ServiceMethod(returns = ReturnType.SINGLE) public Response getByEnrollmentAccountWithResponse(String billingAccountName, String enrollmentAccountName, String billingRoleAssignmentName, Context context) { - return getByEnrollmentAccountWithResponseAsync(billingAccountName, enrollmentAccountName, - billingRoleAssignmentName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (enrollmentAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByEnrollmentAccountSync(this.client.getEndpoint(), billingAccountName, enrollmentAccountName, + billingRoleAssignmentName, this.client.getApiVersion(), accept, context); } /** @@ -5531,42 +5770,42 @@ private Mono>> createOrUpdateByEnrollmentAccountWithRe * @param enrollmentAccountName The name of the enrollment account. * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @param parameters The properties of the billing 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 properties of the billing role assignment along with {@link Response} on successful completion of - * {@link Mono}. + * @return the properties of the billing role assignment along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateByEnrollmentAccountWithResponseAsync( - String billingAccountName, String enrollmentAccountName, String billingRoleAssignmentName, - BillingRoleAssignmentInner parameters, Context context) { + private Response createOrUpdateByEnrollmentAccountWithResponse(String billingAccountName, + String enrollmentAccountName, String billingRoleAssignmentName, BillingRoleAssignmentInner parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); } if (enrollmentAccountName == null) { - return Mono - .error(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); } if (billingRoleAssignmentName == null) { - return Mono.error( - new IllegalArgumentException("Parameter billingRoleAssignmentName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); } if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdateByEnrollmentAccount(this.client.getEndpoint(), billingAccountName, - enrollmentAccountName, billingRoleAssignmentName, this.client.getApiVersion(), parameters, accept, context); + return service.createOrUpdateByEnrollmentAccountSync(this.client.getEndpoint(), billingAccountName, + enrollmentAccountName, billingRoleAssignmentName, this.client.getApiVersion(), parameters, accept, + Context.NONE); } /** @@ -5577,20 +5816,43 @@ private Mono>> createOrUpdateByEnrollmentAccountWithRe * @param enrollmentAccountName The name of the enrollment account. * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @param parameters The properties of the billing 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 {@link PollerFlux} for polling of the properties of the billing role assignment. + * @return the properties of the billing role assignment along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, BillingRoleAssignmentInner> - beginCreateOrUpdateByEnrollmentAccountAsync(String billingAccountName, String enrollmentAccountName, - String billingRoleAssignmentName, BillingRoleAssignmentInner parameters) { - Mono>> mono = createOrUpdateByEnrollmentAccountWithResponseAsync(billingAccountName, - enrollmentAccountName, billingRoleAssignmentName, parameters); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateByEnrollmentAccountWithResponse(String billingAccountName, + String enrollmentAccountName, String billingRoleAssignmentName, BillingRoleAssignmentInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (enrollmentAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); + } + if (billingRoleAssignmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter billingRoleAssignmentName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.createOrUpdateByEnrollmentAccountSync(this.client.getEndpoint(), billingAccountName, + enrollmentAccountName, billingRoleAssignmentName, this.client.getApiVersion(), parameters, accept, context); } /** @@ -5601,7 +5863,6 @@ private Mono>> createOrUpdateByEnrollmentAccountWithRe * @param enrollmentAccountName The name of the enrollment account. * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @param parameters The properties of the billing 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. @@ -5610,12 +5871,12 @@ private Mono>> createOrUpdateByEnrollmentAccountWithRe @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, BillingRoleAssignmentInner> beginCreateOrUpdateByEnrollmentAccountAsync(String billingAccountName, String enrollmentAccountName, - String billingRoleAssignmentName, BillingRoleAssignmentInner parameters, Context context) { - context = this.client.mergeContext(context); + String billingRoleAssignmentName, BillingRoleAssignmentInner parameters) { Mono>> mono = createOrUpdateByEnrollmentAccountWithResponseAsync(billingAccountName, - enrollmentAccountName, billingRoleAssignmentName, parameters, context); + enrollmentAccountName, billingRoleAssignmentName, parameters); return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, context); + this.client.getHttpPipeline(), BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, + this.client.getContext()); } /** @@ -5635,10 +5896,10 @@ private Mono>> createOrUpdateByEnrollmentAccountWithRe public SyncPoller, BillingRoleAssignmentInner> beginCreateOrUpdateByEnrollmentAccount(String billingAccountName, String enrollmentAccountName, String billingRoleAssignmentName, BillingRoleAssignmentInner parameters) { - return this - .beginCreateOrUpdateByEnrollmentAccountAsync(billingAccountName, enrollmentAccountName, - billingRoleAssignmentName, parameters) - .getSyncPoller(); + Response response = createOrUpdateByEnrollmentAccountWithResponse(billingAccountName, + enrollmentAccountName, billingRoleAssignmentName, parameters); + return this.client.getLroResult(response, + BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, Context.NONE); } /** @@ -5653,36 +5914,16 @@ private Mono>> createOrUpdateByEnrollmentAccountWithRe * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link SyncPoller} for polling of the properties of the billing role assignment. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, BillingRoleAssignmentInner> - beginCreateOrUpdateByEnrollmentAccount(String billingAccountName, String enrollmentAccountName, - String billingRoleAssignmentName, BillingRoleAssignmentInner parameters, Context context) { - return this - .beginCreateOrUpdateByEnrollmentAccountAsync(billingAccountName, enrollmentAccountName, - billingRoleAssignmentName, parameters, context) - .getSyncPoller(); - } - - /** - * Create or update a billing role assignment. The operation is supported only for billing accounts with agreement - * type Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param enrollmentAccountName The name of the enrollment account. - * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. - * @param parameters The properties of the billing 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 properties of the billing role assignment on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of the properties of the billing role assignment. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateByEnrollmentAccountAsync(String billingAccountName, - String enrollmentAccountName, String billingRoleAssignmentName, BillingRoleAssignmentInner parameters) { - return beginCreateOrUpdateByEnrollmentAccountAsync(billingAccountName, enrollmentAccountName, - billingRoleAssignmentName, parameters).last().flatMap(this.client::getLroFinalResultOrError); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BillingRoleAssignmentInner> + beginCreateOrUpdateByEnrollmentAccount(String billingAccountName, String enrollmentAccountName, + String billingRoleAssignmentName, BillingRoleAssignmentInner parameters, Context context) { + Response response = createOrUpdateByEnrollmentAccountWithResponse(billingAccountName, + enrollmentAccountName, billingRoleAssignmentName, parameters, context); + return this.client.getLroResult(response, + BillingRoleAssignmentInner.class, BillingRoleAssignmentInner.class, context); } /** @@ -5693,7 +5934,6 @@ private Mono createOrUpdateByEnrollmentAccountAsync( * @param enrollmentAccountName The name of the enrollment account. * @param billingRoleAssignmentName The ID that uniquely identifies a role assignment. * @param parameters The properties of the billing 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. @@ -5701,10 +5941,9 @@ private Mono createOrUpdateByEnrollmentAccountAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createOrUpdateByEnrollmentAccountAsync(String billingAccountName, - String enrollmentAccountName, String billingRoleAssignmentName, BillingRoleAssignmentInner parameters, - Context context) { + String enrollmentAccountName, String billingRoleAssignmentName, BillingRoleAssignmentInner parameters) { return beginCreateOrUpdateByEnrollmentAccountAsync(billingAccountName, enrollmentAccountName, - billingRoleAssignmentName, parameters, context).last().flatMap(this.client::getLroFinalResultOrError); + billingRoleAssignmentName, parameters).last().flatMap(this.client::getLroFinalResultOrError); } /** @@ -5723,8 +5962,8 @@ private Mono createOrUpdateByEnrollmentAccountAsync( @ServiceMethod(returns = ReturnType.SINGLE) public BillingRoleAssignmentInner createOrUpdateByEnrollmentAccount(String billingAccountName, String enrollmentAccountName, String billingRoleAssignmentName, BillingRoleAssignmentInner parameters) { - return createOrUpdateByEnrollmentAccountAsync(billingAccountName, enrollmentAccountName, - billingRoleAssignmentName, parameters).block(); + return beginCreateOrUpdateByEnrollmentAccount(billingAccountName, enrollmentAccountName, + billingRoleAssignmentName, parameters).getFinalResult(); } /** @@ -5745,8 +5984,8 @@ public BillingRoleAssignmentInner createOrUpdateByEnrollmentAccount(String billi public BillingRoleAssignmentInner createOrUpdateByEnrollmentAccount(String billingAccountName, String enrollmentAccountName, String billingRoleAssignmentName, BillingRoleAssignmentInner parameters, Context context) { - return createOrUpdateByEnrollmentAccountAsync(billingAccountName, enrollmentAccountName, - billingRoleAssignmentName, parameters, context).block(); + return beginCreateOrUpdateByEnrollmentAccount(billingAccountName, enrollmentAccountName, + billingRoleAssignmentName, parameters, context).getFinalResult(); } /** @@ -5791,35 +6030,16 @@ public BillingRoleAssignmentInner createOrUpdateByEnrollmentAccount(String billi * * @param billingAccountName The ID that uniquely identifies a billing account. * @param enrollmentAccountName The name of the enrollment 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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByEnrollmentAccountSinglePageAsync( - String billingAccountName, String enrollmentAccountName, 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 (enrollmentAccountName == null) { - return Mono - .error(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByEnrollmentAccount(this.client.getEndpoint(), billingAccountName, enrollmentAccountName, - this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByEnrollmentAccountAsync(String billingAccountName, + String enrollmentAccountName) { + return new PagedFlux<>(() -> listByEnrollmentAccountSinglePageAsync(billingAccountName, enrollmentAccountName), + nextLink -> listByEnrollmentAccountNextSinglePageAsync(nextLink)); } /** @@ -5831,13 +6051,30 @@ private Mono> listByEnrollmentAccountS * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByEnrollmentAccountAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByEnrollmentAccountSinglePage(String billingAccountName, String enrollmentAccountName) { - return new PagedFlux<>(() -> listByEnrollmentAccountSinglePageAsync(billingAccountName, enrollmentAccountName), - nextLink -> listByEnrollmentAccountNextSinglePageAsync(nextLink)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (enrollmentAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByEnrollmentAccountSync(this.client.getEndpoint(), billingAccountName, enrollmentAccountName, + this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -5850,14 +6087,30 @@ private PagedFlux listByEnrollmentAccountAsync(Strin * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByEnrollmentAccountAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByEnrollmentAccountSinglePage(String billingAccountName, String enrollmentAccountName, Context context) { - return new PagedFlux<>( - () -> listByEnrollmentAccountSinglePageAsync(billingAccountName, enrollmentAccountName, context), - nextLink -> listByEnrollmentAccountNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (enrollmentAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByEnrollmentAccountSync(this.client.getEndpoint(), billingAccountName, enrollmentAccountName, + this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -5874,7 +6127,8 @@ private PagedFlux listByEnrollmentAccountAsync(Strin @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByEnrollmentAccount(String billingAccountName, String enrollmentAccountName) { - return new PagedIterable<>(listByEnrollmentAccountAsync(billingAccountName, enrollmentAccountName)); + return new PagedIterable<>(() -> listByEnrollmentAccountSinglePage(billingAccountName, enrollmentAccountName), + nextLink -> listByEnrollmentAccountNextSinglePage(nextLink)); } /** @@ -5892,7 +6146,9 @@ public PagedIterable listByEnrollmentAccount(String @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByEnrollmentAccount(String billingAccountName, String enrollmentAccountName, Context context) { - return new PagedIterable<>(listByEnrollmentAccountAsync(billingAccountName, enrollmentAccountName, context)); + return new PagedIterable<>( + () -> listByEnrollmentAccountSinglePage(billingAccountName, enrollmentAccountName, context), + nextLink -> listByEnrollmentAccountNextSinglePage(nextLink, context)); } /** @@ -5927,6 +6183,37 @@ private Mono>> resolveByBillingAccountWithResponseAsyn .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Lists the role assignments for the caller on a billing account while fetching user info for each role assignment. + * The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft + * Customer Agreement or Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param resolveScopeDisplayNames Resolves the scope display name for each of the role assignments. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response resolveByBillingAccountWithResponse(String billingAccountName, + Boolean resolveScopeDisplayNames, String filter) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.resolveByBillingAccountSync(this.client.getEndpoint(), billingAccountName, + resolveScopeDisplayNames, this.client.getApiVersion(), filter, accept, Context.NONE); + } + /** * Lists the role assignments for the caller on a billing account while fetching user info for each role assignment. * The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft @@ -5940,23 +6227,23 @@ private Mono>> resolveByBillingAccountWithResponseAsyn * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link Response} on successful completion of {@link Mono}. + * @return a container for a list of resources along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> resolveByBillingAccountWithResponseAsync(String billingAccountName, + private Response resolveByBillingAccountWithResponse(String billingAccountName, Boolean resolveScopeDisplayNames, String filter, Context context) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.resolveByBillingAccount(this.client.getEndpoint(), billingAccountName, resolveScopeDisplayNames, - this.client.getApiVersion(), filter, accept, context); + return service.resolveByBillingAccountSync(this.client.getEndpoint(), billingAccountName, + resolveScopeDisplayNames, this.client.getApiVersion(), filter, accept, context); } /** @@ -6015,22 +6302,19 @@ private Mono>> resolveByBillingAccountWithResponseAsyn * @param resolveScopeDisplayNames Resolves the scope display name for each of the role assignments. * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a * request URL. - * @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 {@link PollerFlux} for polling of a container for a list of resources. + * @return the {@link SyncPoller} for polling of a container for a list of resources. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, BillingRoleAssignmentListResultInner> - beginResolveByBillingAccountAsync(String billingAccountName, Boolean resolveScopeDisplayNames, String filter, - Context context) { - context = this.client.mergeContext(context); - Mono>> mono - = resolveByBillingAccountWithResponseAsync(billingAccountName, resolveScopeDisplayNames, filter, context); + public SyncPoller, BillingRoleAssignmentListResultInner> + beginResolveByBillingAccount(String billingAccountName, Boolean resolveScopeDisplayNames, String filter) { + Response response + = resolveByBillingAccountWithResponse(billingAccountName, resolveScopeDisplayNames, filter); return this.client.getLroResult( - mono, this.client.getHttpPipeline(), BillingRoleAssignmentListResultInner.class, - BillingRoleAssignmentListResultInner.class, context); + response, BillingRoleAssignmentListResultInner.class, BillingRoleAssignmentListResultInner.class, + Context.NONE); } /** @@ -6049,8 +6333,11 @@ private Mono>> resolveByBillingAccountWithResponseAsyn beginResolveByBillingAccount(String billingAccountName) { final Boolean resolveScopeDisplayNames = null; final String filter = null; - return this.beginResolveByBillingAccountAsync(billingAccountName, resolveScopeDisplayNames, filter) - .getSyncPoller(); + Response response + = resolveByBillingAccountWithResponse(billingAccountName, resolveScopeDisplayNames, filter); + return this.client.getLroResult( + response, BillingRoleAssignmentListResultInner.class, BillingRoleAssignmentListResultInner.class, + Context.NONE); } /** @@ -6072,8 +6359,10 @@ private Mono>> resolveByBillingAccountWithResponseAsyn public SyncPoller, BillingRoleAssignmentListResultInner> beginResolveByBillingAccount(String billingAccountName, Boolean resolveScopeDisplayNames, String filter, Context context) { - return this.beginResolveByBillingAccountAsync(billingAccountName, resolveScopeDisplayNames, filter, context) - .getSyncPoller(); + Response response + = resolveByBillingAccountWithResponse(billingAccountName, resolveScopeDisplayNames, filter, context); + return this.client.getLroResult( + response, BillingRoleAssignmentListResultInner.class, BillingRoleAssignmentListResultInner.class, context); } /** @@ -6116,28 +6405,6 @@ private Mono resolveByBillingAccountAsync( .flatMap(this.client::getLroFinalResultOrError); } - /** - * Lists the role assignments for the caller on a billing account while fetching user info for each role assignment. - * The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft - * Customer Agreement or Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param resolveScopeDisplayNames Resolves the scope display name for each of the role assignments. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @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 container for a list of resources on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono resolveByBillingAccountAsync(String billingAccountName, - Boolean resolveScopeDisplayNames, String filter, Context context) { - return beginResolveByBillingAccountAsync(billingAccountName, resolveScopeDisplayNames, filter, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Lists the role assignments for the caller on a billing account while fetching user info for each role assignment. * The operation is supported for billing accounts with agreement type Microsoft Partner Agreement, Microsoft @@ -6153,7 +6420,7 @@ private Mono resolveByBillingAccountAsync( public BillingRoleAssignmentListResultInner resolveByBillingAccount(String billingAccountName) { final Boolean resolveScopeDisplayNames = null; final String filter = null; - return resolveByBillingAccountAsync(billingAccountName, resolveScopeDisplayNames, filter).block(); + return beginResolveByBillingAccount(billingAccountName, resolveScopeDisplayNames, filter).getFinalResult(); } /** @@ -6174,7 +6441,8 @@ public BillingRoleAssignmentListResultInner resolveByBillingAccount(String billi @ServiceMethod(returns = ReturnType.SINGLE) public BillingRoleAssignmentListResultInner resolveByBillingAccount(String billingAccountName, Boolean resolveScopeDisplayNames, String filter, Context context) { - return resolveByBillingAccountAsync(billingAccountName, resolveScopeDisplayNames, filter, context).block(); + return beginResolveByBillingAccount(billingAccountName, resolveScopeDisplayNames, filter, context) + .getFinalResult(); } /** @@ -6205,6 +6473,33 @@ private Mono> listByBillingProfileNext .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -6213,24 +6508,25 @@ private Mono> listByBillingProfileNext * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingProfileNextSinglePageAsync(String nextLink, + private PagedResponse listByBillingProfileNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -6260,6 +6556,33 @@ private Mono> listByCustomerNextSingle .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByCustomerNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -6268,24 +6591,24 @@ private Mono> listByCustomerNextSingle * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByCustomerNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByCustomerNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByCustomerNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -6316,6 +6639,33 @@ private Mono> listByInvoiceSectionNext .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceSectionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByInvoiceSectionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -6324,24 +6674,25 @@ private Mono> listByInvoiceSectionNext * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByInvoiceSectionNextSinglePageAsync(String nextLink, + private PagedResponse listByInvoiceSectionNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByInvoiceSectionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -6372,6 +6723,33 @@ private Mono> listByBillingAccountNext .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -6380,24 +6758,25 @@ private Mono> listByBillingAccountNext * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountNextSinglePageAsync(String nextLink, + private PagedResponse listByBillingAccountNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -6427,6 +6806,33 @@ private Mono> listByDepartmentNextSing .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByDepartmentNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByDepartmentNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -6435,24 +6841,24 @@ private Mono> listByDepartmentNextSing * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByDepartmentNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByDepartmentNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listByDepartmentNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listByDepartmentNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -6484,6 +6890,33 @@ private Mono> listByDepartmentNextSing .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByEnrollmentAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByEnrollmentAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -6492,23 +6925,26 @@ private Mono> listByDepartmentNextSing * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByEnrollmentAccountNextSinglePageAsync(String nextLink, + private PagedResponse listByEnrollmentAccountNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listByEnrollmentAccountNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listByEnrollmentAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(BillingRoleAssignmentsClientImpl.class); } 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 index 6237196b32f9..a9ae807fd68e 100644 --- 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 @@ -25,6 +25,7 @@ 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; @@ -72,6 +73,16 @@ Mono> getByBillingProfile(@HostParam("$host @PathParam("roleDefinitionName") String roleDefinitionName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions/{roleDefinitionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByBillingProfileSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("roleDefinitionName") String roleDefinitionName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingRoleDefinitions") @ExpectedResponses({ 200 }) @@ -81,6 +92,15 @@ Mono> listByBillingProfile(@HostParam( @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}/billingRoleDefinitions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingProfileSync(@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}/customers/{customerName}/billingRoleDefinitions/{roleDefinitionName}") @ExpectedResponses({ 200 }) @@ -91,6 +111,16 @@ Mono> getByCustomer(@HostParam("$host") Str @PathParam("roleDefinitionName") String roleDefinitionName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/billingRoleDefinitions/{roleDefinitionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByCustomerSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @PathParam("customerName") String customerName, + @PathParam("roleDefinitionName") String roleDefinitionName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/billingRoleDefinitions") @ExpectedResponses({ 200 }) @@ -100,6 +130,15 @@ Mono> listByCustomer(@HostParam("$host @PathParam("billingProfileName") String billingProfileName, @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}/billingProfiles/{billingProfileName}/customers/{customerName}/billingRoleDefinitions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByCustomerSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @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}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions/{roleDefinitionName}") @ExpectedResponses({ 200 }) @@ -111,6 +150,17 @@ Mono> getByInvoiceSection(@HostParam("$host @PathParam("roleDefinitionName") String roleDefinitionName, @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}/billingRoleDefinitions/{roleDefinitionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByInvoiceSectionSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("invoiceSectionName") String invoiceSectionName, + @PathParam("roleDefinitionName") String roleDefinitionName, @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}/billingRoleDefinitions") @ExpectedResponses({ 200 }) @@ -121,6 +171,16 @@ Mono> listByInvoiceSection(@HostParam( @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}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingRoleDefinitions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByInvoiceSectionSync(@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}/billingRoleDefinitions/{roleDefinitionName}") @ExpectedResponses({ 200 }) @@ -130,6 +190,15 @@ Mono> getByBillingAccount(@HostParam("$host @PathParam("roleDefinitionName") String roleDefinitionName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions/{roleDefinitionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("roleDefinitionName") String roleDefinitionName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingRoleDefinitions") @ExpectedResponses({ 200 }) @@ -138,6 +207,14 @@ Mono> listByBillingAccount(@HostParam( @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}/billingRoleDefinitions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingAccountSync(@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}/departments/{departmentName}/billingRoleDefinitions/{roleDefinitionName}") @ExpectedResponses({ 200 }) @@ -148,6 +225,16 @@ Mono> getByDepartment(@HostParam("$host") S @PathParam("roleDefinitionName") String roleDefinitionName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingRoleDefinitions/{roleDefinitionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByDepartmentSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("departmentName") String departmentName, + @PathParam("roleDefinitionName") String roleDefinitionName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingRoleDefinitions") @ExpectedResponses({ 200 }) @@ -157,6 +244,15 @@ Mono> listByDepartment(@HostParam("$ho @PathParam("departmentName") String departmentName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/billingRoleDefinitions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByDepartmentSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("departmentName") String departmentName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleDefinitions/{roleDefinitionName}") @ExpectedResponses({ 200 }) @@ -167,6 +263,16 @@ Mono> getByEnrollmentAccount(@HostParam("$h @PathParam("roleDefinitionName") String roleDefinitionName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleDefinitions/{roleDefinitionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByEnrollmentAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("enrollmentAccountName") String enrollmentAccountName, + @PathParam("roleDefinitionName") String roleDefinitionName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleDefinitions") @ExpectedResponses({ 200 }) @@ -176,6 +282,15 @@ Mono> listByEnrollmentAccount(@HostPar @PathParam("enrollmentAccountName") String enrollmentAccountName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingRoleDefinitions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByEnrollmentAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("enrollmentAccountName") String enrollmentAccountName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -184,6 +299,14 @@ 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) + Response listByBillingProfileNextSync( + @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 }) @@ -192,6 +315,14 @@ 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) + Response listByCustomerNextSync( + @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 }) @@ -200,6 +331,14 @@ 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) + Response listByInvoiceSectionNextSync( + @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 }) @@ -208,6 +347,14 @@ 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) + Response listByBillingAccountNextSync( + @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 }) @@ -216,6 +363,14 @@ Mono> listByDepartmentNext( @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) + Response listByDepartmentNextSync( + @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 }) @@ -223,6 +378,14 @@ Mono> listByDepartmentNext( Mono> listByEnrollmentAccountNext( @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) + Response listByEnrollmentAccountNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -264,45 +427,6 @@ private Mono> getByBillingProfileWithRespon .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 roleDefinitionName 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 along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByBillingProfileWithResponseAsync(String billingAccountName, - String billingProfileName, String roleDefinitionName, 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 (roleDefinitionName == null) { - return Mono - .error(new IllegalArgumentException("Parameter roleDefinitionName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByBillingProfile(this.client.getEndpoint(), billingAccountName, billingProfileName, - roleDefinitionName, this.client.getApiVersion(), 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. @@ -338,8 +462,26 @@ private Mono getByBillingProfileAsync(String billing @ServiceMethod(returns = ReturnType.SINGLE) public Response getByBillingProfileWithResponse(String billingAccountName, String billingProfileName, String roleDefinitionName, Context context) { - return getByBillingProfileWithResponseAsync(billingAccountName, billingProfileName, roleDefinitionName, context) - .block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (roleDefinitionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter roleDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByBillingProfileSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + roleDefinitionName, this.client.getApiVersion(), accept, context); } /** @@ -403,35 +545,16 @@ public BillingRoleDefinitionInner getByBillingProfile(String billingAccountName, * * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources as paginated response with {@link PagedFlux}. */ - @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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingProfile(this.client.getEndpoint(), billingAccountName, billingProfileName, - this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync(String billingAccountName, + String billingProfileName) { + return new PagedFlux<>(() -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); } /** @@ -443,13 +566,29 @@ public BillingRoleDefinitionInner getByBillingProfile(String billingAccountName, * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingProfileAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, String billingProfileName) { - return new PagedFlux<>(() -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName), - nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingProfileSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -462,14 +601,29 @@ private PagedFlux listByBillingProfileAsync(String b * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingProfileAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, String billingProfileName, Context context) { - return new PagedFlux<>( - () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, context), - nextLink -> listByBillingProfileNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingProfileSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -486,7 +640,8 @@ private PagedFlux listByBillingProfileAsync(String b @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName) { - return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName)); + return new PagedIterable<>(() -> listByBillingProfileSinglePage(billingAccountName, billingProfileName), + nextLink -> listByBillingProfileNextSinglePage(nextLink)); } /** @@ -504,7 +659,9 @@ public PagedIterable listByBillingProfile(String bil @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName, Context context) { - return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, context)); + return new PagedIterable<>( + () -> listByBillingProfileSinglePage(billingAccountName, billingProfileName, context), + nextLink -> listByBillingProfileNextSinglePage(nextLink, context)); } /** @@ -550,49 +707,6 @@ private Mono> getByCustomerWithResponseAsyn .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets the definition for a role on a customer. The operation is supported only for billing accounts with agreement - * type Microsoft Partner Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param customerName The ID that uniquely identifies a customer. - * @param roleDefinitionName 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 customer along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByCustomerWithResponseAsync(String billingAccountName, - String billingProfileName, String customerName, String roleDefinitionName, 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 (customerName == null) { - return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); - } - if (roleDefinitionName == null) { - return Mono - .error(new IllegalArgumentException("Parameter roleDefinitionName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByCustomer(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName, - roleDefinitionName, this.client.getApiVersion(), accept, context); - } - /** * Gets the definition for a role on a customer. The operation is supported only for billing accounts with agreement * type Microsoft Partner Agreement. @@ -630,8 +744,30 @@ private Mono getByCustomerAsync(String billingAccoun @ServiceMethod(returns = ReturnType.SINGLE) public Response getByCustomerWithResponse(String billingAccountName, String billingProfileName, String customerName, String roleDefinitionName, Context context) { - return getByCustomerWithResponseAsync(billingAccountName, billingProfileName, customerName, roleDefinitionName, - context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + if (roleDefinitionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter roleDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByCustomerSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + customerName, roleDefinitionName, this.client.getApiVersion(), accept, context); } /** @@ -694,47 +830,6 @@ private Mono> listByCustomerSinglePage .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Lists the role definitions for a customer. The operation is supported for billing accounts with agreement type - * Microsoft Partner Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param customerName The ID that uniquely identifies a customer. - * @param 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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByCustomerSinglePageAsync(String billingAccountName, - String billingProfileName, 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 (billingProfileName == null) { - return Mono - .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); - } - if (customerName == null) { - return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByCustomer(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName, - this.client.getApiVersion(), 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 customer. The operation is supported for billing accounts with agreement type * Microsoft Partner Agreement. @@ -762,18 +857,36 @@ private PagedFlux listByCustomerAsync(String billing * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingProfileName The ID that uniquely identifies a billing profile. * @param customerName The ID that uniquely identifies a customer. - * @param 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 container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByCustomerAsync(String billingAccountName, - String billingProfileName, String customerName, Context context) { - return new PagedFlux<>( - () -> listByCustomerSinglePageAsync(billingAccountName, billingProfileName, customerName, context), - nextLink -> listByCustomerNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerSinglePage(String billingAccountName, + String billingProfileName, String customerName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByCustomerSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, customerName, this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -783,15 +896,37 @@ private PagedFlux listByCustomerAsync(String billing * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingProfileName The ID that uniquely identifies a billing profile. * @param customerName The ID that uniquely identifies a customer. + * @param 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 container for a list of resources as paginated response with {@link PagedIterable}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByCustomer(String billingAccountName, - String billingProfileName, String customerName) { - return new PagedIterable<>(listByCustomerAsync(billingAccountName, billingProfileName, customerName)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerSinglePage(String billingAccountName, + String billingProfileName, String customerName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByCustomerSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, customerName, this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -801,61 +936,37 @@ public PagedIterable listByCustomer(String billingAc * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingProfileName The ID that uniquely identifies a billing profile. * @param customerName The ID that uniquely identifies a customer. - * @param 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 container for a list of resources as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByCustomer(String billingAccountName, - String billingProfileName, String customerName, Context context) { - return new PagedIterable<>(listByCustomerAsync(billingAccountName, billingProfileName, customerName, 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 roleDefinitionName 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 along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByInvoiceSectionWithResponseAsync(String billingAccountName, - String billingProfileName, String invoiceSectionName, String roleDefinitionName) { - 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 (roleDefinitionName == null) { - return Mono - .error(new IllegalArgumentException("Parameter roleDefinitionName is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getByInvoiceSection(this.client.getEndpoint(), billingAccountName, - billingProfileName, invoiceSectionName, roleDefinitionName, this.client.getApiVersion(), accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCustomer(String billingAccountName, + String billingProfileName, String customerName) { + return new PagedIterable<>(() -> listByCustomerSinglePage(billingAccountName, billingProfileName, customerName), + nextLink -> listByCustomerNextSinglePage(nextLink)); + } + + /** + * Lists the role definitions for a customer. The operation is supported for billing accounts with agreement type + * Microsoft Partner Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @param 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 container for a list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCustomer(String billingAccountName, + String billingProfileName, String customerName, Context context) { + return new PagedIterable<>( + () -> listByCustomerSinglePage(billingAccountName, billingProfileName, customerName, context), + nextLink -> listByCustomerNextSinglePage(nextLink, context)); } /** @@ -866,7 +977,6 @@ private Mono> getByInvoiceSectionWithRespon * @param billingProfileName The ID that uniquely identifies a billing profile. * @param invoiceSectionName The ID that uniquely identifies an invoice section. * @param roleDefinitionName 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. @@ -875,7 +985,7 @@ private Mono> getByInvoiceSectionWithRespon */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getByInvoiceSectionWithResponseAsync(String billingAccountName, - String billingProfileName, String invoiceSectionName, String roleDefinitionName, Context context) { + String billingProfileName, String invoiceSectionName, String roleDefinitionName) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -897,9 +1007,11 @@ private Mono> getByInvoiceSectionWithRespon .error(new IllegalArgumentException("Parameter roleDefinitionName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByInvoiceSection(this.client.getEndpoint(), billingAccountName, billingProfileName, - invoiceSectionName, roleDefinitionName, this.client.getApiVersion(), accept, context); + return FluxUtil + .withContext(context -> service.getByInvoiceSection(this.client.getEndpoint(), billingAccountName, + billingProfileName, invoiceSectionName, roleDefinitionName, this.client.getApiVersion(), accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -939,8 +1051,30 @@ private Mono getByInvoiceSectionAsync(String billing @ServiceMethod(returns = ReturnType.SINGLE) public Response getByInvoiceSectionWithResponse(String billingAccountName, String billingProfileName, String invoiceSectionName, String roleDefinitionName, Context context) { - return getByInvoiceSectionWithResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, - roleDefinitionName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + if (roleDefinitionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter roleDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByInvoiceSectionSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + invoiceSectionName, roleDefinitionName, this.client.getApiVersion(), accept, context); } /** @@ -1011,39 +1145,17 @@ private Mono> listByInvoiceSectionSing * @param billingAccountName The ID that uniquely 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 a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources as paginated response with {@link PagedFlux}. */ - @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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByInvoiceSection(this.client.getEndpoint(), billingAccountName, billingProfileName, invoiceSectionName, - this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInvoiceSectionAsync(String billingAccountName, + String billingProfileName, String invoiceSectionName) { + return new PagedFlux<>( + () -> listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName), + nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink)); } /** @@ -1056,14 +1168,34 @@ private Mono> listByInvoiceSectionSing * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByInvoiceSectionAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceSectionSinglePage(String billingAccountName, String billingProfileName, String invoiceSectionName) { - return new PagedFlux<>( - () -> listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName), - nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByInvoiceSectionSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + invoiceSectionName, this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1077,13 +1209,33 @@ private PagedFlux listByInvoiceSectionAsync(String b * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByInvoiceSectionAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceSectionSinglePage(String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { - return new PagedFlux<>(() -> listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, - invoiceSectionName, context), nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByInvoiceSectionSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, invoiceSectionName, this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1102,7 +1254,8 @@ private PagedFlux listByInvoiceSectionAsync(String b public PagedIterable listByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName) { return new PagedIterable<>( - listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName)); + () -> listByInvoiceSectionSinglePage(billingAccountName, billingProfileName, invoiceSectionName), + nextLink -> listByInvoiceSectionNextSinglePage(nextLink)); } /** @@ -1122,7 +1275,8 @@ public PagedIterable listByInvoiceSection(String bil public PagedIterable listByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { return new PagedIterable<>( - listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, context)); + () -> listByInvoiceSectionSinglePage(billingAccountName, billingProfileName, invoiceSectionName, context), + nextLink -> listByInvoiceSectionNextSinglePage(nextLink, context)); } /** @@ -1159,40 +1313,6 @@ private Mono> getByBillingAccountWithRespon .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, Microsoft Customer Agreement or Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param roleDefinitionName 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 along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByBillingAccountWithResponseAsync(String billingAccountName, - String roleDefinitionName, 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 (roleDefinitionName == null) { - return Mono - .error(new IllegalArgumentException("Parameter roleDefinitionName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByBillingAccount(this.client.getEndpoint(), billingAccountName, roleDefinitionName, - this.client.getApiVersion(), 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, Microsoft Customer Agreement or Enterprise Agreement. @@ -1226,7 +1346,22 @@ private Mono getByBillingAccountAsync(String billing @ServiceMethod(returns = ReturnType.SINGLE) public Response getByBillingAccountWithResponse(String billingAccountName, String roleDefinitionName, Context context) { - return getByBillingAccountWithResponseAsync(billingAccountName, roleDefinitionName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (roleDefinitionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter roleDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByBillingAccountSync(this.client.getEndpoint(), billingAccountName, roleDefinitionName, + this.client.getApiVersion(), accept, context); } /** @@ -1281,31 +1416,15 @@ public BillingRoleDefinitionInner getByBillingAccount(String billingAccountName, * type Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise 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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources as paginated response with {@link PagedFlux}. */ - @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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingAccount(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), accept, - context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync(String billingAccountName) { + return new PagedFlux<>(() -> listByBillingAccountSinglePageAsync(billingAccountName), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); } /** @@ -1316,12 +1435,24 @@ public BillingRoleDefinitionInner getByBillingAccount(String billingAccountName, * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName) { - return new PagedFlux<>(() -> listByBillingAccountSinglePageAsync(billingAccountName), - nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingAccountSync(this.client.getEndpoint(), + billingAccountName, this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1333,13 +1464,25 @@ private PagedFlux listByBillingAccountAsync(String b * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, Context context) { - return new PagedFlux<>(() -> listByBillingAccountSinglePageAsync(billingAccountName, context), - nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingAccountSync(this.client.getEndpoint(), + billingAccountName, this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1354,7 +1497,8 @@ private PagedFlux listByBillingAccountAsync(String b */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingAccount(String billingAccountName) { - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName), + nextLink -> listByBillingAccountNextSinglePage(nextLink)); } /** @@ -1370,7 +1514,8 @@ public PagedIterable listByBillingAccount(String bil */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingAccount(String billingAccountName, Context context) { - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, context)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, context), + nextLink -> listByBillingAccountNextSinglePage(nextLink, context)); } /** @@ -1411,44 +1556,6 @@ private Mono> getByDepartmentWithResponseAs .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets the definition for a role on a department. The operation is supported for billing accounts with agreement - * type Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param departmentName The name of the department. - * @param roleDefinitionName 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 department along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByDepartmentWithResponseAsync(String billingAccountName, - String departmentName, String roleDefinitionName, 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 (departmentName == null) { - return Mono.error(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); - } - if (roleDefinitionName == null) { - return Mono - .error(new IllegalArgumentException("Parameter roleDefinitionName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByDepartment(this.client.getEndpoint(), billingAccountName, departmentName, - roleDefinitionName, this.client.getApiVersion(), accept, context); - } - /** * Gets the definition for a role on a department. The operation is supported for billing accounts with agreement * type Enterprise Agreement. @@ -1484,8 +1591,26 @@ private Mono getByDepartmentAsync(String billingAcco @ServiceMethod(returns = ReturnType.SINGLE) public Response getByDepartmentWithResponse(String billingAccountName, String departmentName, String roleDefinitionName, Context context) { - return getByDepartmentWithResponseAsync(billingAccountName, departmentName, roleDefinitionName, context) - .block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (departmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); + } + if (roleDefinitionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter roleDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByDepartmentSync(this.client.getEndpoint(), billingAccountName, departmentName, + roleDefinitionName, this.client.getApiVersion(), accept, context); } /** @@ -1542,42 +1667,6 @@ private Mono> listByDepartmentSinglePa .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * List the definition for a department. The operation is supported for billing accounts with agreement type - * Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param departmentName The name of the department. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByDepartmentSinglePageAsync(String billingAccountName, - String departmentName, 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 (departmentName == null) { - return Mono.error(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByDepartment(this.client.getEndpoint(), billingAccountName, departmentName, - this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - /** * List the definition for a department. The operation is supported for billing accounts with agreement type * Enterprise Agreement. @@ -1596,6 +1685,40 @@ private PagedFlux listByDepartmentAsync(String billi nextLink -> listByDepartmentNextSinglePageAsync(nextLink)); } + /** + * List the definition for a department. The operation is supported for billing accounts with agreement type + * Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The name of the department. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByDepartmentSinglePage(String billingAccountName, + String departmentName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (departmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByDepartmentSync(this.client.getEndpoint(), + billingAccountName, departmentName, this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * List the definition for a department. The operation is supported for billing accounts with agreement type * Enterprise Agreement. @@ -1606,13 +1729,29 @@ private PagedFlux listByDepartmentAsync(String billi * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByDepartmentAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByDepartmentSinglePage(String billingAccountName, String departmentName, Context context) { - return new PagedFlux<>(() -> listByDepartmentSinglePageAsync(billingAccountName, departmentName, context), - nextLink -> listByDepartmentNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (departmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByDepartmentSync(this.client.getEndpoint(), + billingAccountName, departmentName, this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1629,7 +1768,8 @@ private PagedFlux listByDepartmentAsync(String billi @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByDepartment(String billingAccountName, String departmentName) { - return new PagedIterable<>(listByDepartmentAsync(billingAccountName, departmentName)); + return new PagedIterable<>(() -> listByDepartmentSinglePage(billingAccountName, departmentName), + nextLink -> listByDepartmentNextSinglePage(nextLink)); } /** @@ -1647,7 +1787,8 @@ public PagedIterable listByDepartment(String billing @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByDepartment(String billingAccountName, String departmentName, Context context) { - return new PagedIterable<>(listByDepartmentAsync(billingAccountName, departmentName, context)); + return new PagedIterable<>(() -> listByDepartmentSinglePage(billingAccountName, departmentName, context), + nextLink -> listByDepartmentNextSinglePage(nextLink, context)); } /** @@ -1689,45 +1830,6 @@ private Mono> getByEnrollmentAccountWithRes .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets the definition for a role on an enrollment account. The operation is supported for billing accounts with - * agreement type Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param enrollmentAccountName The name of the enrollment account. - * @param roleDefinitionName 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 enrollment account along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByEnrollmentAccountWithResponseAsync( - String billingAccountName, String enrollmentAccountName, String roleDefinitionName, 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 (enrollmentAccountName == null) { - return Mono - .error(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); - } - if (roleDefinitionName == null) { - return Mono - .error(new IllegalArgumentException("Parameter roleDefinitionName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByEnrollmentAccount(this.client.getEndpoint(), billingAccountName, enrollmentAccountName, - roleDefinitionName, this.client.getApiVersion(), accept, context); - } - /** * Gets the definition for a role on an enrollment account. The operation is supported for billing accounts with * agreement type Enterprise Agreement. @@ -1763,8 +1865,26 @@ private Mono getByEnrollmentAccountAsync(String bill @ServiceMethod(returns = ReturnType.SINGLE) public Response getByEnrollmentAccountWithResponse(String billingAccountName, String enrollmentAccountName, String roleDefinitionName, Context context) { - return getByEnrollmentAccountWithResponseAsync(billingAccountName, enrollmentAccountName, roleDefinitionName, - context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (enrollmentAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); + } + if (roleDefinitionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter roleDefinitionName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByEnrollmentAccountSync(this.client.getEndpoint(), billingAccountName, enrollmentAccountName, + roleDefinitionName, this.client.getApiVersion(), accept, context); } /** @@ -1828,35 +1948,16 @@ public BillingRoleDefinitionInner getByEnrollmentAccount(String billingAccountNa * * @param billingAccountName The ID that uniquely identifies a billing account. * @param enrollmentAccountName The name of the enrollment 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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByEnrollmentAccountSinglePageAsync( - String billingAccountName, String enrollmentAccountName, 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 (enrollmentAccountName == null) { - return Mono - .error(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByEnrollmentAccount(this.client.getEndpoint(), billingAccountName, enrollmentAccountName, - this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByEnrollmentAccountAsync(String billingAccountName, + String enrollmentAccountName) { + return new PagedFlux<>(() -> listByEnrollmentAccountSinglePageAsync(billingAccountName, enrollmentAccountName), + nextLink -> listByEnrollmentAccountNextSinglePageAsync(nextLink)); } /** @@ -1868,13 +1969,29 @@ private Mono> listByEnrollmentAccountS * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByEnrollmentAccountAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByEnrollmentAccountSinglePage(String billingAccountName, String enrollmentAccountName) { - return new PagedFlux<>(() -> listByEnrollmentAccountSinglePageAsync(billingAccountName, enrollmentAccountName), - nextLink -> listByEnrollmentAccountNextSinglePageAsync(nextLink)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (enrollmentAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByEnrollmentAccountSync(this.client.getEndpoint(), + billingAccountName, enrollmentAccountName, this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1887,14 +2004,29 @@ private PagedFlux listByEnrollmentAccountAsync(Strin * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByEnrollmentAccountAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByEnrollmentAccountSinglePage(String billingAccountName, String enrollmentAccountName, Context context) { - return new PagedFlux<>( - () -> listByEnrollmentAccountSinglePageAsync(billingAccountName, enrollmentAccountName, context), - nextLink -> listByEnrollmentAccountNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (enrollmentAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByEnrollmentAccountSync(this.client.getEndpoint(), + billingAccountName, enrollmentAccountName, this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1911,7 +2043,8 @@ private PagedFlux listByEnrollmentAccountAsync(Strin @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByEnrollmentAccount(String billingAccountName, String enrollmentAccountName) { - return new PagedIterable<>(listByEnrollmentAccountAsync(billingAccountName, enrollmentAccountName)); + return new PagedIterable<>(() -> listByEnrollmentAccountSinglePage(billingAccountName, enrollmentAccountName), + nextLink -> listByEnrollmentAccountNextSinglePage(nextLink)); } /** @@ -1929,7 +2062,9 @@ public PagedIterable listByEnrollmentAccount(String @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByEnrollmentAccount(String billingAccountName, String enrollmentAccountName, Context context) { - return new PagedIterable<>(listByEnrollmentAccountAsync(billingAccountName, enrollmentAccountName, context)); + return new PagedIterable<>( + () -> listByEnrollmentAccountSinglePage(billingAccountName, enrollmentAccountName, context), + nextLink -> listByEnrollmentAccountNextSinglePage(nextLink, context)); } /** @@ -1960,6 +2095,33 @@ private Mono> listByBillingProfileNext .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1968,24 +2130,25 @@ private Mono> listByBillingProfileNext * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingProfileNextSinglePageAsync(String nextLink, + private PagedResponse listByBillingProfileNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -2015,6 +2178,33 @@ private Mono> listByCustomerNextSingle .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByCustomerNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -2023,24 +2213,24 @@ private Mono> listByCustomerNextSingle * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByCustomerNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByCustomerNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByCustomerNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -2071,6 +2261,33 @@ private Mono> listByInvoiceSectionNext .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceSectionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByInvoiceSectionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -2079,24 +2296,25 @@ private Mono> listByInvoiceSectionNext * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByInvoiceSectionNextSinglePageAsync(String nextLink, + private PagedResponse listByInvoiceSectionNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByInvoiceSectionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -2127,6 +2345,33 @@ private Mono> listByBillingAccountNext .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -2135,24 +2380,25 @@ private Mono> listByBillingAccountNext * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountNextSinglePageAsync(String nextLink, + private PagedResponse listByBillingAccountNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -2182,6 +2428,33 @@ private Mono> listByDepartmentNextSing .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByDepartmentNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByDepartmentNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -2190,24 +2463,24 @@ private Mono> listByDepartmentNextSing * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByDepartmentNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByDepartmentNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listByDepartmentNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listByDepartmentNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -2239,6 +2512,33 @@ private Mono> listByDepartmentNextSing .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByEnrollmentAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByEnrollmentAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -2247,23 +2547,26 @@ private Mono> listByDepartmentNextSing * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByEnrollmentAccountNextSinglePageAsync(String nextLink, + private PagedResponse listByEnrollmentAccountNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listByEnrollmentAccountNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listByEnrollmentAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(BillingRoleDefinitionsClientImpl.class); } diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingSubscriptionsAliasesClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingSubscriptionsAliasesClientImpl.java index b7c14dbdbfcb..eb6597b79405 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingSubscriptionsAliasesClientImpl.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/BillingSubscriptionsAliasesClientImpl.java @@ -26,8 +26,10 @@ 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.BinaryData; 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.BillingSubscriptionsAliasesClient; @@ -77,6 +79,14 @@ Mono> get(@HostParam("$host") String end @PathParam("billingAccountName") String billingAccountName, @PathParam("aliasName") String aliasName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptionAliases/{aliasName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @PathParam("aliasName") String aliasName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptionAliases/{aliasName}") @ExpectedResponses({ 200, 201, 202 }) @@ -87,6 +97,16 @@ Mono>> createOrUpdate(@HostParam("$host") String endpo @BodyParam("application/json") BillingSubscriptionAliasInner parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptionAliases/{aliasName}") + @ExpectedResponses({ 200, 201, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @PathParam("aliasName") String aliasName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BillingSubscriptionAliasInner parameters, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptionAliases") @ExpectedResponses({ 200 }) @@ -98,6 +118,17 @@ Mono> listByBillingAccount(@HostPar @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptionAliases") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @QueryParam("includeDeleted") Boolean includeDeleted, @QueryParam("api-version") String apiVersion, + @QueryParam("filter") String filter, @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, + @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -105,6 +136,14 @@ Mono> listByBillingAccount(@HostPar 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) + Response listByBillingAccountNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -138,37 +177,6 @@ private Mono> getWithResponseAsync(Strin .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets a subscription by its alias ID. The operation is supported for seat based billing subscriptions. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param aliasName The ID that uniquely identifies a subscription alias. - * @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 alias ID along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String billingAccountName, - String aliasName, 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 (aliasName == null) { - return Mono.error(new IllegalArgumentException("Parameter aliasName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), billingAccountName, aliasName, this.client.getApiVersion(), - accept, context); - } - /** * Gets a subscription by its alias ID. The operation is supported for seat based billing subscriptions. * @@ -198,7 +206,22 @@ private Mono getAsync(String billingAccountName, @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String billingAccountName, String aliasName, Context context) { - return getWithResponseAsync(billingAccountName, aliasName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (aliasName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter aliasName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), billingAccountName, aliasName, this.client.getApiVersion(), + accept, context); } /** @@ -261,35 +284,36 @@ private Mono>> createOrUpdateWithResponseAsync(String * @param billingAccountName The ID that uniquely identifies a billing account. * @param aliasName The ID that uniquely identifies a subscription alias. * @param parameters A billing subscription alias. - * @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 alias along with {@link Response} on successful completion of {@link Mono}. + * @return a billing subscription alias along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateWithResponseAsync(String billingAccountName, - String aliasName, BillingSubscriptionAliasInner parameters, Context context) { + private Response createOrUpdateWithResponse(String billingAccountName, String aliasName, + BillingSubscriptionAliasInner parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); } if (aliasName == null) { - return Mono.error(new IllegalArgumentException("Parameter aliasName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter aliasName is required and cannot be null.")); } if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), billingAccountName, aliasName, - this.client.getApiVersion(), parameters, accept, context); + return service.createOrUpdateSync(this.client.getEndpoint(), billingAccountName, aliasName, + this.client.getApiVersion(), parameters, accept, Context.NONE); } /** @@ -299,20 +323,37 @@ private Mono>> createOrUpdateWithResponseAsync(String * @param billingAccountName The ID that uniquely identifies a billing account. * @param aliasName The ID that uniquely identifies a subscription alias. * @param parameters A billing subscription alias. + * @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 {@link PollerFlux} for polling of a billing subscription alias. + * @return a billing subscription alias along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, BillingSubscriptionAliasInner> - beginCreateOrUpdateAsync(String billingAccountName, String aliasName, - BillingSubscriptionAliasInner parameters) { - Mono>> mono - = createOrUpdateWithResponseAsync(billingAccountName, aliasName, parameters); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingSubscriptionAliasInner.class, BillingSubscriptionAliasInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String billingAccountName, String aliasName, + BillingSubscriptionAliasInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (aliasName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter aliasName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), billingAccountName, aliasName, + this.client.getApiVersion(), parameters, accept, context); } /** @@ -322,7 +363,6 @@ private Mono>> createOrUpdateWithResponseAsync(String * @param billingAccountName The ID that uniquely identifies a billing account. * @param aliasName The ID that uniquely identifies a subscription alias. * @param parameters A billing subscription alias. - * @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. @@ -330,14 +370,13 @@ private Mono>> createOrUpdateWithResponseAsync(String */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, BillingSubscriptionAliasInner> - beginCreateOrUpdateAsync(String billingAccountName, String aliasName, BillingSubscriptionAliasInner parameters, - Context context) { - context = this.client.mergeContext(context); + beginCreateOrUpdateAsync(String billingAccountName, String aliasName, + BillingSubscriptionAliasInner parameters) { Mono>> mono - = createOrUpdateWithResponseAsync(billingAccountName, aliasName, parameters, context); + = createOrUpdateWithResponseAsync(billingAccountName, aliasName, parameters); return this.client.getLroResult(mono, this.client.getHttpPipeline(), BillingSubscriptionAliasInner.class, BillingSubscriptionAliasInner.class, - context); + this.client.getContext()); } /** @@ -355,7 +394,9 @@ private Mono>> createOrUpdateWithResponseAsync(String @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, BillingSubscriptionAliasInner> beginCreateOrUpdate(String billingAccountName, String aliasName, BillingSubscriptionAliasInner parameters) { - return this.beginCreateOrUpdateAsync(billingAccountName, aliasName, parameters).getSyncPoller(); + Response response = createOrUpdateWithResponse(billingAccountName, aliasName, parameters); + return this.client.getLroResult(response, + BillingSubscriptionAliasInner.class, BillingSubscriptionAliasInner.class, Context.NONE); } /** @@ -374,7 +415,9 @@ private Mono>> createOrUpdateWithResponseAsync(String @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, BillingSubscriptionAliasInner> beginCreateOrUpdate( String billingAccountName, String aliasName, BillingSubscriptionAliasInner parameters, Context context) { - return this.beginCreateOrUpdateAsync(billingAccountName, aliasName, parameters, context).getSyncPoller(); + Response response = createOrUpdateWithResponse(billingAccountName, aliasName, parameters, context); + return this.client.getLroResult(response, + BillingSubscriptionAliasInner.class, BillingSubscriptionAliasInner.class, context); } /** @@ -396,26 +439,6 @@ private Mono createOrUpdateAsync(String billingAc .flatMap(this.client::getLroFinalResultOrError); } - /** - * Creates or updates a billing subscription by its alias ID. The operation is supported for seat based billing - * subscriptions. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param aliasName The ID that uniquely identifies a subscription alias. - * @param parameters A billing subscription alias. - * @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 alias on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String billingAccountName, String aliasName, - BillingSubscriptionAliasInner parameters, Context context) { - return beginCreateOrUpdateAsync(billingAccountName, aliasName, parameters, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Creates or updates a billing subscription by its alias ID. The operation is supported for seat based billing * subscriptions. @@ -431,7 +454,7 @@ private Mono createOrUpdateAsync(String billingAc @ServiceMethod(returns = ReturnType.SINGLE) public BillingSubscriptionAliasInner createOrUpdate(String billingAccountName, String aliasName, BillingSubscriptionAliasInner parameters) { - return createOrUpdateAsync(billingAccountName, aliasName, parameters).block(); + return beginCreateOrUpdate(billingAccountName, aliasName, parameters).getFinalResult(); } /** @@ -450,7 +473,7 @@ public BillingSubscriptionAliasInner createOrUpdate(String billingAccountName, S @ServiceMethod(returns = ReturnType.SINGLE) public BillingSubscriptionAliasInner createOrUpdate(String billingAccountName, String aliasName, BillingSubscriptionAliasInner parameters, Context context) { - return createOrUpdateAsync(billingAccountName, aliasName, parameters, context).block(); + return beginCreateOrUpdate(billingAccountName, aliasName, parameters, context).getFinalResult(); } /** @@ -498,51 +521,6 @@ private Mono> listByBillingAccountS .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Lists the subscription aliases for a billing account. The operation is supported for seat based billing - * subscriptions. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param includeDeleted Can be used to get deleted billing subscriptions. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountSinglePageAsync( - String billingAccountName, Boolean includeDeleted, String filter, String orderBy, Long top, Long skip, - Boolean count, String search, 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingAccount(this.client.getEndpoint(), billingAccountName, includeDeleted, - this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - /** * Lists the subscription aliases for a billing account. The operation is supported for seat based billing * subscriptions. @@ -595,6 +573,48 @@ private PagedFlux listByBillingAccountAsync(Strin orderBy, top, skip, count, search), nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); } + /** + * Lists the subscription aliases for a billing account. The operation is supported for seat based billing + * subscriptions. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param includeDeleted Can be used to get deleted billing subscriptions. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, + Boolean includeDeleted, String filter, String orderBy, Long top, Long skip, Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountSync(this.client.getEndpoint(), billingAccountName, includeDeleted, + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Lists the subscription aliases for a billing account. The operation is supported for seat based billing * subscriptions. @@ -616,15 +636,27 @@ private PagedFlux listByBillingAccountAsync(Strin * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, Boolean includeDeleted, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>(() -> listByBillingAccountSinglePageAsync(billingAccountName, includeDeleted, filter, - orderBy, top, skip, count, search, context), - nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountSync(this.client.getEndpoint(), billingAccountName, includeDeleted, + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -646,8 +678,8 @@ public PagedIterable listByBillingAccount(String final Long skip = null; final Boolean count = null; final String search = null; - return new PagedIterable<>( - listByBillingAccountAsync(billingAccountName, includeDeleted, filter, orderBy, top, skip, count, search)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, includeDeleted, filter, + orderBy, top, skip, count, search), nextLink -> listByBillingAccountNextSinglePage(nextLink)); } /** @@ -677,8 +709,9 @@ public PagedIterable listByBillingAccount(String public PagedIterable listByBillingAccount(String billingAccountName, Boolean includeDeleted, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, includeDeleted, filter, orderBy, top, - skip, count, search, context)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, includeDeleted, filter, + orderBy, top, skip, count, search, context), + nextLink -> listByBillingAccountNextSinglePage(nextLink, context)); } /** @@ -710,6 +743,33 @@ public PagedIterable listByBillingAccount(String .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -718,23 +778,26 @@ public PagedIterable listByBillingAccount(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountNextSinglePageAsync(String nextLink, + private PagedResponse listByBillingAccountNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(BillingSubscriptionsAliasesClientImpl.class); } 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 index 5fc26559fb01..96edf25ce12c 100644 --- 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 @@ -28,8 +28,10 @@ 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.BinaryData; 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; @@ -88,6 +90,17 @@ Mono> getByBillingProfile(@HostParam("$host") @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}/billingProfiles/{billingProfileName}/billingSubscriptions/{billingSubscriptionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByBillingProfileSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("billingSubscriptionName") String billingSubscriptionName, + @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}/billingProfiles/{billingProfileName}/billingSubscriptions") @ExpectedResponses({ 200 }) @@ -101,6 +114,19 @@ Mono> listByBillingProfile(@HostParam("$ @QueryParam("count") Boolean count, @QueryParam("search") String search, @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) + Response listByBillingProfileSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @QueryParam("includeDeleted") Boolean includeDeleted, @QueryParam("api-version") String apiVersion, + @QueryParam("expand") String expand, @QueryParam("filter") String filter, + @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, @QueryParam("skip") Long skip, + @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/billingSubscriptions") @ExpectedResponses({ 200 }) @@ -114,6 +140,19 @@ Mono> listByCustomer(@HostParam("$host") @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/billingSubscriptions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByCustomerSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @PathParam("customerName") String customerName, + @QueryParam("includeDeleted") Boolean includeDeleted, @QueryParam("api-version") String apiVersion, + @QueryParam("expand") String expand, @QueryParam("filter") String filter, + @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, @QueryParam("skip") Long skip, + @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/billingSubscriptions") @ExpectedResponses({ 200 }) @@ -128,6 +167,20 @@ Mono> listByInvoiceSection(@HostParam("$ @QueryParam("count") Boolean count, @QueryParam("search") String search, @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) + Response listByInvoiceSectionSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("invoiceSectionName") String invoiceSectionName, + @QueryParam("includeDeleted") Boolean includeDeleted, @QueryParam("api-version") String apiVersion, + @QueryParam("expand") String expand, @QueryParam("filter") String filter, + @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, @QueryParam("skip") Long skip, + @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}/cancel") @ExpectedResponses({ 202 }) @@ -139,6 +192,17 @@ Mono>> cancel(@HostParam("$host") String endpoint, @BodyParam("application/json") CancelSubscriptionRequest parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}/cancel") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response cancelSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingSubscriptionName") String billingSubscriptionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CancelSubscriptionRequest parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}/merge") @ExpectedResponses({ 200, 202 }) @@ -150,6 +214,17 @@ Mono>> merge(@HostParam("$host") String endpoint, @BodyParam("application/json") BillingSubscriptionMergeRequest parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}/merge") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response mergeSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingSubscriptionName") String billingSubscriptionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BillingSubscriptionMergeRequest parameters, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}/move") @ExpectedResponses({ 200, 202 }) @@ -161,6 +236,17 @@ Mono>> move(@HostParam("$host") String endpoint, @BodyParam("application/json") MoveBillingSubscriptionRequest parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}/move") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response moveSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingSubscriptionName") String billingSubscriptionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") MoveBillingSubscriptionRequest parameters, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}/split") @ExpectedResponses({ 200, 202 }) @@ -172,6 +258,17 @@ Mono>> split(@HostParam("$host") String endpoint, @BodyParam("application/json") BillingSubscriptionSplitRequest parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}/split") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response splitSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingSubscriptionName") String billingSubscriptionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BillingSubscriptionSplitRequest parameters, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}/validateMoveEligibility") @ExpectedResponses({ 200 }) @@ -183,6 +280,17 @@ Mono> validateMoveEligib @BodyParam("application/json") MoveBillingSubscriptionRequest parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}/validateMoveEligibility") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response validateMoveEligibilitySync( + @HostParam("$host") String endpoint, @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingSubscriptionName") String billingSubscriptionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") MoveBillingSubscriptionRequest parameters, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Delete("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}") @ExpectedResponses({ 202, 204 }) @@ -192,6 +300,15 @@ Mono>> delete(@HostParam("$host") String endpoint, @PathParam("billingSubscriptionName") String billingSubscriptionName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingSubscriptionName") String billingSubscriptionName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}") @ExpectedResponses({ 200 }) @@ -202,6 +319,16 @@ Mono> get(@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}/billingSubscriptions/{billingSubscriptionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingSubscriptionName") String billingSubscriptionName, + @QueryParam("api-version") String apiVersion, @QueryParam("expand") String expand, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Patch("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}") @ExpectedResponses({ 200, 202 }) @@ -213,6 +340,17 @@ Mono>> update(@HostParam("$host") String endpoint, @BodyParam("application/json") BillingSubscriptionPatch parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Patch("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions/{billingSubscriptionName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingSubscriptionName") String billingSubscriptionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BillingSubscriptionPatch parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions") @ExpectedResponses({ 200 }) @@ -227,6 +365,20 @@ Mono> listByBillingAccount(@HostParam("$ @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @QueryParam("includeDeleted") Boolean includeDeleted, + @QueryParam("includeTenantSubscriptions") Boolean includeTenantSubscriptions, + @QueryParam("includeFailed") Boolean includeFailed, @QueryParam("api-version") String apiVersion, + @QueryParam("expand") String expand, @QueryParam("filter") String filter, + @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, @QueryParam("skip") Long skip, + @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingSubscriptions") @ExpectedResponses({ 200 }) @@ -239,6 +391,18 @@ Mono> listByCustomerAtBillingAccount( @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/billingSubscriptions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByCustomerAtBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @PathParam("customerName") String customerName, + @QueryParam("includeDeleted") Boolean includeDeleted, @QueryParam("api-version") String apiVersion, + @QueryParam("expand") String expand, @QueryParam("filter") String filter, + @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, @QueryParam("skip") Long skip, + @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingSubscriptions") @ExpectedResponses({ 200 }) @@ -251,6 +415,18 @@ Mono> listByEnrollmentAccount(@HostParam @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}/billingSubscriptions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByEnrollmentAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("enrollmentAccountName") String enrollmentAccountName, + @QueryParam("api-version") String apiVersion, @QueryParam("filter") String filter, + @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, @QueryParam("skip") Long skip, + @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -259,6 +435,14 @@ 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) + Response listByBillingProfileNextSync( + @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 }) @@ -267,6 +451,14 @@ 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) + Response listByCustomerNextSync( + @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 }) @@ -275,6 +467,14 @@ 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) + Response listByInvoiceSectionNextSync( + @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 }) @@ -283,6 +483,14 @@ 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) + Response listByBillingAccountNextSync( + @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 }) @@ -291,6 +499,14 @@ Mono> listByCustomerAtBillingAccountNext @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) + Response listByCustomerAtBillingAccountNextSync( + @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 }) @@ -298,6 +514,14 @@ Mono> listByCustomerAtBillingAccountNext Mono> listByEnrollmentAccountNext( @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) + Response listByEnrollmentAccountNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -341,47 +565,6 @@ private Mono> getByBillingProfileWithResponse .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets a subscription by its billing profile and ID. The operation is supported for billing accounts with agreement - * type Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param billingSubscriptionName The ID that uniquely identifies a subscription. - * @param expand Can be used to expand `Reseller`, `ConsumptionCostCenter`, `LastMonthCharges` and - * `MonthToDateCharges`. - * @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 billing profile and ID along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByBillingProfileWithResponseAsync(String billingAccountName, - String billingProfileName, String billingSubscriptionName, 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.")); - } - if (billingSubscriptionName == null) { - return Mono.error( - new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByBillingProfile(this.client.getEndpoint(), billingAccountName, billingProfileName, - billingSubscriptionName, this.client.getApiVersion(), expand, accept, context); - } - /** * Gets a subscription by its billing profile and ID. The operation is supported for billing accounts with agreement * type Enterprise Agreement. @@ -420,8 +603,26 @@ private Mono getByBillingProfileAsync(String billingAc @ServiceMethod(returns = ReturnType.SINGLE) public Response getByBillingProfileWithResponse(String billingAccountName, String billingProfileName, String billingSubscriptionName, String expand, Context context) { - return getByBillingProfileWithResponseAsync(billingAccountName, billingProfileName, billingSubscriptionName, - expand, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (billingSubscriptionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByBillingProfileSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + billingSubscriptionName, this.client.getApiVersion(), expand, accept, context); } /** @@ -496,58 +697,6 @@ private Mono> listByBillingProfileSingle .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 includeDeleted Can be used to get deleted billing subscriptions. - * @param expand Can be used to expand `Reseller`, `ConsumptionCostCenter`, `LastMonthCharges` and - * `MonthToDateCharges`. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingProfileSinglePageAsync(String billingAccountName, - String billingProfileName, Boolean includeDeleted, String expand, String filter, String orderBy, Long top, - Long skip, Boolean count, String search, 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingProfile(this.client.getEndpoint(), billingAccountName, billingProfileName, includeDeleted, - this.client.getApiVersion(), expand, filter, orderBy, top, skip, count, search, 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. @@ -611,6 +760,56 @@ private PagedFlux listByBillingProfileAsync(String bil 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 includeDeleted Can be used to get deleted billing subscriptions. + * @param expand Can be used to expand `Reseller`, `ConsumptionCostCenter`, `LastMonthCharges` and + * `MonthToDateCharges`. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, + String billingProfileName, Boolean includeDeleted, String expand, String filter, String orderBy, Long top, + Long skip, Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingProfileSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, includeDeleted, this.client.getApiVersion(), expand, filter, + orderBy, top, skip, count, search, accept, Context.NONE); + return 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. @@ -635,16 +834,31 @@ private PagedFlux listByBillingProfileAsync(String bil * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingProfileAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, String billingProfileName, Boolean includeDeleted, String expand, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>( - () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, includeDeleted, expand, - filter, orderBy, top, skip, count, search, context), - nextLink -> listByBillingProfileNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingProfileSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, includeDeleted, this.client.getApiVersion(), expand, filter, + orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -669,8 +883,9 @@ public PagedIterable listByBillingProfile(String billi final Long skip = null; final Boolean count = null; final String search = null; - return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, includeDeleted, - expand, filter, orderBy, top, skip, count, search)); + return new PagedIterable<>(() -> listByBillingProfileSinglePage(billingAccountName, billingProfileName, + includeDeleted, expand, filter, orderBy, top, skip, count, search), + nextLink -> listByBillingProfileNextSinglePage(nextLink)); } /** @@ -703,8 +918,10 @@ public PagedIterable listByBillingProfile(String billi public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName, Boolean includeDeleted, String expand, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, includeDeleted, - expand, filter, orderBy, top, skip, count, search, context)); + return new PagedIterable<>( + () -> listByBillingProfileSinglePage(billingAccountName, billingProfileName, includeDeleted, expand, filter, + orderBy, top, skip, count, search, context), + nextLink -> listByBillingProfileNextSinglePage(nextLink, context)); } /** @@ -760,64 +977,7 @@ private Mono> listByCustomerSinglePageAs top, skip, count, search, 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 billingProfileName The ID that uniquely identifies a billing profile. - * @param customerName The ID that uniquely identifies a customer. - * @param includeDeleted Can be used to get deleted billing subscriptions. - * @param expand Can be used to expand `Reseller`, `ConsumptionCostCenter`, `LastMonthCharges` and - * `MonthToDateCharges`. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByCustomerSinglePageAsync(String billingAccountName, - String billingProfileName, String customerName, Boolean includeDeleted, String expand, String filter, - String orderBy, Long top, Long skip, Boolean count, String search, 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 (customerName == null) { - return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByCustomer(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName, - includeDeleted, this.client.getApiVersion(), expand, filter, orderBy, top, skip, count, search, 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())); } /** @@ -885,6 +1045,61 @@ private PagedFlux listByCustomerAsync(String billingAc 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 billingProfileName The ID that uniquely identifies a billing profile. + * @param customerName The ID that uniquely identifies a customer. + * @param includeDeleted Can be used to get deleted billing subscriptions. + * @param expand Can be used to expand `Reseller`, `ConsumptionCostCenter`, `LastMonthCharges` and + * `MonthToDateCharges`. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerSinglePage(String billingAccountName, + String billingProfileName, String customerName, Boolean includeDeleted, String expand, String filter, + String orderBy, Long top, Long skip, Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByCustomerSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, customerName, includeDeleted, this.client.getApiVersion(), expand, + filter, orderBy, top, skip, count, search, accept, Context.NONE); + return 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. @@ -910,16 +1125,35 @@ private PagedFlux listByCustomerAsync(String billingAc * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByCustomerAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerSinglePage(String billingAccountName, String billingProfileName, String customerName, Boolean includeDeleted, String expand, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>( - () -> listByCustomerSinglePageAsync(billingAccountName, billingProfileName, customerName, includeDeleted, - expand, filter, orderBy, top, skip, count, search, context), - nextLink -> listByCustomerNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByCustomerSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, customerName, includeDeleted, this.client.getApiVersion(), expand, + filter, orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -945,8 +1179,9 @@ public PagedIterable listByCustomer(String billingAcco final Long skip = null; final Boolean count = null; final String search = null; - return new PagedIterable<>(listByCustomerAsync(billingAccountName, billingProfileName, customerName, - includeDeleted, expand, filter, orderBy, top, skip, count, search)); + return new PagedIterable<>(() -> listByCustomerSinglePage(billingAccountName, billingProfileName, customerName, + includeDeleted, expand, filter, orderBy, top, skip, count, search), + nextLink -> listByCustomerNextSinglePage(nextLink)); } /** @@ -980,8 +1215,10 @@ public PagedIterable listByCustomer(String billingAcco public PagedIterable listByCustomer(String billingAccountName, String billingProfileName, String customerName, Boolean includeDeleted, String expand, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByCustomerAsync(billingAccountName, billingProfileName, customerName, - includeDeleted, expand, filter, orderBy, top, skip, count, search, context)); + return new PagedIterable<>( + () -> listByCustomerSinglePage(billingAccountName, billingProfileName, customerName, includeDeleted, expand, + filter, orderBy, top, skip, count, search, context), + nextLink -> listByCustomerNextSinglePage(nextLink, context)); } /** @@ -1041,64 +1278,6 @@ private Mono> listByInvoiceSectionSingle .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 includeDeleted Can be used to get deleted billing subscriptions. - * @param expand Can be used to expand `Reseller`, `ConsumptionCostCenter`, `LastMonthCharges` and - * `MonthToDateCharges`. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByInvoiceSectionSinglePageAsync(String billingAccountName, - String billingProfileName, String invoiceSectionName, Boolean includeDeleted, String expand, String filter, - String orderBy, Long top, Long skip, Boolean count, String search, 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByInvoiceSection(this.client.getEndpoint(), billingAccountName, billingProfileName, invoiceSectionName, - includeDeleted, this.client.getApiVersion(), expand, filter, orderBy, top, skip, count, search, 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. @@ -1164,6 +1343,61 @@ private PagedFlux listByInvoiceSectionAsync(String bil 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 includeDeleted Can be used to get deleted billing subscriptions. + * @param expand Can be used to expand `Reseller`, `ConsumptionCostCenter`, `LastMonthCharges` and + * `MonthToDateCharges`. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceSectionSinglePage(String billingAccountName, + String billingProfileName, String invoiceSectionName, Boolean includeDeleted, String expand, String filter, + String orderBy, Long top, Long skip, Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByInvoiceSectionSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, invoiceSectionName, includeDeleted, this.client.getApiVersion(), + expand, filter, orderBy, top, skip, count, search, accept, Context.NONE); + return 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. @@ -1189,16 +1423,35 @@ private PagedFlux listByInvoiceSectionAsync(String bil * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByInvoiceSectionAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceSectionSinglePage(String billingAccountName, String billingProfileName, String invoiceSectionName, Boolean includeDeleted, String expand, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>( - () -> listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName, - includeDeleted, expand, filter, orderBy, top, skip, count, search, context), - nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByInvoiceSectionSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, invoiceSectionName, includeDeleted, this.client.getApiVersion(), + expand, filter, orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1224,8 +1477,10 @@ public PagedIterable listByInvoiceSection(String billi final Long skip = null; final Boolean count = null; final String search = null; - return new PagedIterable<>(listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, - includeDeleted, expand, filter, orderBy, top, skip, count, search)); + return new PagedIterable<>( + () -> listByInvoiceSectionSinglePage(billingAccountName, billingProfileName, invoiceSectionName, + includeDeleted, expand, filter, orderBy, top, skip, count, search), + nextLink -> listByInvoiceSectionNextSinglePage(nextLink)); } /** @@ -1259,8 +1514,10 @@ public PagedIterable listByInvoiceSection(String billi public PagedIterable listByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, Boolean includeDeleted, String expand, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, - includeDeleted, expand, filter, orderBy, top, skip, count, search, context)); + return new PagedIterable<>( + () -> listByInvoiceSectionSinglePage(billingAccountName, billingProfileName, invoiceSectionName, + includeDeleted, expand, filter, orderBy, top, skip, count, search, context), + nextLink -> listByInvoiceSectionNextSinglePage(nextLink, context)); } /** @@ -1309,36 +1566,36 @@ private Mono>> cancelWithResponseAsync(String billingA * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingSubscriptionName The ID that uniquely identifies a subscription. * @param parameters Request parameters for cancel customer subscription. - * @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 {@link Response} on successful completion of {@link Mono}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> cancelWithResponseAsync(String billingAccountName, - String billingSubscriptionName, CancelSubscriptionRequest parameters, Context context) { + private Response cancelWithResponse(String billingAccountName, String billingSubscriptionName, + CancelSubscriptionRequest parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); } if (billingSubscriptionName == null) { - return Mono.error( - new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null.")); } if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.cancel(this.client.getEndpoint(), billingAccountName, billingSubscriptionName, - this.client.getApiVersion(), parameters, accept, context); + return service.cancelSync(this.client.getEndpoint(), billingAccountName, billingSubscriptionName, + this.client.getApiVersion(), parameters, accept, Context.NONE); } /** @@ -1348,18 +1605,37 @@ private Mono>> cancelWithResponseAsync(String billingA * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingSubscriptionName The ID that uniquely identifies a subscription. * @param parameters Request parameters for cancel customer subscription. + * @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 {@link PollerFlux} for polling of long-running operation. + * @return the response body along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginCancelAsync(String billingAccountName, - String billingSubscriptionName, CancelSubscriptionRequest parameters) { - Mono>> mono - = cancelWithResponseAsync(billingAccountName, billingSubscriptionName, parameters); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response cancelWithResponse(String billingAccountName, String billingSubscriptionName, + CancelSubscriptionRequest parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingSubscriptionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.cancelSync(this.client.getEndpoint(), billingAccountName, billingSubscriptionName, + this.client.getApiVersion(), parameters, accept, context); } /** @@ -1369,7 +1645,6 @@ private PollerFlux, Void> beginCancelAsync(String billingAccoun * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingSubscriptionName The ID that uniquely identifies a subscription. * @param parameters Request parameters for cancel customer subscription. - * @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. @@ -1377,12 +1652,11 @@ private PollerFlux, Void> beginCancelAsync(String billingAccoun */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginCancelAsync(String billingAccountName, - String billingSubscriptionName, CancelSubscriptionRequest parameters, Context context) { - context = this.client.mergeContext(context); + String billingSubscriptionName, CancelSubscriptionRequest parameters) { Mono>> mono - = cancelWithResponseAsync(billingAccountName, billingSubscriptionName, parameters, context); + = cancelWithResponseAsync(billingAccountName, billingSubscriptionName, parameters); return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + this.client.getContext()); } /** @@ -1400,7 +1674,8 @@ private PollerFlux, Void> beginCancelAsync(String billingAccoun @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginCancel(String billingAccountName, String billingSubscriptionName, CancelSubscriptionRequest parameters) { - return this.beginCancelAsync(billingAccountName, billingSubscriptionName, parameters).getSyncPoller(); + Response response = cancelWithResponse(billingAccountName, billingSubscriptionName, parameters); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -1419,7 +1694,9 @@ public SyncPoller, Void> beginCancel(String billingAccountName, @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginCancel(String billingAccountName, String billingSubscriptionName, CancelSubscriptionRequest parameters, Context context) { - return this.beginCancelAsync(billingAccountName, billingSubscriptionName, parameters, context).getSyncPoller(); + Response response + = cancelWithResponse(billingAccountName, billingSubscriptionName, parameters, context); + return this.client.getLroResult(response, Void.class, Void.class, context); } /** @@ -1441,26 +1718,6 @@ private Mono cancelAsync(String billingAccountName, String billingSubscrip .flatMap(this.client::getLroFinalResultOrError); } - /** - * Cancels a usage-based subscription. This operation is supported only for billing accounts of type Microsoft - * Partner Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingSubscriptionName The ID that uniquely identifies a subscription. - * @param parameters Request parameters for cancel customer subscription. - * @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 {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono cancelAsync(String billingAccountName, String billingSubscriptionName, - CancelSubscriptionRequest parameters, Context context) { - return beginCancelAsync(billingAccountName, billingSubscriptionName, parameters, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Cancels a usage-based subscription. This operation is supported only for billing accounts of type Microsoft * Partner Agreement. @@ -1475,7 +1732,7 @@ private Mono cancelAsync(String billingAccountName, String billingSubscrip @ServiceMethod(returns = ReturnType.SINGLE) public void cancel(String billingAccountName, String billingSubscriptionName, CancelSubscriptionRequest parameters) { - cancelAsync(billingAccountName, billingSubscriptionName, parameters).block(); + beginCancel(billingAccountName, billingSubscriptionName, parameters).getFinalResult(); } /** @@ -1493,7 +1750,7 @@ public void cancel(String billingAccountName, String billingSubscriptionName, @ServiceMethod(returns = ReturnType.SINGLE) public void cancel(String billingAccountName, String billingSubscriptionName, CancelSubscriptionRequest parameters, Context context) { - cancelAsync(billingAccountName, billingSubscriptionName, parameters, context).block(); + beginCancel(billingAccountName, billingSubscriptionName, parameters, context).getFinalResult(); } /** @@ -1541,37 +1798,36 @@ private Mono>> mergeWithResponseAsync(String billingAc * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingSubscriptionName The ID that uniquely identifies a subscription. * @param parameters Request parameters that are provided to merge the two billing subscriptions. - * @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 of a subscription along with {@link Response} on successful completion of - * {@link Mono}. + * @return the billing properties of a subscription along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> mergeWithResponseAsync(String billingAccountName, - String billingSubscriptionName, BillingSubscriptionMergeRequest parameters, Context context) { + private Response mergeWithResponse(String billingAccountName, String billingSubscriptionName, + BillingSubscriptionMergeRequest parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); } if (billingSubscriptionName == null) { - return Mono.error( - new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null.")); } if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.merge(this.client.getEndpoint(), billingAccountName, billingSubscriptionName, - this.client.getApiVersion(), parameters, accept, context); + return service.mergeSync(this.client.getEndpoint(), billingAccountName, billingSubscriptionName, + this.client.getApiVersion(), parameters, accept, Context.NONE); } /** @@ -1580,19 +1836,37 @@ private Mono>> mergeWithResponseAsync(String billingAc * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingSubscriptionName The ID that uniquely identifies a subscription. * @param parameters Request parameters that are provided to merge the two billing subscriptions. + * @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 {@link PollerFlux} for polling of the billing properties of a subscription. + * @return the billing properties of a subscription along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, BillingSubscriptionInner> beginMergeAsync( - String billingAccountName, String billingSubscriptionName, BillingSubscriptionMergeRequest parameters) { - Mono>> mono - = mergeWithResponseAsync(billingAccountName, billingSubscriptionName, parameters); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingSubscriptionInner.class, BillingSubscriptionInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response mergeWithResponse(String billingAccountName, String billingSubscriptionName, + BillingSubscriptionMergeRequest parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingSubscriptionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.mergeSync(this.client.getEndpoint(), billingAccountName, billingSubscriptionName, + this.client.getApiVersion(), parameters, accept, context); } /** @@ -1601,7 +1875,6 @@ private PollerFlux, BillingSubscriptionInne * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingSubscriptionName The ID that uniquely identifies a subscription. * @param parameters Request parameters that are provided to merge the two billing subscriptions. - * @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. @@ -1609,13 +1882,12 @@ private PollerFlux, BillingSubscriptionInne */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, BillingSubscriptionInner> beginMergeAsync( - String billingAccountName, String billingSubscriptionName, BillingSubscriptionMergeRequest parameters, - Context context) { - context = this.client.mergeContext(context); + String billingAccountName, String billingSubscriptionName, BillingSubscriptionMergeRequest parameters) { Mono>> mono - = mergeWithResponseAsync(billingAccountName, billingSubscriptionName, parameters, context); + = mergeWithResponseAsync(billingAccountName, billingSubscriptionName, parameters); return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingSubscriptionInner.class, BillingSubscriptionInner.class, context); + this.client.getHttpPipeline(), BillingSubscriptionInner.class, BillingSubscriptionInner.class, + this.client.getContext()); } /** @@ -1632,7 +1904,9 @@ private PollerFlux, BillingSubscriptionInne @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, BillingSubscriptionInner> beginMerge( String billingAccountName, String billingSubscriptionName, BillingSubscriptionMergeRequest parameters) { - return this.beginMergeAsync(billingAccountName, billingSubscriptionName, parameters).getSyncPoller(); + Response response = mergeWithResponse(billingAccountName, billingSubscriptionName, parameters); + return this.client.getLroResult(response, + BillingSubscriptionInner.class, BillingSubscriptionInner.class, Context.NONE); } /** @@ -1651,7 +1925,10 @@ public SyncPoller, BillingSubscriptionInner public SyncPoller, BillingSubscriptionInner> beginMerge( String billingAccountName, String billingSubscriptionName, BillingSubscriptionMergeRequest parameters, Context context) { - return this.beginMergeAsync(billingAccountName, billingSubscriptionName, parameters, context).getSyncPoller(); + Response response + = mergeWithResponse(billingAccountName, billingSubscriptionName, parameters, context); + return this.client.getLroResult(response, + BillingSubscriptionInner.class, BillingSubscriptionInner.class, context); } /** @@ -1672,25 +1949,6 @@ private Mono mergeAsync(String billingAccountName, Str .flatMap(this.client::getLroFinalResultOrError); } - /** - * Merges the billing subscription provided in the request with a target billing subscription. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingSubscriptionName The ID that uniquely identifies a subscription. - * @param parameters Request parameters that are provided to merge the two billing subscriptions. - * @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 of a subscription on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono mergeAsync(String billingAccountName, String billingSubscriptionName, - BillingSubscriptionMergeRequest parameters, Context context) { - return beginMergeAsync(billingAccountName, billingSubscriptionName, parameters, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Merges the billing subscription provided in the request with a target billing subscription. * @@ -1705,7 +1963,7 @@ private Mono mergeAsync(String billingAccountName, Str @ServiceMethod(returns = ReturnType.SINGLE) public BillingSubscriptionInner merge(String billingAccountName, String billingSubscriptionName, BillingSubscriptionMergeRequest parameters) { - return mergeAsync(billingAccountName, billingSubscriptionName, parameters).block(); + return beginMerge(billingAccountName, billingSubscriptionName, parameters).getFinalResult(); } /** @@ -1723,7 +1981,7 @@ public BillingSubscriptionInner merge(String billingAccountName, String billingS @ServiceMethod(returns = ReturnType.SINGLE) public BillingSubscriptionInner merge(String billingAccountName, String billingSubscriptionName, BillingSubscriptionMergeRequest parameters, Context context) { - return mergeAsync(billingAccountName, billingSubscriptionName, parameters, context).block(); + return beginMerge(billingAccountName, billingSubscriptionName, parameters, context).getFinalResult(); } /** @@ -1775,37 +2033,36 @@ private Mono>> moveWithResponseAsync(String billingAcc * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingSubscriptionName The ID that uniquely identifies a subscription. * @param parameters Request parameters to transfer billing subscription. - * @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 of a subscription along with {@link Response} on successful completion of - * {@link Mono}. + * @return the billing properties of a subscription along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> moveWithResponseAsync(String billingAccountName, - String billingSubscriptionName, MoveBillingSubscriptionRequest parameters, Context context) { + private Response moveWithResponse(String billingAccountName, String billingSubscriptionName, + MoveBillingSubscriptionRequest parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); } if (billingSubscriptionName == null) { - return Mono.error( - new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null.")); } if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.move(this.client.getEndpoint(), billingAccountName, billingSubscriptionName, - this.client.getApiVersion(), parameters, accept, context); + return service.moveSync(this.client.getEndpoint(), billingAccountName, billingSubscriptionName, + this.client.getApiVersion(), parameters, accept, Context.NONE); } /** @@ -1816,19 +2073,37 @@ private Mono>> moveWithResponseAsync(String billingAcc * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingSubscriptionName The ID that uniquely identifies a subscription. * @param parameters Request parameters to transfer billing subscription. + * @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 {@link PollerFlux} for polling of the billing properties of a subscription. + * @return the billing properties of a subscription along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, BillingSubscriptionInner> beginMoveAsync( - String billingAccountName, String billingSubscriptionName, MoveBillingSubscriptionRequest parameters) { - Mono>> mono - = moveWithResponseAsync(billingAccountName, billingSubscriptionName, parameters); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingSubscriptionInner.class, BillingSubscriptionInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response moveWithResponse(String billingAccountName, String billingSubscriptionName, + MoveBillingSubscriptionRequest parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingSubscriptionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.moveSync(this.client.getEndpoint(), billingAccountName, billingSubscriptionName, + this.client.getApiVersion(), parameters, accept, context); } /** @@ -1839,7 +2114,6 @@ private PollerFlux, BillingSubscriptionInne * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingSubscriptionName The ID that uniquely identifies a subscription. * @param parameters Request parameters to transfer billing subscription. - * @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. @@ -1847,13 +2121,12 @@ private PollerFlux, BillingSubscriptionInne */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, BillingSubscriptionInner> beginMoveAsync( - String billingAccountName, String billingSubscriptionName, MoveBillingSubscriptionRequest parameters, - Context context) { - context = this.client.mergeContext(context); + String billingAccountName, String billingSubscriptionName, MoveBillingSubscriptionRequest parameters) { Mono>> mono - = moveWithResponseAsync(billingAccountName, billingSubscriptionName, parameters, context); + = moveWithResponseAsync(billingAccountName, billingSubscriptionName, parameters); return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingSubscriptionInner.class, BillingSubscriptionInner.class, context); + this.client.getHttpPipeline(), BillingSubscriptionInner.class, BillingSubscriptionInner.class, + this.client.getContext()); } /** @@ -1872,7 +2145,9 @@ private PollerFlux, BillingSubscriptionInne @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, BillingSubscriptionInner> beginMove( String billingAccountName, String billingSubscriptionName, MoveBillingSubscriptionRequest parameters) { - return this.beginMoveAsync(billingAccountName, billingSubscriptionName, parameters).getSyncPoller(); + Response response = moveWithResponse(billingAccountName, billingSubscriptionName, parameters); + return this.client.getLroResult(response, + BillingSubscriptionInner.class, BillingSubscriptionInner.class, Context.NONE); } /** @@ -1893,7 +2168,10 @@ public SyncPoller, BillingSubscriptionInner public SyncPoller, BillingSubscriptionInner> beginMove( String billingAccountName, String billingSubscriptionName, MoveBillingSubscriptionRequest parameters, Context context) { - return this.beginMoveAsync(billingAccountName, billingSubscriptionName, parameters, context).getSyncPoller(); + Response response + = moveWithResponse(billingAccountName, billingSubscriptionName, parameters, context); + return this.client.getLroResult(response, + BillingSubscriptionInner.class, BillingSubscriptionInner.class, context); } /** @@ -1916,27 +2194,6 @@ private Mono moveAsync(String billingAccountName, Stri .flatMap(this.client::getLroFinalResultOrError); } - /** - * Moves charges for a subscription 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 billingSubscriptionName The ID that uniquely identifies a subscription. - * @param parameters Request parameters to transfer billing subscription. - * @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 of a subscription on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono moveAsync(String billingAccountName, String billingSubscriptionName, - MoveBillingSubscriptionRequest parameters, Context context) { - return beginMoveAsync(billingAccountName, billingSubscriptionName, parameters, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Moves charges for a subscription 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 @@ -1953,7 +2210,7 @@ private Mono moveAsync(String billingAccountName, Stri @ServiceMethod(returns = ReturnType.SINGLE) public BillingSubscriptionInner move(String billingAccountName, String billingSubscriptionName, MoveBillingSubscriptionRequest parameters) { - return moveAsync(billingAccountName, billingSubscriptionName, parameters).block(); + return beginMove(billingAccountName, billingSubscriptionName, parameters).getFinalResult(); } /** @@ -1973,7 +2230,7 @@ public BillingSubscriptionInner move(String billingAccountName, String billingSu @ServiceMethod(returns = ReturnType.SINGLE) public BillingSubscriptionInner move(String billingAccountName, String billingSubscriptionName, MoveBillingSubscriptionRequest parameters, Context context) { - return moveAsync(billingAccountName, billingSubscriptionName, parameters, context).block(); + return beginMove(billingAccountName, billingSubscriptionName, parameters, context).getFinalResult(); } /** @@ -2023,37 +2280,36 @@ private Mono>> splitWithResponseAsync(String billingAc * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingSubscriptionName The ID that uniquely identifies a subscription. * @param parameters Request parameters that are provided to split the billing subscription. - * @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 of a subscription along with {@link Response} on successful completion of - * {@link Mono}. + * @return the billing properties of a subscription along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> splitWithResponseAsync(String billingAccountName, - String billingSubscriptionName, BillingSubscriptionSplitRequest parameters, Context context) { + private Response splitWithResponse(String billingAccountName, String billingSubscriptionName, + BillingSubscriptionSplitRequest parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); } if (billingSubscriptionName == null) { - return Mono.error( - new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null.")); } if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.split(this.client.getEndpoint(), billingAccountName, billingSubscriptionName, - this.client.getApiVersion(), parameters, accept, context); + return service.splitSync(this.client.getEndpoint(), billingAccountName, billingSubscriptionName, + this.client.getApiVersion(), parameters, accept, Context.NONE); } /** @@ -2063,19 +2319,37 @@ private Mono>> splitWithResponseAsync(String billingAc * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingSubscriptionName The ID that uniquely identifies a subscription. * @param parameters Request parameters that are provided to split the billing subscription. + * @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 {@link PollerFlux} for polling of the billing properties of a subscription. + * @return the billing properties of a subscription along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, BillingSubscriptionInner> beginSplitAsync( - String billingAccountName, String billingSubscriptionName, BillingSubscriptionSplitRequest parameters) { - Mono>> mono - = splitWithResponseAsync(billingAccountName, billingSubscriptionName, parameters); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingSubscriptionInner.class, BillingSubscriptionInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response splitWithResponse(String billingAccountName, String billingSubscriptionName, + BillingSubscriptionSplitRequest parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingSubscriptionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.splitSync(this.client.getEndpoint(), billingAccountName, billingSubscriptionName, + this.client.getApiVersion(), parameters, accept, context); } /** @@ -2085,7 +2359,6 @@ private PollerFlux, BillingSubscriptionInne * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingSubscriptionName The ID that uniquely identifies a subscription. * @param parameters Request parameters that are provided to split the billing subscription. - * @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. @@ -2093,13 +2366,12 @@ private PollerFlux, BillingSubscriptionInne */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, BillingSubscriptionInner> beginSplitAsync( - String billingAccountName, String billingSubscriptionName, BillingSubscriptionSplitRequest parameters, - Context context) { - context = this.client.mergeContext(context); + String billingAccountName, String billingSubscriptionName, BillingSubscriptionSplitRequest parameters) { Mono>> mono - = splitWithResponseAsync(billingAccountName, billingSubscriptionName, parameters, context); + = splitWithResponseAsync(billingAccountName, billingSubscriptionName, parameters); return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingSubscriptionInner.class, BillingSubscriptionInner.class, context); + this.client.getHttpPipeline(), BillingSubscriptionInner.class, BillingSubscriptionInner.class, + this.client.getContext()); } /** @@ -2117,7 +2389,9 @@ private PollerFlux, BillingSubscriptionInne @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, BillingSubscriptionInner> beginSplit( String billingAccountName, String billingSubscriptionName, BillingSubscriptionSplitRequest parameters) { - return this.beginSplitAsync(billingAccountName, billingSubscriptionName, parameters).getSyncPoller(); + Response response = splitWithResponse(billingAccountName, billingSubscriptionName, parameters); + return this.client.getLroResult(response, + BillingSubscriptionInner.class, BillingSubscriptionInner.class, Context.NONE); } /** @@ -2137,7 +2411,10 @@ public SyncPoller, BillingSubscriptionInner public SyncPoller, BillingSubscriptionInner> beginSplit( String billingAccountName, String billingSubscriptionName, BillingSubscriptionSplitRequest parameters, Context context) { - return this.beginSplitAsync(billingAccountName, billingSubscriptionName, parameters, context).getSyncPoller(); + Response response + = splitWithResponse(billingAccountName, billingSubscriptionName, parameters, context); + return this.client.getLroResult(response, + BillingSubscriptionInner.class, BillingSubscriptionInner.class, context); } /** @@ -2159,26 +2436,6 @@ private Mono splitAsync(String billingAccountName, Str .flatMap(this.client::getLroFinalResultOrError); } - /** - * Splits a subscription into a new subscription with quantity less than current subscription quantity and not equal - * to 0. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingSubscriptionName The ID that uniquely identifies a subscription. - * @param parameters Request parameters that are provided to split the billing subscription. - * @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 of a subscription on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono splitAsync(String billingAccountName, String billingSubscriptionName, - BillingSubscriptionSplitRequest parameters, Context context) { - return beginSplitAsync(billingAccountName, billingSubscriptionName, parameters, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Splits a subscription into a new subscription with quantity less than current subscription quantity and not equal * to 0. @@ -2194,7 +2451,7 @@ private Mono splitAsync(String billingAccountName, Str @ServiceMethod(returns = ReturnType.SINGLE) public BillingSubscriptionInner split(String billingAccountName, String billingSubscriptionName, BillingSubscriptionSplitRequest parameters) { - return splitAsync(billingAccountName, billingSubscriptionName, parameters).block(); + return beginSplit(billingAccountName, billingSubscriptionName, parameters).getFinalResult(); } /** @@ -2213,7 +2470,7 @@ public BillingSubscriptionInner split(String billingAccountName, String billingS @ServiceMethod(returns = ReturnType.SINGLE) public BillingSubscriptionInner split(String billingAccountName, String billingSubscriptionName, BillingSubscriptionSplitRequest parameters, Context context) { - return splitAsync(billingAccountName, billingSubscriptionName, parameters, context).block(); + return beginSplit(billingAccountName, billingSubscriptionName, parameters, context).getFinalResult(); } /** @@ -2256,47 +2513,6 @@ private Mono> validateMo .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Validates if charges for a subscription 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 billingSubscriptionName The ID that uniquely identifies a subscription. - * @param parameters Request parameters to transfer billing subscription. - * @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 along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> validateMoveEligibilityWithResponseAsync( - String billingAccountName, String billingSubscriptionName, MoveBillingSubscriptionRequest 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 (billingSubscriptionName == null) { - return Mono.error( - new IllegalArgumentException("Parameter billingSubscriptionName 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.validateMoveEligibility(this.client.getEndpoint(), billingAccountName, billingSubscriptionName, - this.client.getApiVersion(), parameters, accept, context); - } - /** * Validates if charges for a subscription can be moved to a new invoice section. This operation is supported for * billing accounts with agreement type Microsoft Customer Agreement. @@ -2333,8 +2549,28 @@ private Mono validateMoveEligibil public Response validateMoveEligibilityWithResponse( String billingAccountName, String billingSubscriptionName, MoveBillingSubscriptionRequest parameters, Context context) { - return validateMoveEligibilityWithResponseAsync(billingAccountName, billingSubscriptionName, parameters, - context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingSubscriptionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.validateMoveEligibilitySync(this.client.getEndpoint(), billingAccountName, + billingSubscriptionName, this.client.getApiVersion(), parameters, accept, context); } /** @@ -2395,31 +2631,29 @@ private Mono>> deleteWithResponseAsync(String billingA * * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingSubscriptionName The ID that uniquely identifies a subscription. - * @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 {@link Response} on successful completion of {@link Mono}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String billingAccountName, - String billingSubscriptionName, Context context) { + private Response deleteWithResponse(String billingAccountName, String billingSubscriptionName) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); } if (billingSubscriptionName == null) { - return Mono.error( - new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), billingAccountName, billingSubscriptionName, - this.client.getApiVersion(), accept, context); + return service.deleteSync(this.client.getEndpoint(), billingAccountName, billingSubscriptionName, + this.client.getApiVersion(), accept, Context.NONE); } /** @@ -2428,17 +2662,31 @@ private Mono>> deleteWithResponseAsync(String billingA * * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingSubscriptionName The ID that uniquely identifies a subscription. + * @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 {@link PollerFlux} for polling of long-running operation. + * @return the response body along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String billingAccountName, - String billingSubscriptionName) { - Mono>> mono = deleteWithResponseAsync(billingAccountName, billingSubscriptionName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String billingAccountName, String billingSubscriptionName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingSubscriptionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), billingAccountName, billingSubscriptionName, + this.client.getApiVersion(), accept, context); } /** @@ -2447,7 +2695,6 @@ private PollerFlux, Void> beginDeleteAsync(String billingAccoun * * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingSubscriptionName The ID that uniquely identifies a subscription. - * @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. @@ -2455,12 +2702,10 @@ private PollerFlux, Void> beginDeleteAsync(String billingAccoun */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync(String billingAccountName, - String billingSubscriptionName, Context context) { - context = this.client.mergeContext(context); - Mono>> mono - = deleteWithResponseAsync(billingAccountName, billingSubscriptionName, context); + String billingSubscriptionName) { + Mono>> mono = deleteWithResponseAsync(billingAccountName, billingSubscriptionName); return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + this.client.getContext()); } /** @@ -2476,7 +2721,8 @@ private PollerFlux, Void> beginDeleteAsync(String billingAccoun */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String billingAccountName, String billingSubscriptionName) { - return this.beginDeleteAsync(billingAccountName, billingSubscriptionName).getSyncPoller(); + Response response = deleteWithResponse(billingAccountName, billingSubscriptionName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -2493,25 +2739,9 @@ public SyncPoller, Void> beginDelete(String billingAccountName, */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String billingAccountName, String billingSubscriptionName, - Context context) { - return this.beginDeleteAsync(billingAccountName, billingSubscriptionName, context).getSyncPoller(); - } - - /** - * Cancels a billing subscription. This operation is supported only for billing accounts of type Microsoft Partner - * Agreement or Microsoft Customer Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingSubscriptionName The ID that uniquely identifies a subscription. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String billingAccountName, String billingSubscriptionName) { - return beginDeleteAsync(billingAccountName, billingSubscriptionName).last() - .flatMap(this.client::getLroFinalResultOrError); + Context context) { + Response response = deleteWithResponse(billingAccountName, billingSubscriptionName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); } /** @@ -2520,15 +2750,14 @@ private Mono deleteAsync(String billingAccountName, String billingSubscrip * * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingSubscriptionName The ID that uniquely identifies a subscription. - * @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 {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String billingAccountName, String billingSubscriptionName, Context context) { - return beginDeleteAsync(billingAccountName, billingSubscriptionName, context).last() + private Mono deleteAsync(String billingAccountName, String billingSubscriptionName) { + return beginDeleteAsync(billingAccountName, billingSubscriptionName).last() .flatMap(this.client::getLroFinalResultOrError); } @@ -2544,7 +2773,7 @@ private Mono deleteAsync(String billingAccountName, String billingSubscrip */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String billingAccountName, String billingSubscriptionName) { - deleteAsync(billingAccountName, billingSubscriptionName).block(); + beginDelete(billingAccountName, billingSubscriptionName).getFinalResult(); } /** @@ -2560,7 +2789,7 @@ public void delete(String billingAccountName, String billingSubscriptionName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String billingAccountName, String billingSubscriptionName, Context context) { - deleteAsync(billingAccountName, billingSubscriptionName, context).block(); + beginDelete(billingAccountName, billingSubscriptionName, context).getFinalResult(); } /** @@ -2598,41 +2827,6 @@ private Mono> getWithResponseAsync(String bil .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, Microsoft Partner Agreement, and Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingSubscriptionName The ID that uniquely identifies a subscription. - * @param expand Can be used to expand `Reseller`, `ConsumptionCostCenter`, `LastMonthCharges` and - * `MonthToDateCharges`. - * @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 along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String billingAccountName, - String billingSubscriptionName, 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 (billingSubscriptionName == null) { - return Mono.error( - new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), billingAccountName, billingSubscriptionName, - this.client.getApiVersion(), expand, accept, context); - } - /** * Gets a subscription by its ID. The operation is supported for billing accounts with agreement type Microsoft * Customer Agreement, Microsoft Partner Agreement, and Enterprise Agreement. @@ -2668,7 +2862,22 @@ private Mono getAsync(String billingAccountName, Strin @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String billingAccountName, String billingSubscriptionName, String expand, Context context) { - return getWithResponseAsync(billingAccountName, billingSubscriptionName, expand, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingSubscriptionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), billingAccountName, billingSubscriptionName, + this.client.getApiVersion(), expand, accept, context); } /** @@ -2733,37 +2942,36 @@ private Mono>> updateWithResponseAsync(String billingA * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingSubscriptionName The ID that uniquely identifies a subscription. * @param parameters The billing properties of a subscription. - * @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 of a subscription along with {@link Response} on successful completion of - * {@link Mono}. + * @return the billing properties of a subscription along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> updateWithResponseAsync(String billingAccountName, - String billingSubscriptionName, BillingSubscriptionPatch parameters, Context context) { + private Response updateWithResponse(String billingAccountName, String billingSubscriptionName, + BillingSubscriptionPatch parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); } if (billingSubscriptionName == null) { - return Mono.error( - new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null.")); } if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.update(this.client.getEndpoint(), billingAccountName, billingSubscriptionName, - this.client.getApiVersion(), parameters, accept, context); + return service.updateSync(this.client.getEndpoint(), billingAccountName, billingSubscriptionName, + this.client.getApiVersion(), parameters, accept, Context.NONE); } /** @@ -2772,19 +2980,37 @@ private Mono>> updateWithResponseAsync(String billingA * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingSubscriptionName The ID that uniquely identifies a subscription. * @param parameters The billing properties of a subscription. + * @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 {@link PollerFlux} for polling of the billing properties of a subscription. + * @return the billing properties of a subscription along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, BillingSubscriptionInner> beginUpdateAsync( - String billingAccountName, String billingSubscriptionName, BillingSubscriptionPatch parameters) { - Mono>> mono - = updateWithResponseAsync(billingAccountName, billingSubscriptionName, parameters); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingSubscriptionInner.class, BillingSubscriptionInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String billingAccountName, String billingSubscriptionName, + BillingSubscriptionPatch parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingSubscriptionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingSubscriptionName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), billingAccountName, billingSubscriptionName, + this.client.getApiVersion(), parameters, accept, context); } /** @@ -2793,7 +3019,6 @@ private PollerFlux, BillingSubscriptionInne * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingSubscriptionName The ID that uniquely identifies a subscription. * @param parameters The billing properties of a subscription. - * @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. @@ -2801,13 +3026,12 @@ private PollerFlux, BillingSubscriptionInne */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, BillingSubscriptionInner> beginUpdateAsync( - String billingAccountName, String billingSubscriptionName, BillingSubscriptionPatch parameters, - Context context) { - context = this.client.mergeContext(context); + String billingAccountName, String billingSubscriptionName, BillingSubscriptionPatch parameters) { Mono>> mono - = updateWithResponseAsync(billingAccountName, billingSubscriptionName, parameters, context); + = updateWithResponseAsync(billingAccountName, billingSubscriptionName, parameters); return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingSubscriptionInner.class, BillingSubscriptionInner.class, context); + this.client.getHttpPipeline(), BillingSubscriptionInner.class, BillingSubscriptionInner.class, + this.client.getContext()); } /** @@ -2824,7 +3048,9 @@ private PollerFlux, BillingSubscriptionInne @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, BillingSubscriptionInner> beginUpdate(String billingAccountName, String billingSubscriptionName, BillingSubscriptionPatch parameters) { - return this.beginUpdateAsync(billingAccountName, billingSubscriptionName, parameters).getSyncPoller(); + Response response = updateWithResponse(billingAccountName, billingSubscriptionName, parameters); + return this.client.getLroResult(response, + BillingSubscriptionInner.class, BillingSubscriptionInner.class, Context.NONE); } /** @@ -2843,7 +3069,10 @@ private PollerFlux, BillingSubscriptionInne public SyncPoller, BillingSubscriptionInner> beginUpdate( String billingAccountName, String billingSubscriptionName, BillingSubscriptionPatch parameters, Context context) { - return this.beginUpdateAsync(billingAccountName, billingSubscriptionName, parameters, context).getSyncPoller(); + Response response + = updateWithResponse(billingAccountName, billingSubscriptionName, parameters, context); + return this.client.getLroResult(response, + BillingSubscriptionInner.class, BillingSubscriptionInner.class, context); } /** @@ -2864,25 +3093,6 @@ private Mono updateAsync(String billingAccountName, St .flatMap(this.client::getLroFinalResultOrError); } - /** - * Updates the properties of a billing subscription. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingSubscriptionName The ID that uniquely identifies a subscription. - * @param parameters The billing properties of a subscription. - * @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 of a subscription on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync(String billingAccountName, String billingSubscriptionName, - BillingSubscriptionPatch parameters, Context context) { - return beginUpdateAsync(billingAccountName, billingSubscriptionName, parameters, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Updates the properties of a billing subscription. * @@ -2897,7 +3107,7 @@ private Mono updateAsync(String billingAccountName, St @ServiceMethod(returns = ReturnType.SINGLE) public BillingSubscriptionInner update(String billingAccountName, String billingSubscriptionName, BillingSubscriptionPatch parameters) { - return updateAsync(billingAccountName, billingSubscriptionName, parameters).block(); + return beginUpdate(billingAccountName, billingSubscriptionName, parameters).getFinalResult(); } /** @@ -2915,7 +3125,7 @@ public BillingSubscriptionInner update(String billingAccountName, String billing @ServiceMethod(returns = ReturnType.SINGLE) public BillingSubscriptionInner update(String billingAccountName, String billingSubscriptionName, BillingSubscriptionPatch parameters, Context context) { - return updateAsync(billingAccountName, billingSubscriptionName, parameters, context).block(); + return beginUpdate(billingAccountName, billingSubscriptionName, parameters, context).getFinalResult(); } /** @@ -2967,56 +3177,6 @@ private Mono> listByBillingAccountSingle .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Lists the subscriptions for a billing account. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param includeDeleted Can be used to get deleted billing subscriptions. - * @param includeTenantSubscriptions Can be used to get tenant-owned billing subscriptions. This field is only - * applies to Microsoft Online Services Program billing accounts. - * @param includeFailed Can be used to get failed billing subscriptions. - * @param expand Can be used to expand `Reseller`, `ConsumptionCostCenter`, `LastMonthCharges` and - * `MonthToDateCharges`. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountSinglePageAsync(String billingAccountName, - Boolean includeDeleted, Boolean includeTenantSubscriptions, Boolean includeFailed, String expand, String filter, - String orderBy, Long top, Long skip, Boolean count, String search, 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingAccount(this.client.getEndpoint(), billingAccountName, includeDeleted, - includeTenantSubscriptions, includeFailed, this.client.getApiVersion(), expand, filter, orderBy, top, - skip, count, search, 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. * @@ -3080,6 +3240,53 @@ private PagedFlux listByBillingAccountAsync(String bil nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); } + /** + * Lists the subscriptions for a billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param includeDeleted Can be used to get deleted billing subscriptions. + * @param includeTenantSubscriptions Can be used to get tenant-owned billing subscriptions. This field is only + * applies to Microsoft Online Services Program billing accounts. + * @param includeFailed Can be used to get failed billing subscriptions. + * @param expand Can be used to expand `Reseller`, `ConsumptionCostCenter`, `LastMonthCharges` and + * `MonthToDateCharges`. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, + Boolean includeDeleted, Boolean includeTenantSubscriptions, Boolean includeFailed, String expand, String filter, + String orderBy, Long top, Long skip, Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingAccountSync(this.client.getEndpoint(), + billingAccountName, includeDeleted, includeTenantSubscriptions, includeFailed, this.client.getApiVersion(), + expand, filter, orderBy, top, skip, count, search, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Lists the subscriptions for a billing account. * @@ -3105,16 +3312,27 @@ private PagedFlux listByBillingAccountAsync(String bil * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, Boolean includeDeleted, Boolean includeTenantSubscriptions, Boolean includeFailed, String expand, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>( - () -> listByBillingAccountSinglePageAsync(billingAccountName, includeDeleted, includeTenantSubscriptions, - includeFailed, expand, filter, orderBy, top, skip, count, search, context), - nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingAccountSync(this.client.getEndpoint(), + billingAccountName, includeDeleted, includeTenantSubscriptions, includeFailed, this.client.getApiVersion(), + expand, filter, orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -3138,8 +3356,10 @@ public PagedIterable listByBillingAccount(String billi final Long skip = null; final Boolean count = null; final String search = null; - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, includeDeleted, - includeTenantSubscriptions, includeFailed, expand, filter, orderBy, top, skip, count, search)); + return new PagedIterable<>( + () -> listByBillingAccountSinglePage(billingAccountName, includeDeleted, includeTenantSubscriptions, + includeFailed, expand, filter, orderBy, top, skip, count, search), + nextLink -> listByBillingAccountNextSinglePage(nextLink)); } /** @@ -3173,8 +3393,10 @@ public PagedIterable listByBillingAccount(String billi public PagedIterable listByBillingAccount(String billingAccountName, Boolean includeDeleted, Boolean includeTenantSubscriptions, Boolean includeFailed, String expand, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, includeDeleted, - includeTenantSubscriptions, includeFailed, expand, filter, orderBy, top, skip, count, search, context)); + return new PagedIterable<>( + () -> listByBillingAccountSinglePage(billingAccountName, includeDeleted, includeTenantSubscriptions, + includeFailed, expand, filter, orderBy, top, skip, count, search, context), + nextLink -> listByBillingAccountNextSinglePage(nextLink, context)); } /** @@ -3228,57 +3450,6 @@ private Mono> listByCustomerAtBillingAcc .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Lists the subscriptions for a customer at billing account level. 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 includeDeleted Can be used to get deleted billing subscriptions. - * @param expand Can be used to expand `Reseller`, `ConsumptionCostCenter`, `LastMonthCharges` and - * `MonthToDateCharges`. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByCustomerAtBillingAccountSinglePageAsync( - String billingAccountName, String customerName, Boolean includeDeleted, String expand, String filter, - String orderBy, Long top, Long skip, Boolean count, String search, 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByCustomerAtBillingAccount(this.client.getEndpoint(), billingAccountName, customerName, includeDeleted, - this.client.getApiVersion(), expand, filter, orderBy, top, skip, count, search, 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 at billing account level. The operation is supported only for billing * accounts with agreement type Microsoft Partner Agreement. @@ -3342,6 +3513,56 @@ private PagedFlux listByCustomerAtBillingAccountAsync( nextLink -> listByCustomerAtBillingAccountNextSinglePageAsync(nextLink)); } + /** + * Lists the subscriptions for a customer at billing account level. 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 includeDeleted Can be used to get deleted billing subscriptions. + * @param expand Can be used to expand `Reseller`, `ConsumptionCostCenter`, `LastMonthCharges` and + * `MonthToDateCharges`. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerAtBillingAccountSinglePage(String billingAccountName, + String customerName, Boolean includeDeleted, String expand, String filter, String orderBy, Long top, Long skip, + Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByCustomerAtBillingAccountSync( + this.client.getEndpoint(), billingAccountName, customerName, includeDeleted, this.client.getApiVersion(), + expand, filter, orderBy, top, skip, count, search, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Lists the subscriptions for a customer at billing account level. The operation is supported only for billing * accounts with agreement type Microsoft Partner Agreement. @@ -3366,16 +3587,31 @@ private PagedFlux listByCustomerAtBillingAccountAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByCustomerAtBillingAccountAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerAtBillingAccountSinglePage(String billingAccountName, String customerName, Boolean includeDeleted, String expand, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>( - () -> listByCustomerAtBillingAccountSinglePageAsync(billingAccountName, customerName, includeDeleted, - expand, filter, orderBy, top, skip, count, search, context), - nextLink -> listByCustomerAtBillingAccountNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByCustomerAtBillingAccountSync( + this.client.getEndpoint(), billingAccountName, customerName, includeDeleted, this.client.getApiVersion(), + expand, filter, orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -3400,8 +3636,10 @@ public PagedIterable listByCustomerAtBillingAccount(St final Long skip = null; final Boolean count = null; final String search = null; - return new PagedIterable<>(listByCustomerAtBillingAccountAsync(billingAccountName, customerName, includeDeleted, - expand, filter, orderBy, top, skip, count, search)); + return new PagedIterable<>( + () -> listByCustomerAtBillingAccountSinglePage(billingAccountName, customerName, includeDeleted, expand, + filter, orderBy, top, skip, count, search), + nextLink -> listByCustomerAtBillingAccountNextSinglePage(nextLink)); } /** @@ -3434,8 +3672,10 @@ public PagedIterable listByCustomerAtBillingAccount(St public PagedIterable listByCustomerAtBillingAccount(String billingAccountName, String customerName, Boolean includeDeleted, String expand, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByCustomerAtBillingAccountAsync(billingAccountName, customerName, includeDeleted, - expand, filter, orderBy, top, skip, count, search, context)); + return new PagedIterable<>( + () -> listByCustomerAtBillingAccountSinglePage(billingAccountName, customerName, includeDeleted, expand, + filter, orderBy, top, skip, count, search, context), + nextLink -> listByCustomerAtBillingAccountNextSinglePage(nextLink, context)); } /** @@ -3487,55 +3727,6 @@ private Mono> listByEnrollmentAccountSin .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Lists the subscriptions for an enrollment account. The operation is supported for billing accounts with agreement - * type Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param enrollmentAccountName The name of the enrollment account. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByEnrollmentAccountSinglePageAsync( - String billingAccountName, String enrollmentAccountName, String filter, String orderBy, Long top, Long skip, - Boolean count, String search, 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 (enrollmentAccountName == null) { - return Mono - .error(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByEnrollmentAccount(this.client.getEndpoint(), billingAccountName, enrollmentAccountName, - this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - /** * Lists the subscriptions for an enrollment account. The operation is supported for billing accounts with agreement * type Enterprise Agreement. @@ -3592,6 +3783,53 @@ private PagedFlux listByEnrollmentAccountAsync(String nextLink -> listByEnrollmentAccountNextSinglePageAsync(nextLink)); } + /** + * Lists the subscriptions for an enrollment account. The operation is supported for billing accounts with agreement + * type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param enrollmentAccountName The name of the enrollment account. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByEnrollmentAccountSinglePage(String billingAccountName, + String enrollmentAccountName, String filter, String orderBy, Long top, Long skip, Boolean count, + String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (enrollmentAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByEnrollmentAccountSync(this.client.getEndpoint(), billingAccountName, enrollmentAccountName, + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Lists the subscriptions for an enrollment account. The operation is supported for billing accounts with agreement * type Enterprise Agreement. @@ -3613,16 +3851,31 @@ private PagedFlux listByEnrollmentAccountAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByEnrollmentAccountAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByEnrollmentAccountSinglePage(String billingAccountName, String enrollmentAccountName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>( - () -> listByEnrollmentAccountSinglePageAsync(billingAccountName, enrollmentAccountName, filter, orderBy, - top, skip, count, search, context), - nextLink -> listByEnrollmentAccountNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (enrollmentAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByEnrollmentAccountSync(this.client.getEndpoint(), billingAccountName, enrollmentAccountName, + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -3645,8 +3898,8 @@ public PagedIterable listByEnrollmentAccount(String bi final Long skip = null; final Boolean count = null; final String search = null; - return new PagedIterable<>(listByEnrollmentAccountAsync(billingAccountName, enrollmentAccountName, filter, - orderBy, top, skip, count, search)); + return new PagedIterable<>(() -> listByEnrollmentAccountSinglePage(billingAccountName, enrollmentAccountName, + filter, orderBy, top, skip, count, search), nextLink -> listByEnrollmentAccountNextSinglePage(nextLink)); } /** @@ -3676,8 +3929,9 @@ public PagedIterable listByEnrollmentAccount(String bi public PagedIterable listByEnrollmentAccount(String billingAccountName, String enrollmentAccountName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByEnrollmentAccountAsync(billingAccountName, enrollmentAccountName, filter, - orderBy, top, skip, count, search, context)); + return new PagedIterable<>(() -> listByEnrollmentAccountSinglePage(billingAccountName, enrollmentAccountName, + filter, orderBy, top, skip, count, search, context), + nextLink -> listByEnrollmentAccountNextSinglePage(nextLink, context)); } /** @@ -3708,6 +3962,33 @@ private Mono> listByBillingProfileNextSi .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -3716,24 +3997,25 @@ private Mono> listByBillingProfileNextSi * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingProfileNextSinglePageAsync(String nextLink, + private PagedResponse listByBillingProfileNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -3763,6 +4045,33 @@ private Mono> listByCustomerNextSinglePa .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByCustomerNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -3771,24 +4080,24 @@ private Mono> listByCustomerNextSinglePa * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByCustomerNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByCustomerNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByCustomerNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -3819,6 +4128,33 @@ private Mono> listByInvoiceSectionNextSi .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceSectionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByInvoiceSectionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -3827,24 +4163,25 @@ private Mono> listByInvoiceSectionNextSi * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByInvoiceSectionNextSinglePageAsync(String nextLink, + private PagedResponse listByInvoiceSectionNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByInvoiceSectionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -3875,6 +4212,33 @@ private Mono> listByBillingAccountNextSi .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -3883,24 +4247,25 @@ private Mono> listByBillingAccountNextSi * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountNextSinglePageAsync(String nextLink, + private PagedResponse listByBillingAccountNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -3931,6 +4296,33 @@ private Mono> listByBillingAccountNextSi .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerAtBillingAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByCustomerAtBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -3939,24 +4331,25 @@ private Mono> listByBillingAccountNextSi * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> - listByCustomerAtBillingAccountNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listByCustomerAtBillingAccountNextSinglePage(String nextLink, + Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listByCustomerAtBillingAccountNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listByCustomerAtBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -3987,6 +4380,33 @@ private Mono> listByEnrollmentAccountNex .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByEnrollmentAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByEnrollmentAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -3995,23 +4415,26 @@ private Mono> listByEnrollmentAccountNex * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByEnrollmentAccountNextSinglePageAsync(String nextLink, + private PagedResponse listByEnrollmentAccountNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listByEnrollmentAccountNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listByEnrollmentAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(BillingSubscriptionsClientImpl.class); } 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 index ef0e6b7497c1..aef5831e9d86 100644 --- 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 @@ -15,8 +15,8 @@ import com.azure.resourcemanager.billing.models.BillingSubscription; import com.azure.resourcemanager.billing.models.BillingSubscriptionMergeRequest; import com.azure.resourcemanager.billing.models.BillingSubscriptionPatch; -import com.azure.resourcemanager.billing.models.BillingSubscriptions; import com.azure.resourcemanager.billing.models.BillingSubscriptionSplitRequest; +import com.azure.resourcemanager.billing.models.BillingSubscriptions; import com.azure.resourcemanager.billing.models.CancelSubscriptionRequest; import com.azure.resourcemanager.billing.models.MoveBillingSubscriptionEligibilityResult; import com.azure.resourcemanager.billing.models.MoveBillingSubscriptionRequest; 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 index fb15f90259a6..46bd0ababb24 100644 --- 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 @@ -25,6 +25,7 @@ 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; @@ -71,6 +72,15 @@ Mono> get(@HostParam("$host") String endpoint, @PathParam("billingProfileName") String billingProfileName, @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}/billingProfiles/{billingProfileName}/customers/{customerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @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}/billingProfiles/{billingProfileName}/customers") @ExpectedResponses({ 200 }) @@ -83,6 +93,18 @@ Mono> listByBillingProfile(@HostParam("$host") Stri @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingProfileSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @QueryParam("api-version") String apiVersion, + @QueryParam("expand") String expand, @QueryParam("filter") String filter, + @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, @QueryParam("skip") Long skip, + @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}") @ExpectedResponses({ 200 }) @@ -91,6 +113,14 @@ Mono> getByBillingAccount(@HostParam("$host") String end @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}/customers/{customerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByBillingAccountSync(@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}/customers") @ExpectedResponses({ 200 }) @@ -102,6 +132,17 @@ Mono> listByBillingAccount(@HostParam("$host") Stri @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @QueryParam("api-version") String apiVersion, + @QueryParam("expand") String expand, @QueryParam("filter") String filter, + @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, @QueryParam("skip") Long skip, + @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -110,6 +151,14 @@ 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) + Response listByBillingProfileNextSync( + @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 }) @@ -117,6 +166,14 @@ Mono> listByBillingProfileNext( 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) + Response listByBillingAccountNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -156,43 +213,6 @@ private Mono> getWithResponseAsync(String billingAccount .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 billingProfileName The ID that uniquely identifies a billing profile. - * @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 a customer by its ID along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String billingAccountName, String billingProfileName, - 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 (billingProfileName == null) { - return Mono - .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); - } - if (customerName == null) { - return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName, - this.client.getApiVersion(), accept, context); - } - /** * Gets a customer by its ID. The operation is supported only for billing accounts with agreement type Microsoft * Partner Agreement. @@ -227,7 +247,26 @@ private Mono getAsync(String billingAccountName, String billingPr @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String billingAccountName, String billingProfileName, String customerName, Context context) { - return getWithResponseAsync(billingAccountName, billingProfileName, customerName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName, + this.client.getApiVersion(), accept, context); } /** @@ -297,56 +336,6 @@ private Mono> listByBillingProfileSinglePageAsync(S .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 expand May be used to expand enabledAzurePlans and resellers. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingProfileSinglePageAsync(String billingAccountName, - String billingProfileName, String expand, String filter, String orderBy, Long top, Long skip, Boolean count, - String search, 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingProfile(this.client.getEndpoint(), billingAccountName, billingProfileName, - this.client.getApiVersion(), expand, filter, orderBy, top, skip, count, search, 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. @@ -401,6 +390,54 @@ private PagedFlux listByBillingProfileAsync(String billingAccount filter, orderBy, top, skip, count, search), 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 expand May be used to expand enabledAzurePlans and resellers. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, + String billingProfileName, String expand, String filter, String orderBy, Long top, Long skip, Boolean count, + String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingProfileSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + this.client.getApiVersion(), expand, filter, orderBy, top, skip, count, search, accept, Context.NONE); + return 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. @@ -423,16 +460,31 @@ private PagedFlux listByBillingProfileAsync(String billingAccount * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingProfileAsync(String billingAccountName, String billingProfileName, - String expand, String filter, String orderBy, Long top, Long skip, Boolean count, String search, - Context context) { - return new PagedFlux<>( - () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, expand, filter, orderBy, - top, skip, count, search, context), - nextLink -> listByBillingProfileNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, + String billingProfileName, String expand, String filter, String orderBy, Long top, Long skip, Boolean count, + String search, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingProfileSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + this.client.getApiVersion(), expand, filter, orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -455,8 +507,8 @@ public PagedIterable listByBillingProfile(String billingAccountNa final Long skip = null; final Boolean count = null; final String search = null; - return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, expand, filter, - orderBy, top, skip, count, search)); + return new PagedIterable<>(() -> listByBillingProfileSinglePage(billingAccountName, billingProfileName, expand, + filter, orderBy, top, skip, count, search), nextLink -> listByBillingProfileNextSinglePage(nextLink)); } /** @@ -487,8 +539,9 @@ public PagedIterable listByBillingProfile(String billingAccountNa public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName, String expand, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, expand, filter, - orderBy, top, skip, count, search, context)); + return new PagedIterable<>(() -> listByBillingProfileSinglePage(billingAccountName, billingProfileName, expand, + filter, orderBy, top, skip, count, search, context), + nextLink -> listByBillingProfileNextSinglePage(nextLink, context)); } /** @@ -524,39 +577,6 @@ private Mono> getByBillingAccountWithResponseAsync(Strin .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets a customer by its ID at billing account level. 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 a customer by its ID at billing account level along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByBillingAccountWithResponseAsync(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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByBillingAccount(this.client.getEndpoint(), billingAccountName, customerName, - this.client.getApiVersion(), accept, context); - } - /** * Gets a customer by its ID at billing account level. The operation is supported only for billing accounts with * agreement type Microsoft Partner Agreement. @@ -589,7 +609,22 @@ private Mono getByBillingAccountAsync(String billingAccountName, @ServiceMethod(returns = ReturnType.SINGLE) public Response getByBillingAccountWithResponse(String billingAccountName, String customerName, Context context) { - return getByBillingAccountWithResponseAsync(billingAccountName, customerName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByBillingAccountSync(this.client.getEndpoint(), billingAccountName, customerName, + this.client.getApiVersion(), accept, context); } /** @@ -651,51 +686,6 @@ private Mono> listByBillingAccountSinglePageAsync(S .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 expand May be used to expand enabledAzurePlans and resellers. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountSinglePageAsync(String billingAccountName, - String expand, String filter, String orderBy, Long top, Long skip, Boolean count, String search, - 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingAccount(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), expand, - filter, orderBy, top, skip, count, search, 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. @@ -748,6 +738,48 @@ private PagedFlux listByBillingAccountAsync(String billingAccount top, skip, count, search), 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 expand May be used to expand enabledAzurePlans and resellers. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, String expand, + String filter, String orderBy, Long top, Long skip, Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountSync(this.client.getEndpoint(), billingAccountName, + this.client.getApiVersion(), expand, filter, orderBy, top, skip, count, search, accept, Context.NONE); + return 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. @@ -769,13 +801,26 @@ private PagedFlux listByBillingAccountAsync(String billingAccount * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName, String expand, String filter, - String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>(() -> listByBillingAccountSinglePageAsync(billingAccountName, expand, filter, orderBy, - top, skip, count, search, context), nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, String expand, + String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountSync(this.client.getEndpoint(), billingAccountName, + this.client.getApiVersion(), expand, filter, orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -798,7 +843,8 @@ public PagedIterable listByBillingAccount(String billingAccountNa final Boolean count = null; final String search = null; return new PagedIterable<>( - listByBillingAccountAsync(billingAccountName, expand, filter, orderBy, top, skip, count, search)); + () -> listByBillingAccountSinglePage(billingAccountName, expand, filter, orderBy, top, skip, count, search), + nextLink -> listByBillingAccountNextSinglePage(nextLink)); } /** @@ -827,8 +873,8 @@ public PagedIterable listByBillingAccount(String billingAccountNa @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingAccount(String billingAccountName, String expand, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>( - listByBillingAccountAsync(billingAccountName, expand, filter, orderBy, top, skip, count, search, context)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, expand, filter, orderBy, + top, skip, count, search, context), nextLink -> listByBillingAccountNextSinglePage(nextLink, context)); } /** @@ -859,6 +905,33 @@ private Mono> listByBillingProfileNextSinglePageAsy .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -867,24 +940,24 @@ private Mono> listByBillingProfileNextSinglePageAsy * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingProfileNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingProfileNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -915,6 +988,33 @@ private Mono> listByBillingAccountNextSinglePageAsy .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -923,23 +1023,25 @@ private Mono> listByBillingAccountNextSinglePageAsy * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingAccountNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(CustomersClientImpl.class); } diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/DepartmentsClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/DepartmentsClientImpl.java index 35fff13580f8..5f0cc07c03d1 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/DepartmentsClientImpl.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/DepartmentsClientImpl.java @@ -25,6 +25,7 @@ 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.DepartmentsClient; import com.azure.resourcemanager.billing.fluent.models.DepartmentInner; import com.azure.resourcemanager.billing.models.DepartmentListResult; @@ -71,6 +72,15 @@ Mono> get(@HostParam("$host") String endpoint, @PathParam("departmentName") String departmentName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("departmentName") String departmentName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments") @ExpectedResponses({ 200 }) @@ -81,6 +91,16 @@ Mono> listByBillingAccount(@HostParam("$host") St @QueryParam("skip") Long skip, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @QueryParam("api-version") String apiVersion, + @QueryParam("filter") String filter, @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, + @QueryParam("skip") Long skip, @QueryParam("search") String search, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -88,6 +108,14 @@ Mono> listByBillingAccount(@HostParam("$host") St 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) + Response listByBillingAccountNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -121,38 +149,6 @@ private Mono> getWithResponseAsync(String billingAccou .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets a department by ID. The operation is supported only for billing accounts with agreement type Enterprise - * Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param departmentName The name of the department. - * @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 department by ID along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String billingAccountName, String departmentName, - 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 (departmentName == null) { - return Mono.error(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), billingAccountName, departmentName, this.client.getApiVersion(), - accept, context); - } - /** * Gets a department by ID. The operation is supported only for billing accounts with agreement type Enterprise * Agreement. @@ -185,7 +181,22 @@ private Mono getAsync(String billingAccountName, String departm @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String billingAccountName, String departmentName, Context context) { - return getWithResponseAsync(billingAccountName, departmentName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (departmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), billingAccountName, departmentName, + this.client.getApiVersion(), accept, context); } /** @@ -244,47 +255,6 @@ private Mono> listByBillingAccountSinglePageAsync .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Lists the departments that a user has access to. The operation is supported only for billing accounts with - * agreement type Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountSinglePageAsync(String billingAccountName, - String filter, String orderBy, Long top, Long skip, String search, 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingAccount(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), filter, - orderBy, top, skip, search, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - /** * Lists the departments that a user has access to. The operation is supported only for billing accounts with * agreement type Enterprise Agreement. @@ -334,6 +304,44 @@ private PagedFlux listByBillingAccountAsync(String billingAccou nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); } + /** + * Lists the departments that a user has access to. The operation is supported only for billing accounts with + * agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, String filter, + String orderBy, Long top, Long skip, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingAccountSync(this.client.getEndpoint(), + billingAccountName, this.client.getApiVersion(), filter, orderBy, top, skip, search, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Lists the departments that a user has access to. The operation is supported only for billing accounts with * agreement type Enterprise Agreement. @@ -352,14 +360,25 @@ private PagedFlux listByBillingAccountAsync(String billingAccou * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName, String filter, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, String filter, String orderBy, Long top, Long skip, String search, Context context) { - return new PagedFlux<>( - () -> listByBillingAccountSinglePageAsync(billingAccountName, filter, orderBy, top, skip, search, context), - nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingAccountSync(this.client.getEndpoint(), + billingAccountName, this.client.getApiVersion(), filter, orderBy, top, skip, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -379,7 +398,9 @@ public PagedIterable listByBillingAccount(String billingAccount final Long top = null; final Long skip = null; final String search = null; - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, filter, orderBy, top, skip, search)); + return new PagedIterable<>( + () -> listByBillingAccountSinglePage(billingAccountName, filter, orderBy, top, skip, search), + nextLink -> listByBillingAccountNextSinglePage(nextLink)); } /** @@ -406,7 +427,8 @@ public PagedIterable listByBillingAccount(String billingAccount public PagedIterable listByBillingAccount(String billingAccountName, String filter, String orderBy, Long top, Long skip, String search, Context context) { return new PagedIterable<>( - listByBillingAccountAsync(billingAccountName, filter, orderBy, top, skip, search, context)); + () -> listByBillingAccountSinglePage(billingAccountName, filter, orderBy, top, skip, search, context), + nextLink -> listByBillingAccountNextSinglePage(nextLink, context)); } /** @@ -437,6 +459,33 @@ private Mono> listByBillingAccountNextSinglePageA .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -445,23 +494,25 @@ private Mono> listByBillingAccountNextSinglePageA * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingAccountNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(DepartmentsClientImpl.class); } 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 index 4222e67870e9..c151f2490f94 100644 --- 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 @@ -25,6 +25,7 @@ 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.EnrollmentAccountInner; import com.azure.resourcemanager.billing.models.EnrollmentAccountListResult; @@ -72,6 +73,16 @@ Mono> getByDepartment(@HostParam("$host") Strin @PathParam("enrollmentAccountName") String enrollmentAccountName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/enrollmentAccounts/{enrollmentAccountName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByDepartmentSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("departmentName") String departmentName, + @PathParam("enrollmentAccountName") String enrollmentAccountName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/enrollmentAccounts") @ExpectedResponses({ 200 }) @@ -83,6 +94,17 @@ Mono> listByDepartment(@HostParam("$host") @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/departments/{departmentName}/enrollmentAccounts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByDepartmentSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("departmentName") String departmentName, @QueryParam("api-version") String apiVersion, + @QueryParam("filter") String filter, @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, + @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}") @ExpectedResponses({ 200 }) @@ -92,6 +114,15 @@ Mono> get(@HostParam("$host") String endpoint, @PathParam("enrollmentAccountName") String enrollmentAccountName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts/{enrollmentAccountName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("enrollmentAccountName") String enrollmentAccountName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts") @ExpectedResponses({ 200 }) @@ -102,6 +133,16 @@ Mono> listByBillingAccount(@HostParam("$ho @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/enrollmentAccounts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @QueryParam("api-version") String apiVersion, + @QueryParam("filter") String filter, @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, + @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -110,6 +151,14 @@ Mono> listByDepartmentNext( @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) + Response listByDepartmentNextSync( + @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 }) @@ -117,6 +166,14 @@ Mono> listByDepartmentNext( 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) + Response listByBillingAccountNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -156,43 +213,6 @@ private Mono> getByDepartmentWithResponseAsync( .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets an enrollment account by department. The operation is supported only for billing accounts with agreement - * type Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param departmentName The name of the department. - * @param enrollmentAccountName The name of the enrollment 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 an enrollment account by department along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByDepartmentWithResponseAsync(String billingAccountName, - String departmentName, String enrollmentAccountName, 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 (departmentName == null) { - return Mono.error(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); - } - if (enrollmentAccountName == null) { - return Mono - .error(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByDepartment(this.client.getEndpoint(), billingAccountName, departmentName, - enrollmentAccountName, this.client.getApiVersion(), accept, context); - } - /** * Gets an enrollment account by department. The operation is supported only for billing accounts with agreement * type Enterprise Agreement. @@ -228,8 +248,26 @@ private Mono getByDepartmentAsync(String billingAccountN @ServiceMethod(returns = ReturnType.SINGLE) public Response getByDepartmentWithResponse(String billingAccountName, String departmentName, String enrollmentAccountName, Context context) { - return getByDepartmentWithResponseAsync(billingAccountName, departmentName, enrollmentAccountName, context) - .block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (departmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); + } + if (enrollmentAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByDepartmentSync(this.client.getEndpoint(), billingAccountName, departmentName, + enrollmentAccountName, this.client.getApiVersion(), accept, context); } /** @@ -298,54 +336,6 @@ private Mono> listByDepartmentSinglePageAs .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Lists the enrollment accounts for a department. The operation is supported only for billing accounts with - * agreement type Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param departmentName The name of the department. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByDepartmentSinglePageAsync(String billingAccountName, - String departmentName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, - 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 (departmentName == null) { - return Mono.error(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByDepartment(this.client.getEndpoint(), billingAccountName, departmentName, - this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - /** * Lists the enrollment accounts for a department. The operation is supported only for billing accounts with * agreement type Enterprise Agreement. @@ -398,6 +388,52 @@ private PagedFlux listByDepartmentAsync(String billingAc orderBy, top, skip, count, search), nextLink -> listByDepartmentNextSinglePageAsync(nextLink)); } + /** + * Lists the enrollment accounts for a department. The operation is supported only for billing accounts with + * agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param departmentName The name of the department. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByDepartmentSinglePage(String billingAccountName, + String departmentName, String filter, String orderBy, Long top, Long skip, Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (departmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByDepartmentSync(this.client.getEndpoint(), billingAccountName, departmentName, + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Lists the enrollment accounts for a department. The operation is supported only for billing accounts with * agreement type Enterprise Agreement. @@ -419,14 +455,31 @@ private PagedFlux listByDepartmentAsync(String billingAc * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByDepartmentAsync(String billingAccountName, String departmentName, - String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>(() -> listByDepartmentSinglePageAsync(billingAccountName, departmentName, filter, - orderBy, top, skip, count, search, context), - nextLink -> listByDepartmentNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByDepartmentSinglePage(String billingAccountName, + String departmentName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (departmentName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter departmentName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByDepartmentSync(this.client.getEndpoint(), billingAccountName, departmentName, + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -448,8 +501,8 @@ public PagedIterable listByDepartment(String billingAcco final Long skip = null; final Boolean count = null; final String search = null; - return new PagedIterable<>( - listByDepartmentAsync(billingAccountName, departmentName, filter, orderBy, top, skip, count, search)); + return new PagedIterable<>(() -> listByDepartmentSinglePage(billingAccountName, departmentName, filter, orderBy, + top, skip, count, search), nextLink -> listByDepartmentNextSinglePage(nextLink)); } /** @@ -478,8 +531,8 @@ public PagedIterable listByDepartment(String billingAcco @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByDepartment(String billingAccountName, String departmentName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByDepartmentAsync(billingAccountName, departmentName, filter, orderBy, top, skip, - count, search, context)); + return new PagedIterable<>(() -> listByDepartmentSinglePage(billingAccountName, departmentName, filter, orderBy, + top, skip, count, search, context), nextLink -> listByDepartmentNextSinglePage(nextLink, context)); } /** @@ -515,39 +568,6 @@ private Mono> getWithResponseAsync(String billi .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets an enrollment account by ID. The operation is supported only for billing accounts with agreement type - * Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param enrollmentAccountName The name of the enrollment 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 an enrollment account by ID along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String billingAccountName, - String enrollmentAccountName, 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 (enrollmentAccountName == null) { - return Mono - .error(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), billingAccountName, enrollmentAccountName, - this.client.getApiVersion(), accept, context); - } - /** * Gets an enrollment account by ID. The operation is supported only for billing accounts with agreement type * Enterprise Agreement. @@ -580,7 +600,22 @@ private Mono getAsync(String billingAccountName, String @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String billingAccountName, String enrollmentAccountName, Context context) { - return getWithResponseAsync(billingAccountName, enrollmentAccountName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (enrollmentAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter enrollmentAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), billingAccountName, enrollmentAccountName, + this.client.getApiVersion(), accept, context); } /** @@ -641,49 +676,6 @@ private Mono> listByBillingAccountSinglePa .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Lists the enrollment accounts for a billing account. The operation is supported only for billing accounts with - * agreement type Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountSinglePageAsync(String billingAccountName, - String filter, String orderBy, Long top, Long skip, Boolean count, String search, 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingAccount(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), filter, - orderBy, top, skip, count, search, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - /** * Lists the enrollment accounts for a billing account. The operation is supported only for billing accounts with * agreement type Enterprise Agreement. @@ -736,6 +728,47 @@ private PagedFlux listByBillingAccountAsync(String billi nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); } + /** + * Lists the enrollment accounts for a billing account. The operation is supported only for billing accounts with + * agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, + String filter, String orderBy, Long top, Long skip, Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountSync(this.client.getEndpoint(), billingAccountName, + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Lists the enrollment accounts for a billing account. The operation is supported only for billing accounts with * agreement type Enterprise Agreement. @@ -756,13 +789,26 @@ private PagedFlux listByBillingAccountAsync(String billi * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName, String filter, - String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>(() -> listByBillingAccountSinglePageAsync(billingAccountName, filter, orderBy, top, skip, - count, search, context), nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, + String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountSync(this.client.getEndpoint(), billingAccountName, + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -784,7 +830,8 @@ public PagedIterable listByBillingAccount(String billing final Boolean count = null; final String search = null; return new PagedIterable<>( - listByBillingAccountAsync(billingAccountName, filter, orderBy, top, skip, count, search)); + () -> listByBillingAccountSinglePage(billingAccountName, filter, orderBy, top, skip, count, search), + nextLink -> listByBillingAccountNextSinglePage(nextLink)); } /** @@ -812,8 +859,8 @@ public PagedIterable listByBillingAccount(String billing @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingAccount(String billingAccountName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>( - listByBillingAccountAsync(billingAccountName, filter, orderBy, top, skip, count, search, context)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, filter, orderBy, top, skip, + count, search, context), nextLink -> listByBillingAccountNextSinglePage(nextLink, context)); } /** @@ -843,6 +890,33 @@ private Mono> listByDepartmentNextSinglePa .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByDepartmentNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByDepartmentNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -851,24 +925,24 @@ private Mono> listByDepartmentNextSinglePa * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByDepartmentNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByDepartmentNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listByDepartmentNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listByDepartmentNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -899,6 +973,33 @@ private Mono> listByBillingAccountNextSing .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -907,23 +1008,25 @@ private Mono> listByBillingAccountNextSing * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingAccountNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(EnrollmentAccountsClientImpl.class); } 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 index 58bd586fbe4e..9460d510968d 100644 --- 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 @@ -28,8 +28,10 @@ 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.BinaryData; 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; @@ -82,6 +84,16 @@ Mono> validateDeleteEligibi @PathParam("invoiceSectionName") String invoiceSectionName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/validateDeleteEligibility") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response validateDeleteEligibilitySync( + @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" }) @Delete("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}") @ExpectedResponses({ 202, 204 }) @@ -92,6 +104,16 @@ Mono>> delete(@HostParam("$host") String endpoint, @PathParam("invoiceSectionName") String invoiceSectionName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@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}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}") @ExpectedResponses({ 200 }) @@ -102,6 +124,16 @@ Mono> get(@HostParam("$host") String endpoint, @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}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@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" }) @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}") @ExpectedResponses({ 200, 201, 202 }) @@ -113,6 +145,17 @@ Mono>> createOrUpdate(@HostParam("$host") String endpo @BodyParam("application/json") InvoiceSectionInner parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}") + @ExpectedResponses({ 200, 201, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("invoiceSectionName") String invoiceSectionName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") InvoiceSectionInner parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections") @ExpectedResponses({ 200 }) @@ -125,6 +168,18 @@ Mono> listByBillingProfile(@HostParam("$host" @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingProfileSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @QueryParam("includeDeleted") Boolean includeDeleted, @QueryParam("api-version") String apiVersion, + @QueryParam("filter") String filter, @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, + @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -132,6 +187,14 @@ Mono> listByBillingProfile(@HostParam("$host" 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) + Response listByBillingProfileNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -173,45 +236,6 @@ private Mono> validateDelet .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Validates if the invoice section can be deleted. 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 eligibility to delete an invoice section result along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> validateDeleteEligibilityWithResponseAsync( - 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.validateDeleteEligibility(this.client.getEndpoint(), billingAccountName, billingProfileName, - invoiceSectionName, this.client.getApiVersion(), accept, context); - } - /** * Validates if the invoice section can be deleted. The operation is supported for billing accounts with agreement * type Microsoft Customer Agreement. @@ -247,8 +271,26 @@ private Mono validateDeleteEligibili @ServiceMethod(returns = ReturnType.SINGLE) public Response validateDeleteEligibilityWithResponse( String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { - return validateDeleteEligibilityWithResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, - context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.validateDeleteEligibilitySync(this.client.getEndpoint(), billingAccountName, billingProfileName, + invoiceSectionName, this.client.getApiVersion(), accept, context); } /** @@ -315,35 +357,34 @@ private Mono>> deleteWithResponseAsync(String billingA * @param billingAccountName The ID that uniquely 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 {@link Response} on successful completion of {@link Mono}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String billingAccountName, - String billingProfileName, String invoiceSectionName, Context context) { + private Response deleteWithResponse(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.delete(this.client.getEndpoint(), billingAccountName, billingProfileName, invoiceSectionName, - this.client.getApiVersion(), accept, context); + return service.deleteSync(this.client.getEndpoint(), billingAccountName, billingProfileName, invoiceSectionName, + this.client.getApiVersion(), accept, Context.NONE); } /** @@ -353,18 +394,35 @@ private Mono>> deleteWithResponseAsync(String billingA * @param billingAccountName The ID that uniquely 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 {@link PollerFlux} for polling of long-running operation. + * @return the response body along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String billingAccountName, String billingProfileName, - String invoiceSectionName) { - Mono>> mono - = deleteWithResponseAsync(billingAccountName, billingProfileName, invoiceSectionName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String billingAccountName, String billingProfileName, + String invoiceSectionName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteSync(this.client.getEndpoint(), billingAccountName, billingProfileName, invoiceSectionName, + this.client.getApiVersion(), accept, context); } /** @@ -374,7 +432,6 @@ private PollerFlux, Void> beginDeleteAsync(String billingAccoun * @param billingAccountName The ID that uniquely 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. @@ -382,12 +439,11 @@ private PollerFlux, Void> beginDeleteAsync(String billingAccoun */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync(String billingAccountName, String billingProfileName, - String invoiceSectionName, Context context) { - context = this.client.mergeContext(context); + String invoiceSectionName) { Mono>> mono - = deleteWithResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, context); + = deleteWithResponseAsync(billingAccountName, billingProfileName, invoiceSectionName); return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + this.client.getContext()); } /** @@ -405,7 +461,8 @@ private PollerFlux, Void> beginDeleteAsync(String billingAccoun @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String billingAccountName, String billingProfileName, String invoiceSectionName) { - return this.beginDeleteAsync(billingAccountName, billingProfileName, invoiceSectionName).getSyncPoller(); + Response response = deleteWithResponse(billingAccountName, billingProfileName, invoiceSectionName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -424,8 +481,9 @@ public SyncPoller, Void> beginDelete(String billingAccountName, @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { - return this.beginDeleteAsync(billingAccountName, billingProfileName, invoiceSectionName, context) - .getSyncPoller(); + Response response + = deleteWithResponse(billingAccountName, billingProfileName, invoiceSectionName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); } /** @@ -446,26 +504,6 @@ private Mono deleteAsync(String billingAccountName, String billingProfileN .flatMap(this.client::getLroFinalResultOrError); } - /** - * Deletes 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 A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String billingAccountName, String billingProfileName, String invoiceSectionName, - Context context) { - return beginDeleteAsync(billingAccountName, billingProfileName, invoiceSectionName, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Deletes an invoice section. The operation is supported for billing accounts with agreement type Microsoft * Customer Agreement. @@ -479,7 +517,7 @@ private Mono deleteAsync(String billingAccountName, String billingProfileN */ @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String billingAccountName, String billingProfileName, String invoiceSectionName) { - deleteAsync(billingAccountName, billingProfileName, invoiceSectionName).block(); + beginDelete(billingAccountName, billingProfileName, invoiceSectionName).getFinalResult(); } /** @@ -497,7 +535,7 @@ public void delete(String billingAccountName, String billingProfileName, String @ServiceMethod(returns = ReturnType.SINGLE) public void delete(String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { - deleteAsync(billingAccountName, billingProfileName, invoiceSectionName, context).block(); + beginDelete(billingAccountName, billingProfileName, invoiceSectionName, context).getFinalResult(); } /** @@ -538,44 +576,6 @@ private Mono> getWithResponseAsync(String billingA .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 along with {@link Response} on successful completion of {@link Mono}. - */ - @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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), billingAccountName, billingProfileName, invoiceSectionName, - this.client.getApiVersion(), accept, context); - } - /** * Gets an invoice section by its ID. The operation is supported only for billing accounts with agreement type * Microsoft Customer Agreement. @@ -611,7 +611,26 @@ private Mono getAsync(String billingAccountName, String bil @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { - return getWithResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), billingAccountName, billingProfileName, invoiceSectionName, + this.client.getApiVersion(), accept, context); } /** @@ -683,40 +702,40 @@ private Mono>> createOrUpdateWithResponseAsync(String * @param billingProfileName The ID that uniquely identifies a billing profile. * @param invoiceSectionName The ID that uniquely identifies an invoice section. * @param parameters 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 along with {@link Response} on successful completion of {@link Mono}. + * @return an invoice section along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateWithResponseAsync(String billingAccountName, - String billingProfileName, String invoiceSectionName, InvoiceSectionInner parameters, Context context) { + private Response createOrUpdateWithResponse(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdate(this.client.getEndpoint(), billingAccountName, billingProfileName, - invoiceSectionName, this.client.getApiVersion(), parameters, accept, context); + return service.createOrUpdateSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + invoiceSectionName, this.client.getApiVersion(), parameters, accept, Context.NONE); } /** @@ -727,19 +746,41 @@ private Mono>> createOrUpdateWithResponseAsync(String * @param billingProfileName The ID that uniquely identifies a billing profile. * @param invoiceSectionName The ID that uniquely identifies an invoice section. * @param parameters 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 {@link PollerFlux} for polling of an invoice section. + * @return an invoice section along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - 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, this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String billingAccountName, String billingProfileName, + String invoiceSectionName, InvoiceSectionInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + invoiceSectionName, this.client.getApiVersion(), parameters, accept, context); } /** @@ -750,7 +791,6 @@ private PollerFlux, InvoiceSectionInner> beginCr * @param billingProfileName The ID that uniquely identifies a billing profile. * @param invoiceSectionName The ID that uniquely identifies an invoice section. * @param parameters 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. @@ -758,13 +798,12 @@ private PollerFlux, InvoiceSectionInner> beginCr */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) 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); + 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); + InvoiceSectionInner.class, InvoiceSectionInner.class, this.client.getContext()); } /** @@ -784,8 +823,10 @@ private PollerFlux, InvoiceSectionInner> beginCr public SyncPoller, InvoiceSectionInner> beginCreateOrUpdate( String billingAccountName, String billingProfileName, String invoiceSectionName, InvoiceSectionInner parameters) { - return this.beginCreateOrUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters) - .getSyncPoller(); + Response response + = createOrUpdateWithResponse(billingAccountName, billingProfileName, invoiceSectionName, parameters); + return this.client.getLroResult(response, InvoiceSectionInner.class, + InvoiceSectionInner.class, Context.NONE); } /** @@ -806,9 +847,10 @@ public SyncPoller, InvoiceSectionInner> beginCre public SyncPoller, InvoiceSectionInner> beginCreateOrUpdate( String billingAccountName, String billingProfileName, String invoiceSectionName, InvoiceSectionInner parameters, Context context) { - return this - .beginCreateOrUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters, context) - .getSyncPoller(); + Response response = createOrUpdateWithResponse(billingAccountName, billingProfileName, + invoiceSectionName, parameters, context); + return this.client.getLroResult(response, InvoiceSectionInner.class, + InvoiceSectionInner.class, context); } /** @@ -831,28 +873,6 @@ private Mono createOrUpdateAsync(String billingAccountName, .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 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 on successful completion of {@link Mono}. - */ - @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. @@ -869,7 +889,8 @@ private Mono createOrUpdateAsync(String billingAccountName, @ServiceMethod(returns = ReturnType.SINGLE) public InvoiceSectionInner createOrUpdate(String billingAccountName, String billingProfileName, String invoiceSectionName, InvoiceSectionInner parameters) { - return createOrUpdateAsync(billingAccountName, billingProfileName, invoiceSectionName, parameters).block(); + return beginCreateOrUpdate(billingAccountName, billingProfileName, invoiceSectionName, parameters) + .getFinalResult(); } /** @@ -889,8 +910,8 @@ public InvoiceSectionInner createOrUpdate(String billingAccountName, String bill @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(); + return beginCreateOrUpdate(billingAccountName, billingProfileName, invoiceSectionName, parameters, context) + .getFinalResult(); } /** @@ -943,56 +964,6 @@ private Mono> listByBillingProfileSinglePageA .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 includeDeleted Can be used to get deleted invoice sections. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingProfileSinglePageAsync(String billingAccountName, - String billingProfileName, Boolean includeDeleted, String filter, String orderBy, Long top, Long skip, - Boolean count, String search, 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingProfile(this.client.getEndpoint(), billingAccountName, billingProfileName, includeDeleted, - this.client.getApiVersion(), filter, orderBy, top, skip, count, search, 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. @@ -1051,6 +1022,54 @@ private PagedFlux listByBillingProfileAsync(String billingA 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 includeDeleted Can be used to get deleted invoice sections. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, + String billingProfileName, Boolean includeDeleted, String filter, String orderBy, Long top, Long skip, + Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingProfileSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, includeDeleted, this.client.getApiVersion(), filter, orderBy, top, + skip, count, search, accept, Context.NONE); + return 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. @@ -1073,16 +1092,31 @@ private PagedFlux listByBillingProfileAsync(String billingA * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingProfileAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, String billingProfileName, Boolean includeDeleted, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>( - () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, includeDeleted, filter, - orderBy, top, skip, count, search, context), - nextLink -> listByBillingProfileNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingProfileSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, includeDeleted, this.client.getApiVersion(), filter, orderBy, top, + skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1106,8 +1140,9 @@ public PagedIterable listByBillingProfile(String billingAcc final Long skip = null; final Boolean count = null; final String search = null; - return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, includeDeleted, - filter, orderBy, top, skip, count, search)); + return new PagedIterable<>(() -> listByBillingProfileSinglePage(billingAccountName, billingProfileName, + includeDeleted, filter, orderBy, top, skip, count, search), + nextLink -> listByBillingProfileNextSinglePage(nextLink)); } /** @@ -1138,8 +1173,10 @@ public PagedIterable listByBillingProfile(String billingAcc public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName, Boolean includeDeleted, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, includeDeleted, - filter, orderBy, top, skip, count, search, context)); + return new PagedIterable<>( + () -> listByBillingProfileSinglePage(billingAccountName, billingProfileName, includeDeleted, filter, + orderBy, top, skip, count, search, context), + nextLink -> listByBillingProfileNextSinglePage(nextLink, context)); } /** @@ -1170,6 +1207,33 @@ private Mono> listByBillingProfileNextSingleP .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1178,23 +1242,25 @@ private Mono> listByBillingProfileNextSingleP * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingProfileNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingProfileNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(InvoiceSectionsClientImpl.class); } 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 index 66d62c743517..acc6e15a6190 100644 --- 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 @@ -26,8 +26,10 @@ 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.BinaryData; 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; @@ -85,6 +87,19 @@ Mono> listByBillingProfile(@HostParam("$host") Strin @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, @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) + Response listByBillingProfileSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @QueryParam("periodStartDate") LocalDate periodStartDate, + @QueryParam("periodEndDate") LocalDate periodEndDate, @QueryParam("api-version") String apiVersion, + @QueryParam("filter") String filter, @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, + @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/downloadDocuments") @ExpectedResponses({ 200, 202 }) @@ -94,6 +109,15 @@ Mono>> downloadDocumentsByBillingAccount(@HostParam("$ @BodyParam("application/json") List parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/downloadDocuments") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response downloadDocumentsByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") List parameters, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/amend") @ExpectedResponses({ 202 }) @@ -102,6 +126,14 @@ Mono>> amend(@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" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/amend") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response amendSync(@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" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/download") @ExpectedResponses({ 200, 202 }) @@ -111,6 +143,15 @@ Mono>> downloadByBillingAccount(@HostParam("$host") St @QueryParam("documentName") String documentName, @QueryParam("api-version") String apiVersion, @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) + Response downloadByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @PathParam("invoiceName") String invoiceName, + @QueryParam("documentName") String documentName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/downloadSummary") @ExpectedResponses({ 200, 202 }) @@ -119,6 +160,14 @@ Mono>> downloadSummaryByBillingAccount(@HostParam("$ho @PathParam("billingAccountName") String billingAccountName, @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/{billingAccountName}/invoices/{invoiceName}/downloadSummary") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response downloadSummaryByBillingAccountSync(@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("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}") @ExpectedResponses({ 200 }) @@ -127,6 +176,14 @@ Mono> getByBillingAccount(@HostParam("$host") String endp @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("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByBillingAccountSync(@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("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices") @ExpectedResponses({ 200 }) @@ -139,6 +196,18 @@ Mono> listByBillingAccount(@HostParam("$host") Strin @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @QueryParam("periodStartDate") LocalDate periodStartDate, + @QueryParam("periodEndDate") LocalDate periodEndDate, @QueryParam("api-version") String apiVersion, + @QueryParam("filter") String filter, @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, + @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/downloadDocuments") @ExpectedResponses({ 200, 202 }) @@ -148,6 +217,15 @@ Mono>> downloadDocumentsByBillingSubscription(@HostPar @BodyParam("application/json") List parameters, @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) + Response downloadDocumentsByBillingSubscriptionSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") List parameters, + @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 }) @@ -157,6 +235,15 @@ Mono>> downloadByBillingSubscription(@HostParam("$host @QueryParam("documentName") String documentName, @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) + Response downloadByBillingSubscriptionSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @PathParam("invoiceName") String invoiceName, + @QueryParam("documentName") String documentName, @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 }) @@ -165,6 +252,14 @@ Mono> getByBillingSubscription(@HostParam("$host") String @PathParam("subscriptionId") String subscriptionId, @PathParam("invoiceName") String invoiceName, @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) + Response getByBillingSubscriptionSync(@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" }) @Get("/providers/Microsoft.Billing/billingAccounts/default/billingSubscriptions/{subscriptionId}/invoices") @ExpectedResponses({ 200 }) @@ -177,6 +272,18 @@ Mono> listByBillingSubscription(@HostParam("$host") @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, @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) + Response listByBillingSubscriptionSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("periodStartDate") LocalDate periodStartDate, + @QueryParam("periodEndDate") LocalDate periodEndDate, @QueryParam("api-version") String apiVersion, + @QueryParam("filter") String filter, @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, + @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/default/invoices/{invoiceName}") @ExpectedResponses({ 200 }) @@ -185,6 +292,14 @@ Mono> get(@HostParam("$host") String endpoint, @PathParam("invoiceName") String invoiceName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/default/invoices/{invoiceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("invoiceName") String invoiceName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -193,6 +308,14 @@ 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) + Response listByBillingProfileNextSync( + @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 }) @@ -201,6 +324,14 @@ 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) + Response listByBillingAccountNextSync( + @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 }) @@ -208,6 +339,14 @@ Mono> listByBillingAccountNext( Mono> listByBillingSubscriptionNext( @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) + Response listByBillingSubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -263,59 +402,6 @@ private Mono> listByBillingProfileSinglePageAsync(St .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 of the billing period for which the invoice is generated. The date is in - * MM-DD-YYYY format. - * @param periodEndDate The end date of the billing period for which the invoice is generated. The date is in - * MM-DD-YYYY format. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingProfileSinglePageAsync(String billingAccountName, - String billingProfileName, LocalDate periodStartDate, LocalDate periodEndDate, String filter, String orderBy, - Long top, Long skip, Boolean count, String search, 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingProfile(this.client.getEndpoint(), billingAccountName, billingProfileName, periodStartDate, - periodEndDate, this.client.getApiVersion(), filter, orderBy, top, skip, count, search, 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. @@ -379,6 +465,57 @@ private PagedFlux listByBillingProfileAsync(String billingAccountN 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 of the billing period for which the invoice is generated. The date is in + * MM-DD-YYYY format. + * @param periodEndDate The end date of the billing period for which the invoice is generated. The date is in + * MM-DD-YYYY format. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, + String billingProfileName, LocalDate periodStartDate, LocalDate periodEndDate, String filter, String orderBy, + Long top, Long skip, Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingProfileSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, periodStartDate, periodEndDate, this.client.getApiVersion(), filter, + orderBy, top, skip, count, search, accept, Context.NONE); + return 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. @@ -404,16 +541,31 @@ private PagedFlux listByBillingProfileAsync(String billingAccountN * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingProfileAsync(String billingAccountName, String billingProfileName, - LocalDate periodStartDate, LocalDate periodEndDate, String filter, String orderBy, Long top, Long skip, - Boolean count, String search, Context context) { - return new PagedFlux<>( - () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, periodStartDate, - periodEndDate, filter, orderBy, top, skip, count, search, context), - nextLink -> listByBillingProfileNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, + String billingProfileName, LocalDate periodStartDate, LocalDate periodEndDate, String filter, String orderBy, + Long top, Long skip, Boolean count, String search, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingProfileSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, periodStartDate, periodEndDate, this.client.getApiVersion(), filter, + orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -437,8 +589,9 @@ public PagedIterable listByBillingProfile(String billingAccountNam final Long skip = null; final Boolean count = null; final String search = null; - return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, periodStartDate, - periodEndDate, filter, orderBy, top, skip, count, search)); + return new PagedIterable<>(() -> listByBillingProfileSinglePage(billingAccountName, billingProfileName, + periodStartDate, periodEndDate, filter, orderBy, top, skip, count, search), + nextLink -> listByBillingProfileNextSinglePage(nextLink)); } /** @@ -472,8 +625,10 @@ public PagedIterable listByBillingProfile(String billingAccountNam public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName, LocalDate periodStartDate, LocalDate periodEndDate, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, periodStartDate, - periodEndDate, filter, orderBy, top, skip, count, search, context)); + return new PagedIterable<>( + () -> listByBillingProfileSinglePage(billingAccountName, billingProfileName, periodStartDate, periodEndDate, + filter, orderBy, top, skip, count, search, context), + nextLink -> listByBillingProfileNextSinglePage(nextLink, context)); } /** @@ -519,33 +674,33 @@ private Mono>> downloadDocumentsByBillingAccountWithRe * * @param billingAccountName The ID that uniquely identifies a billing account. * @param parameters A list of download details 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 - * along with {@link Response} on successful completion of {@link Mono}. + * along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> downloadDocumentsByBillingAccountWithResponseAsync( - String billingAccountName, List parameters, Context context) { + private Response downloadDocumentsByBillingAccountWithResponse(String billingAccountName, + List parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.forEach(e -> e.validate()); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.downloadDocumentsByBillingAccount(this.client.getEndpoint(), billingAccountName, - this.client.getApiVersion(), parameters, accept, context); + return service.downloadDocumentsByBillingAccountSync(this.client.getEndpoint(), billingAccountName, + this.client.getApiVersion(), parameters, accept, Context.NONE); } /** @@ -555,21 +710,34 @@ private Mono>> downloadDocumentsByBillingAccountWithRe * * @param billingAccountName The ID that uniquely identifies a billing account. * @param parameters A list of download details 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 the {@link PollerFlux} for polling of a URL to download multiple invoice documents (invoice pdf, tax - * receipts, credit notes) as a zip file. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file + * along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, DocumentDownloadResultInner> - beginDownloadDocumentsByBillingAccountAsync(String billingAccountName, - List parameters) { - Mono>> mono - = downloadDocumentsByBillingAccountWithResponseAsync(billingAccountName, parameters); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), DocumentDownloadResultInner.class, DocumentDownloadResultInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response downloadDocumentsByBillingAccountWithResponse(String billingAccountName, + List parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.forEach(e -> e.validate()); + } + final String accept = "application/json"; + return service.downloadDocumentsByBillingAccountSync(this.client.getEndpoint(), billingAccountName, + this.client.getApiVersion(), parameters, accept, context); } /** @@ -579,7 +747,6 @@ private Mono>> downloadDocumentsByBillingAccountWithRe * * @param billingAccountName The ID that uniquely identifies a billing account. * @param parameters A list of download details 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. @@ -588,14 +755,13 @@ private Mono>> downloadDocumentsByBillingAccountWithRe */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, DocumentDownloadResultInner> - beginDownloadDocumentsByBillingAccountAsync(String billingAccountName, List parameters, - Context context) { - context = this.client.mergeContext(context); + beginDownloadDocumentsByBillingAccountAsync(String billingAccountName, + List parameters) { Mono>> mono - = downloadDocumentsByBillingAccountWithResponseAsync(billingAccountName, parameters, context); + = downloadDocumentsByBillingAccountWithResponseAsync(billingAccountName, parameters); return this.client.getLroResult(mono, this.client.getHttpPipeline(), DocumentDownloadResultInner.class, DocumentDownloadResultInner.class, - context); + this.client.getContext()); } /** @@ -614,7 +780,9 @@ private Mono>> downloadDocumentsByBillingAccountWithRe @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, DocumentDownloadResultInner> beginDownloadDocumentsByBillingAccount(String billingAccountName, List parameters) { - return this.beginDownloadDocumentsByBillingAccountAsync(billingAccountName, parameters).getSyncPoller(); + Response response = downloadDocumentsByBillingAccountWithResponse(billingAccountName, parameters); + return this.client.getLroResult(response, + DocumentDownloadResultInner.class, DocumentDownloadResultInner.class, Context.NONE); } /** @@ -635,8 +803,10 @@ private Mono>> downloadDocumentsByBillingAccountWithRe public SyncPoller, DocumentDownloadResultInner> beginDownloadDocumentsByBillingAccount(String billingAccountName, List parameters, Context context) { - return this.beginDownloadDocumentsByBillingAccountAsync(billingAccountName, parameters, context) - .getSyncPoller(); + Response response + = downloadDocumentsByBillingAccountWithResponse(billingAccountName, parameters, context); + return this.client.getLroResult(response, + DocumentDownloadResultInner.class, DocumentDownloadResultInner.class, context); } /** @@ -659,27 +829,6 @@ private Mono downloadDocumentsByBillingAccountAsync .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 parameters A list of download details 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 on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono downloadDocumentsByBillingAccountAsync(String billingAccountName, - List parameters, Context context) { - return beginDownloadDocumentsByBillingAccountAsync(billingAccountName, parameters, 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 @@ -695,7 +844,7 @@ private Mono downloadDocumentsByBillingAccountAsync @ServiceMethod(returns = ReturnType.SINGLE) public DocumentDownloadResultInner downloadDocumentsByBillingAccount(String billingAccountName, List parameters) { - return downloadDocumentsByBillingAccountAsync(billingAccountName, parameters).block(); + return beginDownloadDocumentsByBillingAccount(billingAccountName, parameters).getFinalResult(); } /** @@ -714,7 +863,7 @@ public DocumentDownloadResultInner downloadDocumentsByBillingAccount(String bill @ServiceMethod(returns = ReturnType.SINGLE) public DocumentDownloadResultInner downloadDocumentsByBillingAccount(String billingAccountName, List parameters, Context context) { - return downloadDocumentsByBillingAccountAsync(billingAccountName, parameters, context).block(); + return beginDownloadDocumentsByBillingAccount(billingAccountName, parameters, context).getFinalResult(); } /** @@ -754,30 +903,29 @@ private Mono>> amendWithResponseAsync(String billingAc * * @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 {@link Response} on successful completion of {@link Mono}. + * @return the response body along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> amendWithResponseAsync(String billingAccountName, String invoiceName, - Context context) { + private Response amendWithResponse(String billingAccountName, String invoiceName) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.amend(this.client.getEndpoint(), billingAccountName, invoiceName, this.client.getApiVersion(), - accept, context); + return service.amendSync(this.client.getEndpoint(), billingAccountName, invoiceName, + this.client.getApiVersion(), accept, Context.NONE); } /** @@ -786,16 +934,30 @@ private Mono>> amendWithResponseAsync(String billingAc * * @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 {@link PollerFlux} for polling of long-running operation. + * @return the response body along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginAmendAsync(String billingAccountName, String invoiceName) { - Mono>> mono = amendWithResponseAsync(billingAccountName, invoiceName); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response amendWithResponse(String billingAccountName, String invoiceName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (invoiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.amendSync(this.client.getEndpoint(), billingAccountName, invoiceName, + this.client.getApiVersion(), accept, context); } /** @@ -804,19 +966,16 @@ private PollerFlux, Void> beginAmendAsync(String billingAccount * * @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 {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginAmendAsync(String billingAccountName, String invoiceName, - Context context) { - context = this.client.mergeContext(context); - Mono>> mono = amendWithResponseAsync(billingAccountName, invoiceName, context); + private PollerFlux, Void> beginAmendAsync(String billingAccountName, String invoiceName) { + Mono>> mono = amendWithResponseAsync(billingAccountName, invoiceName); return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, - context); + this.client.getContext()); } /** @@ -832,7 +991,8 @@ private PollerFlux, Void> beginAmendAsync(String billingAccount */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginAmend(String billingAccountName, String invoiceName) { - return this.beginAmendAsync(billingAccountName, invoiceName).getSyncPoller(); + Response response = amendWithResponse(billingAccountName, invoiceName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); } /** @@ -850,7 +1010,8 @@ public SyncPoller, Void> beginAmend(String billingAccountName, @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginAmend(String billingAccountName, String invoiceName, Context context) { - return this.beginAmendAsync(billingAccountName, invoiceName, context).getSyncPoller(); + Response response = amendWithResponse(billingAccountName, invoiceName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); } /** @@ -869,24 +1030,6 @@ private Mono amendAsync(String billingAccountName, String invoiceName) { return beginAmendAsync(billingAccountName, invoiceName).last().flatMap(this.client::getLroFinalResultOrError); } - /** - * Regenerate an invoice by billing account name and invoice name. The operation is supported for billing accounts - * with agreement type 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 A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono amendAsync(String billingAccountName, String invoiceName, Context context) { - return beginAmendAsync(billingAccountName, invoiceName, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Regenerate an invoice by billing account name and invoice name. The operation is supported for billing accounts * with agreement type Microsoft Customer Agreement. @@ -899,7 +1042,7 @@ private Mono amendAsync(String billingAccountName, String invoiceName, Con */ @ServiceMethod(returns = ReturnType.SINGLE) public void amend(String billingAccountName, String invoiceName) { - amendAsync(billingAccountName, invoiceName).block(); + beginAmend(billingAccountName, invoiceName).getFinalResult(); } /** @@ -915,7 +1058,7 @@ public void amend(String billingAccountName, String invoiceName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public void amend(String billingAccountName, String invoiceName, Context context) { - amendAsync(billingAccountName, invoiceName, context).block(); + beginAmend(billingAccountName, invoiceName, context).getFinalResult(); } /** @@ -953,6 +1096,40 @@ private Mono>> downloadByBillingAccountWithResponseAsy .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Gets a URL to download an invoice document. The operation is supported for billing accounts with agreement type + * Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @param documentName The ID that uniquely identifies an invoice document. This ID may be an identifier for an + * invoice PDF, a credit note, or a tax receipt. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 document along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response downloadByBillingAccountWithResponse(String billingAccountName, String invoiceName, + String documentName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (invoiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.downloadByBillingAccountSync(this.client.getEndpoint(), billingAccountName, invoiceName, + documentName, this.client.getApiVersion(), accept, Context.NONE); + } + /** * Gets a URL to download an invoice document. The operation is supported for billing accounts with agreement type * Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. @@ -965,26 +1142,26 @@ private Mono>> downloadByBillingAccountWithResponseAsy * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 document along with {@link Response} on successful completion of - * {@link Mono}. + * @return a URL to download an invoice document along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> downloadByBillingAccountWithResponseAsync(String billingAccountName, - String invoiceName, String documentName, Context context) { + private Response downloadByBillingAccountWithResponse(String billingAccountName, String invoiceName, + String documentName, Context context) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.downloadByBillingAccount(this.client.getEndpoint(), billingAccountName, invoiceName, + return service.downloadByBillingAccountSync(this.client.getEndpoint(), billingAccountName, invoiceName, documentName, this.client.getApiVersion(), accept, context); } @@ -1041,22 +1218,18 @@ private Mono>> downloadByBillingAccountWithResponseAsy * @param invoiceName The ID that uniquely identifies an invoice. * @param documentName The ID that uniquely identifies an invoice document. This ID may be an identifier for an * invoice PDF, a credit note, or a tax receipt. - * @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 {@link PollerFlux} for polling of a URL to download an invoice document. + * @return the {@link SyncPoller} for polling of a URL to download an invoice document. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, DocumentDownloadResultInner> - beginDownloadByBillingAccountAsync(String billingAccountName, String invoiceName, String documentName, - Context context) { - context = this.client.mergeContext(context); - Mono>> mono - = downloadByBillingAccountWithResponseAsync(billingAccountName, invoiceName, documentName, context); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), DocumentDownloadResultInner.class, DocumentDownloadResultInner.class, - context); + public SyncPoller, DocumentDownloadResultInner> + beginDownloadByBillingAccount(String billingAccountName, String invoiceName, String documentName) { + Response response + = downloadByBillingAccountWithResponse(billingAccountName, invoiceName, documentName); + return this.client.getLroResult(response, + DocumentDownloadResultInner.class, DocumentDownloadResultInner.class, Context.NONE); } /** @@ -1074,7 +1247,10 @@ private Mono>> downloadByBillingAccountWithResponseAsy public SyncPoller, DocumentDownloadResultInner> beginDownloadByBillingAccount(String billingAccountName, String invoiceName) { final String documentName = null; - return this.beginDownloadByBillingAccountAsync(billingAccountName, invoiceName, documentName).getSyncPoller(); + Response response + = downloadByBillingAccountWithResponse(billingAccountName, invoiceName, documentName); + return this.client.getLroResult(response, + DocumentDownloadResultInner.class, DocumentDownloadResultInner.class, Context.NONE); } /** @@ -1095,8 +1271,10 @@ private Mono>> downloadByBillingAccountWithResponseAsy public SyncPoller, DocumentDownloadResultInner> beginDownloadByBillingAccount(String billingAccountName, String invoiceName, String documentName, Context context) { - return this.beginDownloadByBillingAccountAsync(billingAccountName, invoiceName, documentName, context) - .getSyncPoller(); + Response response + = downloadByBillingAccountWithResponse(billingAccountName, invoiceName, documentName, context); + return this.client.getLroResult(response, + DocumentDownloadResultInner.class, DocumentDownloadResultInner.class, context); } /** @@ -1138,27 +1316,6 @@ private Mono downloadByBillingAccountAsync(String b .flatMap(this.client::getLroFinalResultOrError); } - /** - * Gets a URL to download an invoice document. The operation is supported for billing accounts with agreement type - * Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param invoiceName The ID that uniquely identifies an invoice. - * @param documentName The ID that uniquely identifies an invoice document. This ID may be an identifier for an - * invoice PDF, a credit note, or a tax receipt. - * @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 document on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono downloadByBillingAccountAsync(String billingAccountName, - String invoiceName, String documentName, Context context) { - return beginDownloadByBillingAccountAsync(billingAccountName, invoiceName, documentName, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Gets a URL to download an invoice document. The operation is supported for billing accounts with agreement type * Microsoft Partner Agreement, Microsoft Customer Agreement or Enterprise Agreement. @@ -1173,7 +1330,7 @@ private Mono downloadByBillingAccountAsync(String b @ServiceMethod(returns = ReturnType.SINGLE) public DocumentDownloadResultInner downloadByBillingAccount(String billingAccountName, String invoiceName) { final String documentName = null; - return downloadByBillingAccountAsync(billingAccountName, invoiceName, documentName).block(); + return beginDownloadByBillingAccount(billingAccountName, invoiceName, documentName).getFinalResult(); } /** @@ -1193,7 +1350,7 @@ public DocumentDownloadResultInner downloadByBillingAccount(String billingAccoun @ServiceMethod(returns = ReturnType.SINGLE) public DocumentDownloadResultInner downloadByBillingAccount(String billingAccountName, String invoiceName, String documentName, Context context) { - return downloadByBillingAccountAsync(billingAccountName, invoiceName, documentName, context).block(); + return beginDownloadByBillingAccount(billingAccountName, invoiceName, documentName, context).getFinalResult(); } /** @@ -1216,17 +1373,49 @@ private Mono>> downloadSummaryByBillingAccountWithResp 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.")); + 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 accept = "application/json"; + return FluxUtil + .withContext(context -> service.downloadSummaryByBillingAccount(this.client.getEndpoint(), + billingAccountName, invoiceName, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a URL to download the summary document for an invoice. The operation is supported for billing accounts with + * agreement type Enterprise Agreement. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param invoiceName The ID that uniquely identifies an invoice. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 the summary document for an invoice along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response downloadSummaryByBillingAccountWithResponse(String billingAccountName, + String invoiceName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); } final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.downloadSummaryByBillingAccount(this.client.getEndpoint(), - billingAccountName, invoiceName, this.client.getApiVersion(), accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + return service.downloadSummaryByBillingAccountSync(this.client.getEndpoint(), billingAccountName, invoiceName, + this.client.getApiVersion(), accept, Context.NONE); } /** @@ -1239,26 +1428,26 @@ private Mono>> downloadSummaryByBillingAccountWithResp * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 the summary document for an invoice along with {@link Response} on successful - * completion of {@link Mono}. + * @return a URL to download the summary document for an invoice along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> downloadSummaryByBillingAccountWithResponseAsync(String billingAccountName, + private Response downloadSummaryByBillingAccountWithResponse(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.downloadSummaryByBillingAccount(this.client.getEndpoint(), billingAccountName, invoiceName, + return service.downloadSummaryByBillingAccountSync(this.client.getEndpoint(), billingAccountName, invoiceName, this.client.getApiVersion(), accept, context); } @@ -1283,29 +1472,6 @@ private Mono>> downloadSummaryByBillingAccountWithResp this.client.getContext()); } - /** - * Gets a URL to download the summary document for an invoice. The operation is supported for billing accounts with - * agreement type Enterprise 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 the {@link PollerFlux} for polling of a URL to download the summary document for an invoice. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, DocumentDownloadResultInner> - beginDownloadSummaryByBillingAccountAsync(String billingAccountName, String invoiceName, Context context) { - context = this.client.mergeContext(context); - Mono>> mono - = downloadSummaryByBillingAccountWithResponseAsync(billingAccountName, invoiceName, context); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), DocumentDownloadResultInner.class, DocumentDownloadResultInner.class, - context); - } - /** * Gets a URL to download the summary document for an invoice. The operation is supported for billing accounts with * agreement type Enterprise Agreement. @@ -1320,7 +1486,9 @@ private Mono>> downloadSummaryByBillingAccountWithResp @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, DocumentDownloadResultInner> beginDownloadSummaryByBillingAccount(String billingAccountName, String invoiceName) { - return this.beginDownloadSummaryByBillingAccountAsync(billingAccountName, invoiceName).getSyncPoller(); + Response response = downloadSummaryByBillingAccountWithResponse(billingAccountName, invoiceName); + return this.client.getLroResult(response, + DocumentDownloadResultInner.class, DocumentDownloadResultInner.class, Context.NONE); } /** @@ -1338,7 +1506,10 @@ private Mono>> downloadSummaryByBillingAccountWithResp @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, DocumentDownloadResultInner> beginDownloadSummaryByBillingAccount(String billingAccountName, String invoiceName, Context context) { - return this.beginDownloadSummaryByBillingAccountAsync(billingAccountName, invoiceName, context).getSyncPoller(); + Response response + = downloadSummaryByBillingAccountWithResponse(billingAccountName, invoiceName, context); + return this.client.getLroResult(response, + DocumentDownloadResultInner.class, DocumentDownloadResultInner.class, context); } /** @@ -1359,25 +1530,6 @@ private Mono downloadSummaryByBillingAccountAsync(S .flatMap(this.client::getLroFinalResultOrError); } - /** - * Gets a URL to download the summary document for an invoice. The operation is supported for billing accounts with - * agreement type Enterprise 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 a URL to download the summary document for an invoice on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono downloadSummaryByBillingAccountAsync(String billingAccountName, - String invoiceName, Context context) { - return beginDownloadSummaryByBillingAccountAsync(billingAccountName, invoiceName, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Gets a URL to download the summary document for an invoice. The operation is supported for billing accounts with * agreement type Enterprise Agreement. @@ -1391,7 +1543,7 @@ private Mono downloadSummaryByBillingAccountAsync(S */ @ServiceMethod(returns = ReturnType.SINGLE) public DocumentDownloadResultInner downloadSummaryByBillingAccount(String billingAccountName, String invoiceName) { - return downloadSummaryByBillingAccountAsync(billingAccountName, invoiceName).block(); + return beginDownloadSummaryByBillingAccount(billingAccountName, invoiceName).getFinalResult(); } /** @@ -1409,7 +1561,7 @@ public DocumentDownloadResultInner downloadSummaryByBillingAccount(String billin @ServiceMethod(returns = ReturnType.SINGLE) public DocumentDownloadResultInner downloadSummaryByBillingAccount(String billingAccountName, String invoiceName, Context context) { - return downloadSummaryByBillingAccountAsync(billingAccountName, invoiceName, context).block(); + return beginDownloadSummaryByBillingAccount(billingAccountName, invoiceName, context).getFinalResult(); } /** @@ -1444,38 +1596,6 @@ private Mono> getByBillingAccountWithResponseAsync(String .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets an invoice by billing account name and ID. The operation is supported for all billing account types. - * - * @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 along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByBillingAccountWithResponseAsync(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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByBillingAccount(this.client.getEndpoint(), billingAccountName, invoiceName, - this.client.getApiVersion(), accept, context); - } - /** * Gets an invoice by billing account name and ID. The operation is supported for all billing account types. * @@ -1506,7 +1626,22 @@ private Mono getByBillingAccountAsync(String billingAccountName, S @ServiceMethod(returns = ReturnType.SINGLE) public Response getByBillingAccountWithResponse(String billingAccountName, String invoiceName, Context context) { - return getByBillingAccountWithResponseAsync(billingAccountName, invoiceName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (invoiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByBillingAccountSync(this.client.getEndpoint(), billingAccountName, invoiceName, + this.client.getApiVersion(), accept, context); } /** @@ -1572,54 +1707,6 @@ private Mono> listByBillingAccountSinglePageAsync(St .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 all - * billing account types. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param periodStartDate The start date of the billing period for which the invoice is generated. The date is in - * MM-DD-YYYY format. - * @param periodEndDate The end date of the billing period for which the invoice is generated. The date is in - * MM-DD-YYYY format. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountSinglePageAsync(String billingAccountName, - LocalDate periodStartDate, LocalDate periodEndDate, String filter, String orderBy, Long top, Long skip, - Boolean count, String search, 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingAccount(this.client.getEndpoint(), billingAccountName, periodStartDate, periodEndDate, - this.client.getApiVersion(), filter, orderBy, top, skip, count, search, 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 all * billing account types. @@ -1678,6 +1765,52 @@ private PagedFlux listByBillingAccountAsync(String billingAccountN nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); } + /** + * Lists the invoices for a billing account for a given start date and end date. The operation is supported for all + * billing account types. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param periodStartDate The start date of the billing period for which the invoice is generated. The date is in + * MM-DD-YYYY format. + * @param periodEndDate The end date of the billing period for which the invoice is generated. The date is in + * MM-DD-YYYY format. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, + LocalDate periodStartDate, LocalDate periodEndDate, String filter, String orderBy, Long top, Long skip, + Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingAccountSync(this.client.getEndpoint(), + billingAccountName, periodStartDate, periodEndDate, this.client.getApiVersion(), filter, orderBy, top, skip, + count, search, accept, Context.NONE); + return 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 all * billing account types. @@ -1702,16 +1835,27 @@ private PagedFlux listByBillingAccountAsync(String billingAccountN * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName, LocalDate periodStartDate, - LocalDate periodEndDate, String filter, String orderBy, Long top, Long skip, Boolean count, String search, - Context context) { - return new PagedFlux<>( - () -> listByBillingAccountSinglePageAsync(billingAccountName, periodStartDate, periodEndDate, filter, - orderBy, top, skip, count, search, context), - nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, + LocalDate periodStartDate, LocalDate periodEndDate, String filter, String orderBy, Long top, Long skip, + Boolean count, String search, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountSync(this.client.getEndpoint(), billingAccountName, periodStartDate, + periodEndDate, this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1734,8 +1878,9 @@ public PagedIterable listByBillingAccount(String billingAccountNam final Long skip = null; final Boolean count = null; final String search = null; - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, periodStartDate, periodEndDate, filter, - orderBy, top, skip, count, search)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, periodStartDate, + periodEndDate, filter, orderBy, top, skip, count, search), + nextLink -> listByBillingAccountNextSinglePage(nextLink)); } /** @@ -1768,8 +1913,9 @@ public PagedIterable listByBillingAccount(String billingAccountNam public PagedIterable listByBillingAccount(String billingAccountName, LocalDate periodStartDate, LocalDate periodEndDate, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, periodStartDate, periodEndDate, filter, - orderBy, top, skip, count, search, context)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, periodStartDate, + periodEndDate, filter, orderBy, top, skip, count, search, context), + nextLink -> listByBillingAccountNextSinglePage(nextLink, context)); } /** @@ -1813,33 +1959,34 @@ public PagedIterable listByBillingAccount(String billingAccountNam * Agreement. * * @param parameters A list of download details 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 - * along with {@link Response} on successful completion of {@link Mono}. + * along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> downloadDocumentsByBillingSubscriptionWithResponseAsync( - List parameters, Context context) { + private Response + downloadDocumentsByBillingSubscriptionWithResponse(List parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.forEach(e -> e.validate()); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.downloadDocumentsByBillingSubscription(this.client.getEndpoint(), - this.client.getSubscriptionId(), this.client.getApiVersion(), parameters, accept, context); + return service.downloadDocumentsByBillingSubscriptionSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getApiVersion(), parameters, accept, Context.NONE); } /** @@ -1848,19 +1995,35 @@ private Mono>> downloadDocumentsByBillingSubscriptionW * Agreement. * * @param parameters A list of download details 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 the {@link PollerFlux} for polling of a URL to download multiple invoice documents (invoice pdf, tax - * receipts, credit notes) as a zip file. + * @return a URL to download multiple invoice documents (invoice pdf, tax receipts, credit notes) as a zip file + * along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, DocumentDownloadResultInner> - beginDownloadDocumentsByBillingSubscriptionAsync(List parameters) { - Mono>> mono = downloadDocumentsByBillingSubscriptionWithResponseAsync(parameters); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), DocumentDownloadResultInner.class, DocumentDownloadResultInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response + downloadDocumentsByBillingSubscriptionWithResponse(List parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.forEach(e -> e.validate()); + } + final String accept = "application/json"; + return service.downloadDocumentsByBillingSubscriptionSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), this.client.getApiVersion(), parameters, accept, context); } /** @@ -1869,7 +2032,6 @@ private Mono>> downloadDocumentsByBillingSubscriptionW * Agreement. * * @param parameters A list of download details 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. @@ -1878,13 +2040,11 @@ private Mono>> downloadDocumentsByBillingSubscriptionW */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, DocumentDownloadResultInner> - beginDownloadDocumentsByBillingSubscriptionAsync(List parameters, Context context) { - context = this.client.mergeContext(context); - Mono>> mono - = downloadDocumentsByBillingSubscriptionWithResponseAsync(parameters, context); + beginDownloadDocumentsByBillingSubscriptionAsync(List parameters) { + Mono>> mono = downloadDocumentsByBillingSubscriptionWithResponseAsync(parameters); return this.client.getLroResult(mono, this.client.getHttpPipeline(), DocumentDownloadResultInner.class, DocumentDownloadResultInner.class, - context); + this.client.getContext()); } /** @@ -1902,7 +2062,9 @@ private Mono>> downloadDocumentsByBillingSubscriptionW @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, DocumentDownloadResultInner> beginDownloadDocumentsByBillingSubscription(List parameters) { - return this.beginDownloadDocumentsByBillingSubscriptionAsync(parameters).getSyncPoller(); + Response response = downloadDocumentsByBillingSubscriptionWithResponse(parameters); + return this.client.getLroResult(response, + DocumentDownloadResultInner.class, DocumentDownloadResultInner.class, Context.NONE); } /** @@ -1921,7 +2083,9 @@ private Mono>> downloadDocumentsByBillingSubscriptionW @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, DocumentDownloadResultInner> beginDownloadDocumentsByBillingSubscription(List parameters, Context context) { - return this.beginDownloadDocumentsByBillingSubscriptionAsync(parameters, context).getSyncPoller(); + Response response = downloadDocumentsByBillingSubscriptionWithResponse(parameters, context); + return this.client.getLroResult(response, + DocumentDownloadResultInner.class, DocumentDownloadResultInner.class, context); } /** @@ -1943,26 +2107,6 @@ private Mono>> downloadDocumentsByBillingSubscriptionW .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 parameters A list of download details 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 on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono - downloadDocumentsByBillingSubscriptionAsync(List parameters, Context context) { - return beginDownloadDocumentsByBillingSubscriptionAsync(parameters, 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 @@ -1977,7 +2121,7 @@ private Mono>> downloadDocumentsByBillingSubscriptionW @ServiceMethod(returns = ReturnType.SINGLE) public DocumentDownloadResultInner downloadDocumentsByBillingSubscription(List parameters) { - return downloadDocumentsByBillingSubscriptionAsync(parameters).block(); + return beginDownloadDocumentsByBillingSubscription(parameters).getFinalResult(); } /** @@ -1995,7 +2139,7 @@ private Mono>> downloadDocumentsByBillingSubscriptionW @ServiceMethod(returns = ReturnType.SINGLE) public DocumentDownloadResultInner downloadDocumentsByBillingSubscription(List parameters, Context context) { - return downloadDocumentsByBillingSubscriptionAsync(parameters, context).block(); + return beginDownloadDocumentsByBillingSubscription(parameters, context).getFinalResult(); } /** @@ -2031,6 +2175,39 @@ private Mono>> downloadByBillingSubscriptionWithRespon .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Gets a URL to download an invoice by billing subscription. 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 documentName The ID that uniquely identifies an invoice document. This ID may be an identifier for an + * invoice PDF, a credit note, or a tax receipt. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 by billing subscription along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response downloadByBillingSubscriptionWithResponse(String invoiceName, String documentName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (invoiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.downloadByBillingSubscriptionSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + invoiceName, documentName, this.client.getApiVersion(), accept, Context.NONE); + } + /** * Gets a URL to download an invoice by billing subscription. The operation is supported for billing accounts with * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. @@ -2042,26 +2219,27 @@ private Mono>> downloadByBillingSubscriptionWithRespon * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 by billing subscription along with {@link Response} on successful completion - * of {@link Mono}. + * @return a URL to download an invoice by billing subscription along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> downloadByBillingSubscriptionWithResponseAsync(String invoiceName, - String documentName, Context context) { + private Response downloadByBillingSubscriptionWithResponse(String invoiceName, String documentName, + Context context) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.downloadByBillingSubscription(this.client.getEndpoint(), this.client.getSubscriptionId(), + return service.downloadByBillingSubscriptionSync(this.client.getEndpoint(), this.client.getSubscriptionId(), invoiceName, documentName, this.client.getApiVersion(), accept, context); } @@ -2115,21 +2293,17 @@ private Mono>> downloadByBillingSubscriptionWithRespon * @param invoiceName The ID that uniquely identifies an invoice. * @param documentName The ID that uniquely identifies an invoice document. This ID may be an identifier for an * invoice PDF, a credit note, or a tax receipt. - * @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 {@link PollerFlux} for polling of a URL to download an invoice by billing subscription. + * @return the {@link SyncPoller} for polling of a URL to download an invoice by billing subscription. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, DocumentDownloadResultInner> - beginDownloadByBillingSubscriptionAsync(String invoiceName, String documentName, Context context) { - context = this.client.mergeContext(context); - Mono>> mono - = downloadByBillingSubscriptionWithResponseAsync(invoiceName, documentName, context); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), DocumentDownloadResultInner.class, DocumentDownloadResultInner.class, - context); + public SyncPoller, DocumentDownloadResultInner> + beginDownloadByBillingSubscription(String invoiceName, String documentName) { + Response response = downloadByBillingSubscriptionWithResponse(invoiceName, documentName); + return this.client.getLroResult(response, + DocumentDownloadResultInner.class, DocumentDownloadResultInner.class, Context.NONE); } /** @@ -2146,7 +2320,9 @@ private Mono>> downloadByBillingSubscriptionWithRespon public SyncPoller, DocumentDownloadResultInner> beginDownloadByBillingSubscription(String invoiceName) { final String documentName = null; - return this.beginDownloadByBillingSubscriptionAsync(invoiceName, documentName).getSyncPoller(); + Response response = downloadByBillingSubscriptionWithResponse(invoiceName, documentName); + return this.client.getLroResult(response, + DocumentDownloadResultInner.class, DocumentDownloadResultInner.class, Context.NONE); } /** @@ -2165,7 +2341,9 @@ private Mono>> downloadByBillingSubscriptionWithRespon @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, DocumentDownloadResultInner> beginDownloadByBillingSubscription(String invoiceName, String documentName, Context context) { - return this.beginDownloadByBillingSubscriptionAsync(invoiceName, documentName, context).getSyncPoller(); + Response response = downloadByBillingSubscriptionWithResponse(invoiceName, documentName, context); + return this.client.getLroResult(response, + DocumentDownloadResultInner.class, DocumentDownloadResultInner.class, context); } /** @@ -2204,26 +2382,6 @@ private Mono downloadByBillingSubscriptionAsync(Str .flatMap(this.client::getLroFinalResultOrError); } - /** - * Gets a URL to download an invoice by billing subscription. 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 documentName The ID that uniquely identifies an invoice document. This ID may be an identifier for an - * invoice PDF, a credit note, or a tax receipt. - * @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 by billing subscription on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono downloadByBillingSubscriptionAsync(String invoiceName, - String documentName, Context context) { - return beginDownloadByBillingSubscriptionAsync(invoiceName, documentName, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Gets a URL to download an invoice by billing subscription. The operation is supported for billing accounts with * agreement type Microsoft Partner Agreement or Microsoft Customer Agreement. @@ -2237,7 +2395,7 @@ private Mono downloadByBillingSubscriptionAsync(Str @ServiceMethod(returns = ReturnType.SINGLE) public DocumentDownloadResultInner downloadByBillingSubscription(String invoiceName) { final String documentName = null; - return downloadByBillingSubscriptionAsync(invoiceName, documentName).block(); + return beginDownloadByBillingSubscription(invoiceName, documentName).getFinalResult(); } /** @@ -2256,7 +2414,7 @@ public DocumentDownloadResultInner downloadByBillingSubscription(String invoiceN @ServiceMethod(returns = ReturnType.SINGLE) public DocumentDownloadResultInner downloadByBillingSubscription(String invoiceName, String documentName, Context context) { - return downloadByBillingSubscriptionAsync(invoiceName, documentName, context).block(); + return beginDownloadByBillingSubscription(invoiceName, documentName, context).getFinalResult(); } /** @@ -2290,38 +2448,6 @@ private Mono> getByBillingSubscriptionWithResponseAsync(S .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets an invoice by subscription ID and invoice 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 subscription ID and invoice ID along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByBillingSubscriptionWithResponseAsync(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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByBillingSubscription(this.client.getEndpoint(), this.client.getSubscriptionId(), invoiceName, - this.client.getApiVersion(), accept, context); - } - /** * Gets an invoice by subscription ID and invoice ID. The operation is supported for billing accounts with agreement * type Microsoft Partner Agreement or Microsoft Customer Agreement. @@ -2350,7 +2476,23 @@ private Mono getByBillingSubscriptionAsync(String invoiceName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getByBillingSubscriptionWithResponse(String invoiceName, Context context) { - return getByBillingSubscriptionWithResponseAsync(invoiceName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (invoiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByBillingSubscriptionSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + invoiceName, this.client.getApiVersion(), accept, context); } /** @@ -2414,53 +2556,6 @@ private Mono> listByBillingSubscriptionSinglePageAsy .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Lists the invoices for a subscription. The operation is supported for billing accounts with agreement type - * Microsoft Partner Agreement or Microsoft Customer Agreement. - * - * @param periodStartDate The start date of the billing period for which the invoice is generated. The date is in - * MM-DD-YYYY format. - * @param periodEndDate The end date of the billing period for which the invoice is generated. The date is in - * MM-DD-YYYY format. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingSubscriptionSinglePageAsync(LocalDate periodStartDate, - LocalDate periodEndDate, String filter, String orderBy, Long top, Long skip, Boolean count, String search, - 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingSubscription(this.client.getEndpoint(), this.client.getSubscriptionId(), periodStartDate, - periodEndDate, this.client.getApiVersion(), filter, orderBy, top, skip, count, search, 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. The operation is supported for billing accounts with agreement type * Microsoft Partner Agreement or Microsoft Customer Agreement. @@ -2514,6 +2609,51 @@ private PagedFlux listByBillingSubscriptionAsync() { orderBy, top, skip, count, search), nextLink -> listByBillingSubscriptionNextSinglePageAsync(nextLink)); } + /** + * Lists the invoices for a subscription. The operation is supported for billing accounts with agreement type + * Microsoft Partner Agreement or Microsoft Customer Agreement. + * + * @param periodStartDate The start date of the billing period for which the invoice is generated. The date is in + * MM-DD-YYYY format. + * @param periodEndDate The end date of the billing period for which the invoice is generated. The date is in + * MM-DD-YYYY format. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingSubscriptionSinglePage(LocalDate periodStartDate, + LocalDate periodEndDate, String filter, String orderBy, Long top, Long skip, Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingSubscriptionSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), periodStartDate, periodEndDate, this.client.getApiVersion(), filter, + orderBy, top, skip, count, search, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Lists the invoices for a subscription. The operation is supported for billing accounts with agreement type * Microsoft Partner Agreement or Microsoft Customer Agreement. @@ -2537,14 +2677,28 @@ private PagedFlux listByBillingSubscriptionAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingSubscriptionAsync(LocalDate periodStartDate, LocalDate periodEndDate, - String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>(() -> listByBillingSubscriptionSinglePageAsync(periodStartDate, periodEndDate, filter, - orderBy, top, skip, count, search, context), - nextLink -> listByBillingSubscriptionNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingSubscriptionSinglePage(LocalDate periodStartDate, + LocalDate periodEndDate, String filter, String orderBy, Long top, Long skip, Boolean count, String search, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingSubscriptionSync(this.client.getEndpoint(), + this.client.getSubscriptionId(), periodStartDate, periodEndDate, this.client.getApiVersion(), filter, + orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -2565,8 +2719,8 @@ public PagedIterable listByBillingSubscription() { final Long skip = null; final Boolean count = null; final String search = null; - return new PagedIterable<>( - listByBillingSubscriptionAsync(periodStartDate, periodEndDate, filter, orderBy, top, skip, count, search)); + return new PagedIterable<>(() -> listByBillingSubscriptionSinglePage(periodStartDate, periodEndDate, filter, + orderBy, top, skip, count, search), nextLink -> listByBillingSubscriptionNextSinglePage(nextLink)); } /** @@ -2597,8 +2751,9 @@ public PagedIterable listByBillingSubscription() { @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingSubscription(LocalDate periodStartDate, LocalDate periodEndDate, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByBillingSubscriptionAsync(periodStartDate, periodEndDate, filter, orderBy, top, - skip, count, search, context)); + return new PagedIterable<>(() -> listByBillingSubscriptionSinglePage(periodStartDate, periodEndDate, filter, + orderBy, top, skip, count, search, context), + nextLink -> listByBillingSubscriptionNextSinglePage(nextLink, context)); } /** @@ -2627,31 +2782,6 @@ private Mono> getWithResponseAsync(String invoiceName) { .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 along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), invoiceName, this.client.getApiVersion(), accept, context); - } - /** * Gets an invoice by ID. The operation is supported for billing accounts with agreement type Microsoft Partner * Agreement or Microsoft Customer Agreement. @@ -2680,7 +2810,17 @@ private Mono getAsync(String invoiceName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String invoiceName, Context context) { - return getWithResponseAsync(invoiceName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (invoiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), invoiceName, this.client.getApiVersion(), accept, context); } /** @@ -2726,6 +2866,33 @@ private Mono> listByBillingProfileNextSinglePageAsyn .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -2734,24 +2901,24 @@ private Mono> listByBillingProfileNextSinglePageAsyn * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingProfileNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingProfileNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -2782,6 +2949,33 @@ private Mono> listByBillingAccountNextSinglePageAsyn .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -2790,24 +2984,24 @@ private Mono> listByBillingAccountNextSinglePageAsyn * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingAccountNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -2838,6 +3032,33 @@ private Mono> listByBillingSubscriptionNextSinglePag .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingSubscriptionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingSubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -2846,23 +3067,25 @@ private Mono> listByBillingSubscriptionNextSinglePag * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingSubscriptionNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingSubscriptionNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingSubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(InvoicesClientImpl.class); } 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 index f6bdedad603f..0905b2c7ddb3 100644 --- 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 @@ -25,6 +25,7 @@ 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; @@ -69,12 +70,26 @@ public interface OperationsService { 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/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** @@ -103,24 +118,13 @@ private Mono> listSinglePageAsync() { /** * List of operations supported by provider. * - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources as paginated response with {@link PagedFlux}. */ - @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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -128,11 +132,20 @@ private Mono> listSinglePageAsync(Context context) * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -142,12 +155,20 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -159,7 +180,7 @@ private PagedFlux listAsync(Context context) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); } /** @@ -173,7 +194,7 @@ public PagedIterable list() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -202,6 +223,33 @@ private Mono> listNextSinglePageAsync(String nextL .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -210,22 +258,24 @@ private Mono> listNextSinglePageAsync(String nextL * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(OperationsClientImpl.class); } diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/PartnerTransfersClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/PartnerTransfersClientImpl.java index a2c9fe52c857..bab64be48885 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/PartnerTransfersClientImpl.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/PartnerTransfersClientImpl.java @@ -28,6 +28,7 @@ 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.PartnerTransfersClient; import com.azure.resourcemanager.billing.fluent.models.PartnerTransferDetailsInner; import com.azure.resourcemanager.billing.models.PartnerInitiateTransferRequest; @@ -76,6 +77,16 @@ Mono> get(@HostParam("$host") String endpo @PathParam("transferName") String transferName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers/{transferName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @PathParam("customerName") String customerName, + @PathParam("transferName") String transferName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers/{transferName}") @ExpectedResponses({ 200, 201 }) @@ -87,6 +98,17 @@ Mono> initiate(@HostParam("$host") String @BodyParam("application/json") PartnerInitiateTransferRequest parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers/{transferName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response initiateSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @PathParam("customerName") String customerName, + @PathParam("transferName") String transferName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PartnerInitiateTransferRequest parameters, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers/{transferName}/cancel") @ExpectedResponses({ 200 }) @@ -97,6 +119,16 @@ Mono> cancel(@HostParam("$host") String en @PathParam("transferName") String transferName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers/{transferName}/cancel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response cancelSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @PathParam("customerName") String customerName, + @PathParam("transferName") String transferName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers") @ExpectedResponses({ 200 }) @@ -106,6 +138,15 @@ Mono> list(@HostParam("$host") String @PathParam("billingProfileName") String billingProfileName, @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}/billingProfiles/{billingProfileName}/customers/{customerName}/transfers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @PathParam("customerName") String customerName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -113,6 +154,14 @@ Mono> list(@HostParam("$host") String 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) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -156,47 +205,6 @@ private Mono> getWithResponseAsync(String .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets a transfer request by ID. The operation is supported only for billing accounts with agreement type Microsoft - * Partner Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param customerName The ID that uniquely identifies a customer. - * @param transferName The ID that uniquely identifies a transfer request. - * @param 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 transfer request by ID along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String billingAccountName, - String billingProfileName, String customerName, String transferName, 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 (customerName == null) { - return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); - } - if (transferName == null) { - return Mono.error(new IllegalArgumentException("Parameter transferName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName, - transferName, this.client.getApiVersion(), accept, context); - } - /** * Gets a transfer request by ID. The operation is supported only for billing accounts with agreement type Microsoft * Partner Agreement. @@ -234,8 +242,30 @@ private Mono getAsync(String billingAccountName, St @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String billingAccountName, String billingProfileName, String customerName, String transferName, Context context) { - return getWithResponseAsync(billingAccountName, billingProfileName, customerName, transferName, context) - .block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + if (transferName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter transferName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName, + transferName, this.client.getApiVersion(), accept, context); } /** @@ -306,54 +336,6 @@ private Mono> initiateWithResponseAsync(St .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Sends a request to a user in a customer's billing account to transfer billing ownership of their subscriptions. - * The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param customerName The ID that uniquely identifies a customer. - * @param transferName The ID that uniquely identifies a transfer request. - * @param parameters Request parameters that are provided to the initiate transfer 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 details of the transfer along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> initiateWithResponseAsync(String billingAccountName, - String billingProfileName, String customerName, String transferName, PartnerInitiateTransferRequest 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 (customerName == null) { - return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); - } - if (transferName == null) { - return Mono.error(new IllegalArgumentException("Parameter transferName 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.initiate(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName, - transferName, this.client.getApiVersion(), parameters, accept, context); - } - /** * Sends a request to a user in a customer's billing account to transfer billing ownership of their subscriptions. * The operation is supported only for billing accounts with agreement type Microsoft Partner Agreement. @@ -394,8 +376,36 @@ private Mono initiateAsync(String billingAccountNam public Response initiateWithResponse(String billingAccountName, String billingProfileName, String customerName, String transferName, PartnerInitiateTransferRequest parameters, Context context) { - return initiateWithResponseAsync(billingAccountName, billingProfileName, customerName, transferName, parameters, - context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + if (transferName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter transferName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.initiateSync(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName, + transferName, this.client.getApiVersion(), parameters, accept, context); } /** @@ -460,47 +470,6 @@ private Mono> cancelWithResponseAsync(Stri .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Cancels a transfer request. The operation is supported only for billing accounts with agreement type Microsoft - * Partner Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param customerName The ID that uniquely identifies a customer. - * @param transferName The ID that uniquely identifies a transfer request. - * @param 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 details of the transfer along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> cancelWithResponseAsync(String billingAccountName, - String billingProfileName, String customerName, String transferName, 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 (customerName == null) { - return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); - } - if (transferName == null) { - return Mono.error(new IllegalArgumentException("Parameter transferName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.cancel(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName, - transferName, this.client.getApiVersion(), accept, context); - } - /** * Cancels a transfer request. The operation is supported only for billing accounts with agreement type Microsoft * Partner Agreement. @@ -538,8 +507,30 @@ private Mono cancelAsync(String billingAccountName, @ServiceMethod(returns = ReturnType.SINGLE) public Response cancelWithResponse(String billingAccountName, String billingProfileName, String customerName, String transferName, Context context) { - return cancelWithResponseAsync(billingAccountName, billingProfileName, customerName, transferName, context) - .block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + if (transferName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter transferName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.cancelSync(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName, + transferName, this.client.getApiVersion(), accept, context); } /** @@ -609,38 +600,16 @@ private Mono> listSinglePageAsync(Str * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingProfileName The ID that uniquely identifies a billing profile. * @param customerName The ID that uniquely identifies a customer. - * @param 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 transfers initiated by partner along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return the list of transfers initiated by partner as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(String billingAccountName, - String billingProfileName, 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 (billingProfileName == null) { - return Mono - .error(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); - } - if (customerName == null) { - return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .list(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName, - this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String billingAccountName, String billingProfileName, + String customerName) { + return new PagedFlux<>(() -> listSinglePageAsync(billingAccountName, billingProfileName, customerName), + nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -653,13 +622,33 @@ private Mono> listSinglePageAsync(Str * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of transfers initiated by partner as paginated response with {@link PagedFlux}. + * @return the list of transfers initiated by partner along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String billingAccountName, String billingProfileName, - String customerName) { - return new PagedFlux<>(() -> listSinglePageAsync(billingAccountName, billingProfileName, customerName), - nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String billingAccountName, + String billingProfileName, String customerName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), billingAccountName, + billingProfileName, customerName, this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -673,13 +662,33 @@ private PagedFlux listAsync(String billingAccountNa * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of transfers initiated by partner as paginated response with {@link PagedFlux}. + * @return the list of transfers initiated by partner along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String billingAccountName, String billingProfileName, - String customerName, Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(billingAccountName, billingProfileName, customerName, context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String billingAccountName, + String billingProfileName, String customerName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), billingAccountName, + billingProfileName, customerName, this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -697,7 +706,8 @@ private PagedFlux listAsync(String billingAccountNa @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String billingAccountName, String billingProfileName, String customerName) { - return new PagedIterable<>(listAsync(billingAccountName, billingProfileName, customerName)); + return new PagedIterable<>(() -> listSinglePage(billingAccountName, billingProfileName, customerName), + nextLink -> listNextSinglePage(nextLink)); } /** @@ -716,7 +726,8 @@ public PagedIterable list(String billingAccountName @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String billingAccountName, String billingProfileName, String customerName, Context context) { - return new PagedIterable<>(listAsync(billingAccountName, billingProfileName, customerName, context)); + return new PagedIterable<>(() -> listSinglePage(billingAccountName, billingProfileName, customerName, context), + nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -745,6 +756,33 @@ private Mono> listNextSinglePageAsync .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of transfers initiated by partner along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -753,22 +791,25 @@ private Mono> listNextSinglePageAsync * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of transfers initiated by partner along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return the list of transfers initiated by partner along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(PartnerTransfersClientImpl.class); } diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/PaymentMethodsClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/PaymentMethodsClientImpl.java index 0b5cf81045b6..2f54288446e2 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/PaymentMethodsClientImpl.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/PaymentMethodsClientImpl.java @@ -26,6 +26,7 @@ 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.PaymentMethodsClient; import com.azure.resourcemanager.billing.fluent.models.PaymentMethodInner; import com.azure.resourcemanager.billing.fluent.models.PaymentMethodLinkInner; @@ -74,6 +75,15 @@ Mono> listByBillingProfile(@HostParam("$h @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}/paymentMethodLinks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingProfileSync(@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}/paymentMethodLinks/{paymentMethodName}") @ExpectedResponses({ 200 }) @@ -84,6 +94,16 @@ Mono> getByBillingProfile(@HostParam("$host") S @PathParam("paymentMethodName") String paymentMethodName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/paymentMethodLinks/{paymentMethodName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByBillingProfileSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("paymentMethodName") String paymentMethodName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/paymentMethods") @ExpectedResponses({ 200 }) @@ -92,6 +112,14 @@ Mono> listByBillingAccount(@HostParam("$host" @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}/paymentMethods") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingAccountSync(@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}/paymentMethods/{paymentMethodName}") @ExpectedResponses({ 200 }) @@ -101,6 +129,15 @@ Mono> getByBillingAccount(@HostParam("$host") Strin @PathParam("paymentMethodName") String paymentMethodName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/paymentMethods/{paymentMethodName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByBillingAccountSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("billingAccountName") String billingAccountName, + @PathParam("paymentMethodName") String paymentMethodName, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/paymentMethods") @ExpectedResponses({ 200 }) @@ -108,6 +145,13 @@ Mono> getByBillingAccount(@HostParam("$host") Strin Mono> listByUser(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/paymentMethods") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByUserSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Delete("/providers/Microsoft.Billing/paymentMethods/{paymentMethodName}") @ExpectedResponses({ 200, 204 }) @@ -116,6 +160,14 @@ Mono> deleteByUser(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("paymentMethodName") String paymentMethodName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Delete("/providers/Microsoft.Billing/paymentMethods/{paymentMethodName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteByUserSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("paymentMethodName") String paymentMethodName, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/paymentMethods/{paymentMethodName}") @ExpectedResponses({ 200 }) @@ -124,6 +176,14 @@ Mono> getByUser(@HostParam("$host") String endpoint @QueryParam("api-version") String apiVersion, @PathParam("paymentMethodName") String paymentMethodName, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/paymentMethods/{paymentMethodName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByUserSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("paymentMethodName") String paymentMethodName, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -132,6 +192,14 @@ 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) + Response listByBillingProfileNextSync( + @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 }) @@ -140,6 +208,14 @@ 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) + Response listByBillingAccountNextSync( + @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 }) @@ -147,6 +223,14 @@ Mono> listByBillingAccountNext( Mono> listByUserNext( @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) + Response listByUserNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -191,35 +275,16 @@ private Mono> listByBillingProfileSinglePa * * @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 payment method links along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return the list of payment method links as paginated response with {@link PagedFlux}. */ - @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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingProfile(this.client.getEndpoint(), billingAccountName, billingProfileName, - this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingProfileAsync(String billingAccountName, + String billingProfileName) { + return new PagedFlux<>(() -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName), + nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); } /** @@ -231,13 +296,29 @@ private Mono> listByBillingProfileSinglePa * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of payment method links as paginated response with {@link PagedFlux}. + * @return the list of payment method links along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingProfileAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, String billingProfileName) { - return new PagedFlux<>(() -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName), - nextLink -> listByBillingProfileNextSinglePageAsync(nextLink)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingProfileSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -250,14 +331,29 @@ private PagedFlux listByBillingProfileAsync(String billi * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of payment method links as paginated response with {@link PagedFlux}. + * @return the list of payment method links along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingProfileAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, String billingProfileName, Context context) { - return new PagedFlux<>( - () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, context), - nextLink -> listByBillingProfileNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingProfileSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -274,7 +370,8 @@ private PagedFlux listByBillingProfileAsync(String billi @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName) { - return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName)); + return new PagedIterable<>(() -> listByBillingProfileSinglePage(billingAccountName, billingProfileName), + nextLink -> listByBillingProfileNextSinglePage(nextLink)); } /** @@ -292,7 +389,9 @@ public PagedIterable listByBillingProfile(String billing @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName, Context context) { - return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, context)); + return new PagedIterable<>( + () -> listByBillingProfileSinglePage(billingAccountName, billingProfileName, context), + nextLink -> listByBillingProfileNextSinglePage(nextLink, context)); } /** @@ -334,45 +433,6 @@ private Mono> getByBillingProfileWithResponseAs .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets a payment method linked with a billing profile. The operation is supported only for billing accounts with - * agreement type Microsoft Customer Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param paymentMethodName The ID that uniquely identifies a payment method. - * @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 payment method linked with a billing profile along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByBillingProfileWithResponseAsync(String billingAccountName, - String billingProfileName, String paymentMethodName, 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 (paymentMethodName == null) { - return Mono - .error(new IllegalArgumentException("Parameter paymentMethodName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByBillingProfile(this.client.getEndpoint(), billingAccountName, billingProfileName, - paymentMethodName, this.client.getApiVersion(), accept, context); - } - /** * Gets a payment method linked with a billing profile. The operation is supported only for billing accounts with * agreement type Microsoft Customer Agreement. @@ -408,8 +468,26 @@ private Mono getByBillingProfileAsync(String billingAcco @ServiceMethod(returns = ReturnType.SINGLE) public Response getByBillingProfileWithResponse(String billingAccountName, String billingProfileName, String paymentMethodName, Context context) { - return getByBillingProfileWithResponseAsync(billingAccountName, billingProfileName, paymentMethodName, context) - .block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (paymentMethodName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter paymentMethodName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByBillingProfileSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + paymentMethodName, this.client.getApiVersion(), accept, context); } /** @@ -467,30 +545,15 @@ private Mono> listByBillingAccountSinglePageAs * 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 payment methods along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return the list of payment methods as paginated response with {@link PagedFlux}. */ - @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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingAccount(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), accept, - context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync(String billingAccountName) { + return new PagedFlux<>(() -> listByBillingAccountSinglePageAsync(billingAccountName), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); } /** @@ -502,12 +565,24 @@ private Mono> listByBillingAccountSinglePageAs * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of payment methods as paginated response with {@link PagedFlux}. + * @return the list of payment methods along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName) { - return new PagedFlux<>(() -> listByBillingAccountSinglePageAsync(billingAccountName), - nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingAccountSync(this.client.getEndpoint(), + billingAccountName, this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -520,12 +595,25 @@ private PagedFlux listByBillingAccountAsync(String billingAc * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of payment methods as paginated response with {@link PagedFlux}. + * @return the list of payment methods along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName, Context context) { - return new PagedFlux<>(() -> listByBillingAccountSinglePageAsync(billingAccountName, context), - nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingAccountSync(this.client.getEndpoint(), + billingAccountName, this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -541,7 +629,8 @@ private PagedFlux listByBillingAccountAsync(String billingAc */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingAccount(String billingAccountName) { - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName), + nextLink -> listByBillingAccountNextSinglePage(nextLink)); } /** @@ -558,7 +647,8 @@ public PagedIterable listByBillingAccount(String billingAcco */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingAccount(String billingAccountName, Context context) { - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, context)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, context), + nextLink -> listByBillingAccountNextSinglePage(nextLink, context)); } /** @@ -595,40 +685,6 @@ private Mono> getByBillingAccountWithResponseAsync( .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets a payment method available for a billing account. The operation is supported only for billing accounts with - * agreement type Microsoft Customer Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param paymentMethodName The ID that uniquely identifies a payment method. - * @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 payment method available for a billing account along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByBillingAccountWithResponseAsync(String billingAccountName, - String paymentMethodName, 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 (paymentMethodName == null) { - return Mono - .error(new IllegalArgumentException("Parameter paymentMethodName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByBillingAccount(this.client.getEndpoint(), this.client.getApiVersion(), billingAccountName, - paymentMethodName, accept, context); - } - /** * Gets a payment method available for a billing account. The operation is supported only for billing accounts with * agreement type Microsoft Customer Agreement. @@ -661,7 +717,22 @@ private Mono getByBillingAccountAsync(String billingAccountN @ServiceMethod(returns = ReturnType.SINGLE) public Response getByBillingAccountWithResponse(String billingAccountName, String paymentMethodName, Context context) { - return getByBillingAccountWithResponseAsync(billingAccountName, paymentMethodName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (paymentMethodName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter paymentMethodName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByBillingAccountSync(this.client.getEndpoint(), this.client.getApiVersion(), + billingAccountName, paymentMethodName, accept, context); } /** @@ -705,23 +776,13 @@ private Mono> listByUserSinglePageAsync() { /** * Lists the payment methods owned by the caller. * - * @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 payment methods along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return the list of payment methods as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByUserSinglePageAsync(Context context) { - 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.listByUser(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByUserAsync() { + return new PagedFlux<>(() -> listByUserSinglePageAsync(), nextLink -> listByUserNextSinglePageAsync(nextLink)); } /** @@ -729,11 +790,20 @@ private Mono> listByUserSinglePageAsync(Contex * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of payment methods as paginated response with {@link PagedFlux}. + * @return the list of payment methods along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByUserAsync() { - return new PagedFlux<>(() -> listByUserSinglePageAsync(), nextLink -> listByUserNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByUserSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByUserSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -743,12 +813,20 @@ private PagedFlux listByUserAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of payment methods as paginated response with {@link PagedFlux}. + * @return the list of payment methods along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByUserAsync(Context context) { - return new PagedFlux<>(() -> listByUserSinglePageAsync(context), - nextLink -> listByUserNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByUserSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByUserSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -760,7 +838,7 @@ private PagedFlux listByUserAsync(Context context) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByUser() { - return new PagedIterable<>(listByUserAsync()); + return new PagedIterable<>(() -> listByUserSinglePage(), nextLink -> listByUserNextSinglePage(nextLink)); } /** @@ -774,7 +852,8 @@ public PagedIterable listByUser() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByUser(Context context) { - return new PagedIterable<>(listByUserAsync(context)); + return new PagedIterable<>(() -> listByUserSinglePage(context), + nextLink -> listByUserNextSinglePage(nextLink, context)); } /** @@ -803,32 +882,6 @@ private Mono> deleteByUserWithResponseAsync(String paymentMethodN .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Deletes a payment method owned by the caller. - * - * @param paymentMethodName The ID that uniquely identifies a payment method. - * @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 {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteByUserWithResponseAsync(String paymentMethodName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (paymentMethodName == null) { - return Mono - .error(new IllegalArgumentException("Parameter paymentMethodName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.deleteByUser(this.client.getEndpoint(), this.client.getApiVersion(), paymentMethodName, accept, - context); - } - /** * Deletes a payment method owned by the caller. * @@ -855,7 +908,18 @@ private Mono deleteByUserAsync(String paymentMethodName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteByUserWithResponse(String paymentMethodName, Context context) { - return deleteByUserWithResponseAsync(paymentMethodName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (paymentMethodName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter paymentMethodName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.deleteByUserSync(this.client.getEndpoint(), this.client.getApiVersion(), paymentMethodName, + accept, context); } /** @@ -898,33 +962,6 @@ private Mono> getByUserWithResponseAsync(String pay .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets a payment method owned by the caller. - * - * @param paymentMethodName The ID that uniquely identifies a payment method. - * @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 payment method owned by the caller along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByUserWithResponseAsync(String paymentMethodName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (paymentMethodName == null) { - return Mono - .error(new IllegalArgumentException("Parameter paymentMethodName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByUser(this.client.getEndpoint(), this.client.getApiVersion(), paymentMethodName, accept, - context); - } - /** * Gets a payment method owned by the caller. * @@ -951,7 +988,18 @@ private Mono getByUserAsync(String paymentMethodName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getByUserWithResponse(String paymentMethodName, Context context) { - return getByUserWithResponseAsync(paymentMethodName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (paymentMethodName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter paymentMethodName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByUserSync(this.client.getEndpoint(), this.client.getApiVersion(), paymentMethodName, accept, + context); } /** @@ -996,6 +1044,33 @@ private Mono> listByBillingProfileNextSing .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of payment method links along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1004,24 +1079,24 @@ private Mono> listByBillingProfileNextSing * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of payment method links along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return the list of payment method links along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingProfileNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingProfileNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1051,6 +1126,33 @@ private Mono> listByBillingAccountNextSinglePa .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of payment methods along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1059,23 +1161,24 @@ private Mono> listByBillingAccountNextSinglePa * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of payment methods along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return the list of payment methods along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingAccountNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1104,6 +1207,33 @@ private Mono> listByUserNextSinglePageAsync(St .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of payment methods along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByUserNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByUserNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1112,21 +1242,25 @@ private Mono> listByUserNextSinglePageAsync(St * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of payment methods along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return the list of payment methods along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByUserNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listByUserNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listByUserNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listByUserNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(PaymentMethodsClientImpl.class); } 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 index 0f5438cabaec..a5329efb893c 100644 --- 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 @@ -22,8 +22,10 @@ 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.BinaryData; 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.PoliciesClient; @@ -77,6 +79,16 @@ Mono> getByCustomer(@HostParam("$host") String end @PathParam("policyName") ServiceDefinedResourceName policyName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/policies/{policyName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByCustomerSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @PathParam("customerName") String customerName, + @PathParam("policyName") ServiceDefinedResourceName policyName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/policies/default") @ExpectedResponses({ 200, 201 }) @@ -87,6 +99,16 @@ Mono>> createOrUpdateByCustomer(@HostParam("$host") St @QueryParam("api-version") String apiVersion, @BodyParam("application/json") CustomerPolicyInner parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/policies/default") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateByCustomerSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @PathParam("customerName") String customerName, + @QueryParam("api-version") String apiVersion, @BodyParam("application/json") CustomerPolicyInner parameters, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default") @ExpectedResponses({ 200 }) @@ -96,6 +118,15 @@ Mono> getByBillingProfile(@HostParam("$host" @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}/policies/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByBillingProfileSync(@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, 201 }) @@ -106,6 +137,16 @@ Mono>> createOrUpdateByBillingProfile(@HostParam("$hos @BodyParam("application/json") BillingProfilePolicyInner parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/policies/default") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateByBillingProfileSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BillingProfilePolicyInner parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default") @ExpectedResponses({ 200 }) @@ -114,6 +155,14 @@ Mono> getByCustomerAtBillingAccount(@HostParam("$h @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}/customers/{customerName}/policies/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByCustomerAtBillingAccountSync(@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, 201 }) @@ -123,6 +172,15 @@ Mono>> createOrUpdateByCustomerAtBillingAccount(@HostP @QueryParam("api-version") String apiVersion, @BodyParam("application/json") CustomerPolicyInner parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/policies/default") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateByCustomerAtBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @PathParam("customerName") String customerName, + @QueryParam("api-version") String apiVersion, @BodyParam("application/json") CustomerPolicyInner parameters, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/policies/default") @ExpectedResponses({ 200 }) @@ -131,6 +189,14 @@ Mono> getByBillingAccount(@HostParam("$host" @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}/policies/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/policies/default") @ExpectedResponses({ 200, 201 }) @@ -140,6 +206,15 @@ Mono>> createOrUpdateByBillingAccount(@HostParam("$hos @BodyParam("application/json") BillingAccountPolicyInner parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/policies/default") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") BillingAccountPolicyInner parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Billing/policies/default") @ExpectedResponses({ 200 }) @@ -147,6 +222,14 @@ Mono>> createOrUpdateByBillingAccount(@HostParam("$hos Mono> getBySubscription(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Billing/policies/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getBySubscriptionSync(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); } /** @@ -190,47 +273,6 @@ private Mono> getByCustomerWithResponseAsync(Strin .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 billingProfileName The ID that uniquely identifies a billing profile. - * @param customerName The ID that uniquely identifies a customer. - * @param policyName Service-defined resource names such as 'default' which are reserved resource names. - * @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 at customer scope along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByCustomerWithResponseAsync(String billingAccountName, - String billingProfileName, String customerName, ServiceDefinedResourceName policyName, 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 (customerName == null) { - return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); - } - if (policyName == null) { - return Mono.error(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByCustomer(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName, - policyName, this.client.getApiVersion(), accept, context); - } - /** * Lists the policies for a customer. This operation is supported only for billing accounts with agreement type * Microsoft Partner Agreement. @@ -268,8 +310,30 @@ private Mono getByCustomerAsync(String billingAccountName, @ServiceMethod(returns = ReturnType.SINGLE) public Response getByCustomerWithResponse(String billingAccountName, String billingProfileName, String customerName, ServiceDefinedResourceName policyName, Context context) { - return getByCustomerWithResponseAsync(billingAccountName, billingProfileName, customerName, policyName, context) - .block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + if (policyName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter policyName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByCustomerSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + customerName, policyName, this.client.getApiVersion(), accept, context); } /** @@ -343,39 +407,40 @@ private Mono>> createOrUpdateByCustomerWithResponseAsy * @param billingProfileName The ID that uniquely identifies a billing profile. * @param customerName The ID that uniquely identifies a customer. * @param parameters A policy at customer scope. - * @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 at customer scope along with {@link Response} on successful completion of {@link Mono}. + * @return a policy at customer scope along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateByCustomerWithResponseAsync(String billingAccountName, - String billingProfileName, String customerName, CustomerPolicyInner parameters, Context context) { + private Response createOrUpdateByCustomerWithResponse(String billingAccountName, + String billingProfileName, String customerName, CustomerPolicyInner parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); } if (customerName == null) { - return Mono.error(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdateByCustomer(this.client.getEndpoint(), billingAccountName, billingProfileName, - customerName, this.client.getApiVersion(), parameters, accept, context); + return service.createOrUpdateByCustomerSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + customerName, this.client.getApiVersion(), parameters, accept, Context.NONE); } /** @@ -386,18 +451,41 @@ private Mono>> createOrUpdateByCustomerWithResponseAsy * @param billingProfileName The ID that uniquely identifies a billing profile. * @param customerName The ID that uniquely identifies a customer. * @param parameters A policy at customer scope. + * @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 {@link PollerFlux} for polling of a policy at customer scope. + * @return a policy at customer scope along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, CustomerPolicyInner> beginCreateOrUpdateByCustomerAsync( - String billingAccountName, String billingProfileName, String customerName, CustomerPolicyInner parameters) { - Mono>> mono = createOrUpdateByCustomerWithResponseAsync(billingAccountName, - billingProfileName, customerName, parameters); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), - CustomerPolicyInner.class, CustomerPolicyInner.class, this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateByCustomerWithResponse(String billingAccountName, + String billingProfileName, String customerName, CustomerPolicyInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.createOrUpdateByCustomerSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + customerName, this.client.getApiVersion(), parameters, accept, context); } /** @@ -408,7 +496,6 @@ private PollerFlux, CustomerPolicyInner> beginCr * @param billingProfileName The ID that uniquely identifies a billing profile. * @param customerName The ID that uniquely identifies a customer. * @param parameters A policy at customer scope. - * @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. @@ -416,13 +503,11 @@ private PollerFlux, CustomerPolicyInner> beginCr */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, CustomerPolicyInner> beginCreateOrUpdateByCustomerAsync( - String billingAccountName, String billingProfileName, String customerName, CustomerPolicyInner parameters, - Context context) { - context = this.client.mergeContext(context); + String billingAccountName, String billingProfileName, String customerName, CustomerPolicyInner parameters) { Mono>> mono = createOrUpdateByCustomerWithResponseAsync(billingAccountName, - billingProfileName, customerName, parameters, context); + billingProfileName, customerName, parameters); return this.client.getLroResult(mono, this.client.getHttpPipeline(), - CustomerPolicyInner.class, CustomerPolicyInner.class, context); + CustomerPolicyInner.class, CustomerPolicyInner.class, this.client.getContext()); } /** @@ -441,8 +526,10 @@ private PollerFlux, CustomerPolicyInner> beginCr @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, CustomerPolicyInner> beginCreateOrUpdateByCustomer( String billingAccountName, String billingProfileName, String customerName, CustomerPolicyInner parameters) { - return this.beginCreateOrUpdateByCustomerAsync(billingAccountName, billingProfileName, customerName, parameters) - .getSyncPoller(); + Response response + = createOrUpdateByCustomerWithResponse(billingAccountName, billingProfileName, customerName, parameters); + return this.client.getLroResult(response, CustomerPolicyInner.class, + CustomerPolicyInner.class, Context.NONE); } /** @@ -463,10 +550,10 @@ public SyncPoller, CustomerPolicyInner> beginCre public SyncPoller, CustomerPolicyInner> beginCreateOrUpdateByCustomer( String billingAccountName, String billingProfileName, String customerName, CustomerPolicyInner parameters, Context context) { - return this - .beginCreateOrUpdateByCustomerAsync(billingAccountName, billingProfileName, customerName, parameters, - context) - .getSyncPoller(); + Response response = createOrUpdateByCustomerWithResponse(billingAccountName, billingProfileName, + customerName, parameters, context); + return this.client.getLroResult(response, CustomerPolicyInner.class, + CustomerPolicyInner.class, context); } /** @@ -490,27 +577,6 @@ private Mono createOrUpdateByCustomerAsync(String billingAc .flatMap(this.client::getLroFinalResultOrError); } - /** - * 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 billingProfileName The ID that uniquely identifies a billing profile. - * @param customerName The ID that uniquely identifies a customer. - * @param parameters A policy at customer scope. - * @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 at customer scope on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateByCustomerAsync(String billingAccountName, - String billingProfileName, String customerName, CustomerPolicyInner parameters, Context context) { - return beginCreateOrUpdateByCustomerAsync(billingAccountName, billingProfileName, customerName, parameters, - context).last().flatMap(this.client::getLroFinalResultOrError); - } - /** * Updates the policies for a customer. This operation is supported only for billing accounts with agreement type * Microsoft Partner Agreement. @@ -527,7 +593,8 @@ private Mono createOrUpdateByCustomerAsync(String billingAc @ServiceMethod(returns = ReturnType.SINGLE) public CustomerPolicyInner createOrUpdateByCustomer(String billingAccountName, String billingProfileName, String customerName, CustomerPolicyInner parameters) { - return createOrUpdateByCustomerAsync(billingAccountName, billingProfileName, customerName, parameters).block(); + return beginCreateOrUpdateByCustomer(billingAccountName, billingProfileName, customerName, parameters) + .getFinalResult(); } /** @@ -547,8 +614,8 @@ public CustomerPolicyInner createOrUpdateByCustomer(String billingAccountName, S @ServiceMethod(returns = ReturnType.SINGLE) public CustomerPolicyInner createOrUpdateByCustomer(String billingAccountName, String billingProfileName, String customerName, CustomerPolicyInner parameters, Context context) { - return createOrUpdateByCustomerAsync(billingAccountName, billingProfileName, customerName, parameters, context) - .block(); + return beginCreateOrUpdateByCustomer(billingAccountName, billingProfileName, customerName, parameters, context) + .getFinalResult(); } /** @@ -584,39 +651,6 @@ private Mono> getByBillingProfileWithRespons .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 at billing profile scope along with {@link Response} on successful completion of {@link Mono}. - */ - @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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByBillingProfile(this.client.getEndpoint(), billingAccountName, billingProfileName, - this.client.getApiVersion(), accept, context); - } - /** * Lists the policies for a billing profile. This operation is supported only for billing accounts with agreement * type Microsoft Customer Agreement. @@ -650,7 +684,22 @@ private Mono getByBillingProfileAsync(String billingA @ServiceMethod(returns = ReturnType.SINGLE) public Response getByBillingProfileWithResponse(String billingAccountName, String billingProfileName, Context context) { - return getByBillingProfileWithResponseAsync(billingAccountName, billingProfileName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByBillingProfileSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + this.client.getApiVersion(), accept, context); } /** @@ -715,36 +764,36 @@ private Mono>> createOrUpdateByBillingProfileWithRespo * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingProfileName The ID that uniquely identifies a billing profile. * @param parameters A policy at billing profile scope. - * @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 at billing profile scope along with {@link Response} on successful completion of {@link Mono}. + * @return a policy at billing profile scope along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateByBillingProfileWithResponseAsync(String billingAccountName, - String billingProfileName, BillingProfilePolicyInner parameters, Context context) { + private Response createOrUpdateByBillingProfileWithResponse(String billingAccountName, + String billingProfileName, BillingProfilePolicyInner parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdateByBillingProfile(this.client.getEndpoint(), billingAccountName, billingProfileName, - this.client.getApiVersion(), parameters, accept, context); + return service.createOrUpdateByBillingProfileSync(this.client.getEndpoint(), billingAccountName, + billingProfileName, this.client.getApiVersion(), parameters, accept, Context.NONE); } /** @@ -754,20 +803,37 @@ private Mono>> createOrUpdateByBillingProfileWithRespo * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingProfileName The ID that uniquely identifies a billing profile. * @param parameters A policy at billing profile scope. + * @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 {@link PollerFlux} for polling of a policy at billing profile scope. + * @return a policy at billing profile scope along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, BillingProfilePolicyInner> - beginCreateOrUpdateByBillingProfileAsync(String billingAccountName, String billingProfileName, - BillingProfilePolicyInner parameters) { - Mono>> mono - = createOrUpdateByBillingProfileWithResponseAsync(billingAccountName, billingProfileName, parameters); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingProfilePolicyInner.class, BillingProfilePolicyInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateByBillingProfileWithResponse(String billingAccountName, + String billingProfileName, BillingProfilePolicyInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.createOrUpdateByBillingProfileSync(this.client.getEndpoint(), billingAccountName, + billingProfileName, this.client.getApiVersion(), parameters, accept, context); } /** @@ -777,7 +843,6 @@ private Mono>> createOrUpdateByBillingProfileWithRespo * @param billingAccountName The ID that uniquely identifies a billing account. * @param billingProfileName The ID that uniquely identifies a billing profile. * @param parameters A policy at billing profile scope. - * @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. @@ -786,12 +851,12 @@ private Mono>> createOrUpdateByBillingProfileWithRespo @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, BillingProfilePolicyInner> beginCreateOrUpdateByBillingProfileAsync(String billingAccountName, String billingProfileName, - BillingProfilePolicyInner parameters, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = createOrUpdateByBillingProfileWithResponseAsync(billingAccountName, - billingProfileName, parameters, context); + BillingProfilePolicyInner parameters) { + Mono>> mono + = createOrUpdateByBillingProfileWithResponseAsync(billingAccountName, billingProfileName, parameters); return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingProfilePolicyInner.class, BillingProfilePolicyInner.class, context); + this.client.getHttpPipeline(), BillingProfilePolicyInner.class, BillingProfilePolicyInner.class, + this.client.getContext()); } /** @@ -810,8 +875,10 @@ private Mono>> createOrUpdateByBillingProfileWithRespo public SyncPoller, BillingProfilePolicyInner> beginCreateOrUpdateByBillingProfile(String billingAccountName, String billingProfileName, BillingProfilePolicyInner parameters) { - return this.beginCreateOrUpdateByBillingProfileAsync(billingAccountName, billingProfileName, parameters) - .getSyncPoller(); + Response response + = createOrUpdateByBillingProfileWithResponse(billingAccountName, billingProfileName, parameters); + return this.client.getLroResult(response, + BillingProfilePolicyInner.class, BillingProfilePolicyInner.class, Context.NONE); } /** @@ -831,9 +898,10 @@ private Mono>> createOrUpdateByBillingProfileWithRespo public SyncPoller, BillingProfilePolicyInner> beginCreateOrUpdateByBillingProfile(String billingAccountName, String billingProfileName, BillingProfilePolicyInner parameters, Context context) { - return this - .beginCreateOrUpdateByBillingProfileAsync(billingAccountName, billingProfileName, parameters, context) - .getSyncPoller(); + Response response + = createOrUpdateByBillingProfileWithResponse(billingAccountName, billingProfileName, parameters, context); + return this.client.getLroResult(response, + BillingProfilePolicyInner.class, BillingProfilePolicyInner.class, context); } /** @@ -855,27 +923,6 @@ private Mono createOrUpdateByBillingProfileAsync(Stri .flatMap(this.client::getLroFinalResultOrError); } - /** - * 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 A policy at billing profile scope. - * @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 at billing profile scope on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateByBillingProfileAsync(String billingAccountName, - String billingProfileName, BillingProfilePolicyInner parameters, Context context) { - return beginCreateOrUpdateByBillingProfileAsync(billingAccountName, billingProfileName, parameters, context) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Updates the policies for a billing profile. This operation is supported only for billing accounts with agreement * type Microsoft Customer Agreement. @@ -891,7 +938,7 @@ private Mono createOrUpdateByBillingProfileAsync(Stri @ServiceMethod(returns = ReturnType.SINGLE) public BillingProfilePolicyInner createOrUpdateByBillingProfile(String billingAccountName, String billingProfileName, BillingProfilePolicyInner parameters) { - return createOrUpdateByBillingProfileAsync(billingAccountName, billingProfileName, parameters).block(); + return beginCreateOrUpdateByBillingProfile(billingAccountName, billingProfileName, parameters).getFinalResult(); } /** @@ -910,7 +957,8 @@ public BillingProfilePolicyInner createOrUpdateByBillingProfile(String billingAc @ServiceMethod(returns = ReturnType.SINGLE) public BillingProfilePolicyInner createOrUpdateByBillingProfile(String billingAccountName, String billingProfileName, BillingProfilePolicyInner parameters, Context context) { - return createOrUpdateByBillingProfileAsync(billingAccountName, billingProfileName, parameters, context).block(); + return beginCreateOrUpdateByBillingProfile(billingAccountName, billingProfileName, parameters, context) + .getFinalResult(); } /** @@ -945,38 +993,6 @@ public BillingProfilePolicyInner createOrUpdateByBillingProfile(String billingAc .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Lists the policies for a customer at billing account scope. 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 a policy at customer scope along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByCustomerAtBillingAccountWithResponseAsync( - 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByCustomerAtBillingAccount(this.client.getEndpoint(), billingAccountName, customerName, - this.client.getApiVersion(), accept, context); - } - /** * Lists the policies for a customer at billing account scope. This operation is supported only for billing accounts * with agreement type Microsoft Partner Agreement. @@ -1010,7 +1026,22 @@ private Mono getByCustomerAtBillingAccountAsync(String bill @ServiceMethod(returns = ReturnType.SINGLE) public Response getByCustomerAtBillingAccountWithResponse(String billingAccountName, String customerName, Context context) { - return getByCustomerAtBillingAccountWithResponseAsync(billingAccountName, customerName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByCustomerAtBillingAccountSync(this.client.getEndpoint(), billingAccountName, customerName, + this.client.getApiVersion(), accept, context); } /** @@ -1074,35 +1105,36 @@ private Mono>> createOrUpdateByCustomerAtBillingAccoun * @param billingAccountName The ID that uniquely identifies a billing account. * @param customerName The ID that uniquely identifies a customer. * @param parameters A policy at customer scope. - * @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 at customer scope along with {@link Response} on successful completion of {@link Mono}. + * @return a policy at customer scope along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateByCustomerAtBillingAccountWithResponseAsync( - String billingAccountName, String customerName, CustomerPolicyInner parameters, Context context) { + private Response createOrUpdateByCustomerAtBillingAccountWithResponse(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdateByCustomerAtBillingAccount(this.client.getEndpoint(), billingAccountName, - customerName, this.client.getApiVersion(), parameters, accept, context); + return service.createOrUpdateByCustomerAtBillingAccountSync(this.client.getEndpoint(), billingAccountName, + customerName, this.client.getApiVersion(), parameters, accept, Context.NONE); } /** @@ -1112,19 +1144,37 @@ private Mono>> createOrUpdateByCustomerAtBillingAccoun * @param billingAccountName The ID that uniquely identifies a billing account. * @param customerName The ID that uniquely identifies a customer. * @param parameters A policy at customer scope. + * @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 {@link PollerFlux} for polling of a policy at customer scope. + * @return a policy at customer scope along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, CustomerPolicyInner> - beginCreateOrUpdateByCustomerAtBillingAccountAsync(String billingAccountName, String customerName, - CustomerPolicyInner parameters) { - Mono>> mono - = createOrUpdateByCustomerAtBillingAccountWithResponseAsync(billingAccountName, customerName, parameters); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), - CustomerPolicyInner.class, CustomerPolicyInner.class, this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateByCustomerAtBillingAccountWithResponse(String billingAccountName, + String customerName, CustomerPolicyInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.createOrUpdateByCustomerAtBillingAccountSync(this.client.getEndpoint(), billingAccountName, + customerName, this.client.getApiVersion(), parameters, accept, context); } /** @@ -1134,7 +1184,6 @@ private Mono>> createOrUpdateByCustomerAtBillingAccoun * @param billingAccountName The ID that uniquely identifies a billing account. * @param customerName The ID that uniquely identifies a customer. * @param parameters A policy at customer scope. - * @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. @@ -1143,12 +1192,11 @@ private Mono>> createOrUpdateByCustomerAtBillingAccoun @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, CustomerPolicyInner> beginCreateOrUpdateByCustomerAtBillingAccountAsync(String billingAccountName, String customerName, - CustomerPolicyInner parameters, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = createOrUpdateByCustomerAtBillingAccountWithResponseAsync( - billingAccountName, customerName, parameters, context); + CustomerPolicyInner parameters) { + Mono>> mono + = createOrUpdateByCustomerAtBillingAccountWithResponseAsync(billingAccountName, customerName, parameters); return this.client.getLroResult(mono, this.client.getHttpPipeline(), - CustomerPolicyInner.class, CustomerPolicyInner.class, context); + CustomerPolicyInner.class, CustomerPolicyInner.class, this.client.getContext()); } /** @@ -1167,8 +1215,10 @@ private Mono>> createOrUpdateByCustomerAtBillingAccoun public SyncPoller, CustomerPolicyInner> beginCreateOrUpdateByCustomerAtBillingAccount(String billingAccountName, String customerName, CustomerPolicyInner parameters) { - return this.beginCreateOrUpdateByCustomerAtBillingAccountAsync(billingAccountName, customerName, parameters) - .getSyncPoller(); + Response response + = createOrUpdateByCustomerAtBillingAccountWithResponse(billingAccountName, customerName, parameters); + return this.client.getLroResult(response, CustomerPolicyInner.class, + CustomerPolicyInner.class, Context.NONE); } /** @@ -1188,9 +1238,10 @@ private Mono>> createOrUpdateByCustomerAtBillingAccoun public SyncPoller, CustomerPolicyInner> beginCreateOrUpdateByCustomerAtBillingAccount(String billingAccountName, String customerName, CustomerPolicyInner parameters, Context context) { - return this - .beginCreateOrUpdateByCustomerAtBillingAccountAsync(billingAccountName, customerName, parameters, context) - .getSyncPoller(); + Response response = createOrUpdateByCustomerAtBillingAccountWithResponse(billingAccountName, + customerName, parameters, context); + return this.client.getLroResult(response, CustomerPolicyInner.class, + CustomerPolicyInner.class, context); } /** @@ -1212,27 +1263,6 @@ private Mono createOrUpdateByCustomerAtBillingAccountAsync( .flatMap(this.client::getLroFinalResultOrError); } - /** - * Updates the policies for a customer at billing account scope. 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 A policy at customer scope. - * @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 at customer scope on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateByCustomerAtBillingAccountAsync(String billingAccountName, - String customerName, CustomerPolicyInner parameters, Context context) { - return beginCreateOrUpdateByCustomerAtBillingAccountAsync(billingAccountName, customerName, parameters, context) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Updates the policies for a customer at billing account scope. This operation is supported only for billing * accounts with agreement type Microsoft Partner Agreement. @@ -1248,7 +1278,8 @@ private Mono createOrUpdateByCustomerAtBillingAccountAsync( @ServiceMethod(returns = ReturnType.SINGLE) public CustomerPolicyInner createOrUpdateByCustomerAtBillingAccount(String billingAccountName, String customerName, CustomerPolicyInner parameters) { - return createOrUpdateByCustomerAtBillingAccountAsync(billingAccountName, customerName, parameters).block(); + return beginCreateOrUpdateByCustomerAtBillingAccount(billingAccountName, customerName, parameters) + .getFinalResult(); } /** @@ -1267,8 +1298,8 @@ public CustomerPolicyInner createOrUpdateByCustomerAtBillingAccount(String billi @ServiceMethod(returns = ReturnType.SINGLE) public CustomerPolicyInner createOrUpdateByCustomerAtBillingAccount(String billingAccountName, String customerName, CustomerPolicyInner parameters, Context context) { - return createOrUpdateByCustomerAtBillingAccountAsync(billingAccountName, customerName, parameters, context) - .block(); + return beginCreateOrUpdateByCustomerAtBillingAccount(billingAccountName, customerName, parameters, context) + .getFinalResult(); } /** @@ -1298,34 +1329,6 @@ private Mono> getByBillingAccountWithRespons .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Get the policies for a billing account of Enterprise Agreement type. - * - * @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 policies for a billing account of Enterprise Agreement type along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByBillingAccountWithResponseAsync(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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByBillingAccount(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), - accept, context); - } - /** * Get the policies for a billing account of Enterprise Agreement type. * @@ -1354,7 +1357,18 @@ private Mono getByBillingAccountAsync(String billingA @ServiceMethod(returns = ReturnType.SINGLE) public Response getByBillingAccountWithResponse(String billingAccountName, Context context) { - return getByBillingAccountWithResponseAsync(billingAccountName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByBillingAccountSync(this.client.getEndpoint(), billingAccountName, + this.client.getApiVersion(), accept, context); } /** @@ -1409,32 +1423,32 @@ private Mono>> createOrUpdateByBillingAccountWithRespo * * @param billingAccountName The ID that uniquely identifies a billing account. * @param parameters A policy at billing account scope. - * @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 at billing account scope along with {@link Response} on successful completion of {@link Mono}. + * @return a policy at billing account scope along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateByBillingAccountWithResponseAsync(String billingAccountName, - BillingAccountPolicyInner parameters, Context context) { + private Response createOrUpdateByBillingAccountWithResponse(String billingAccountName, + BillingAccountPolicyInner parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.createOrUpdateByBillingAccount(this.client.getEndpoint(), billingAccountName, - this.client.getApiVersion(), parameters, accept, context); + return service.createOrUpdateByBillingAccountSync(this.client.getEndpoint(), billingAccountName, + this.client.getApiVersion(), parameters, accept, Context.NONE); } /** @@ -1442,19 +1456,33 @@ private Mono>> createOrUpdateByBillingAccountWithRespo * * @param billingAccountName The ID that uniquely identifies a billing account. * @param parameters A policy at billing account scope. + * @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 {@link PollerFlux} for polling of a policy at billing account scope. + * @return a policy at billing account scope along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, BillingAccountPolicyInner> - beginCreateOrUpdateByBillingAccountAsync(String billingAccountName, BillingAccountPolicyInner parameters) { - Mono>> mono - = createOrUpdateByBillingAccountWithResponseAsync(billingAccountName, parameters); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingAccountPolicyInner.class, BillingAccountPolicyInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateByBillingAccountWithResponse(String billingAccountName, + BillingAccountPolicyInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.createOrUpdateByBillingAccountSync(this.client.getEndpoint(), billingAccountName, + this.client.getApiVersion(), parameters, accept, context); } /** @@ -1462,7 +1490,6 @@ private Mono>> createOrUpdateByBillingAccountWithRespo * * @param billingAccountName The ID that uniquely identifies a billing account. * @param parameters A policy at billing account scope. - * @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. @@ -1470,13 +1497,12 @@ private Mono>> createOrUpdateByBillingAccountWithRespo */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, BillingAccountPolicyInner> - beginCreateOrUpdateByBillingAccountAsync(String billingAccountName, BillingAccountPolicyInner parameters, - Context context) { - context = this.client.mergeContext(context); + beginCreateOrUpdateByBillingAccountAsync(String billingAccountName, BillingAccountPolicyInner parameters) { Mono>> mono - = createOrUpdateByBillingAccountWithResponseAsync(billingAccountName, parameters, context); + = createOrUpdateByBillingAccountWithResponseAsync(billingAccountName, parameters); return this.client.getLroResult(mono, - this.client.getHttpPipeline(), BillingAccountPolicyInner.class, BillingAccountPolicyInner.class, context); + this.client.getHttpPipeline(), BillingAccountPolicyInner.class, BillingAccountPolicyInner.class, + this.client.getContext()); } /** @@ -1492,7 +1518,9 @@ private Mono>> createOrUpdateByBillingAccountWithRespo @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, BillingAccountPolicyInner> beginCreateOrUpdateByBillingAccount(String billingAccountName, BillingAccountPolicyInner parameters) { - return this.beginCreateOrUpdateByBillingAccountAsync(billingAccountName, parameters).getSyncPoller(); + Response response = createOrUpdateByBillingAccountWithResponse(billingAccountName, parameters); + return this.client.getLroResult(response, + BillingAccountPolicyInner.class, BillingAccountPolicyInner.class, Context.NONE); } /** @@ -1510,7 +1538,10 @@ private Mono>> createOrUpdateByBillingAccountWithRespo public SyncPoller, BillingAccountPolicyInner> beginCreateOrUpdateByBillingAccount(String billingAccountName, BillingAccountPolicyInner parameters, Context context) { - return this.beginCreateOrUpdateByBillingAccountAsync(billingAccountName, parameters, context).getSyncPoller(); + Response response + = createOrUpdateByBillingAccountWithResponse(billingAccountName, parameters, context); + return this.client.getLroResult(response, + BillingAccountPolicyInner.class, BillingAccountPolicyInner.class, context); } /** @@ -1530,24 +1561,6 @@ private Mono createOrUpdateByBillingAccountAsync(Stri .flatMap(this.client::getLroFinalResultOrError); } - /** - * Update the policies for a billing account of Enterprise Agreement type. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param parameters A policy at billing account scope. - * @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 at billing account scope on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateByBillingAccountAsync(String billingAccountName, - BillingAccountPolicyInner parameters, Context context) { - return beginCreateOrUpdateByBillingAccountAsync(billingAccountName, parameters, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Update the policies for a billing account of Enterprise Agreement type. * @@ -1561,7 +1574,7 @@ private Mono createOrUpdateByBillingAccountAsync(Stri @ServiceMethod(returns = ReturnType.SINGLE) public BillingAccountPolicyInner createOrUpdateByBillingAccount(String billingAccountName, BillingAccountPolicyInner parameters) { - return createOrUpdateByBillingAccountAsync(billingAccountName, parameters).block(); + return beginCreateOrUpdateByBillingAccount(billingAccountName, parameters).getFinalResult(); } /** @@ -1578,7 +1591,7 @@ public BillingAccountPolicyInner createOrUpdateByBillingAccount(String billingAc @ServiceMethod(returns = ReturnType.SINGLE) public BillingAccountPolicyInner createOrUpdateByBillingAccount(String billingAccountName, BillingAccountPolicyInner parameters, Context context) { - return createOrUpdateByBillingAccountAsync(billingAccountName, parameters, context).block(); + return beginCreateOrUpdateByBillingAccount(billingAccountName, parameters, context).getFinalResult(); } /** @@ -1606,32 +1619,6 @@ private Mono> getBySubscriptionWithResponseAsy .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Lists the policies that are managed by the Billing Admin for the defined subscriptions. This is supported for - * Microsoft Online Services Program, Microsoft Customer Agreement and Microsoft Partner 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 a policy at subscription scope along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getBySubscriptionWithResponseAsync(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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.getBySubscription(this.client.getEndpoint(), this.client.getSubscriptionId(), - this.client.getApiVersion(), accept, context); - } - /** * Lists the policies that are managed by the Billing Admin for the defined subscriptions. This is supported for * Microsoft Online Services Program, Microsoft Customer Agreement and Microsoft Partner Agreement. @@ -1657,7 +1644,19 @@ private Mono getBySubscriptionAsync() { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getBySubscriptionWithResponse(Context context) { - return getBySubscriptionWithResponseAsync(context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getBySubscriptionSync(this.client.getEndpoint(), this.client.getSubscriptionId(), + this.client.getApiVersion(), accept, context); } /** @@ -1672,4 +1671,6 @@ public Response getBySubscriptionWithResponse(Context c public SubscriptionPolicyInner getBySubscription() { return getBySubscriptionWithResponse(Context.NONE).getValue(); } + + private static final ClientLogger LOGGER = new ClientLogger(PoliciesClientImpl.class); } 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 index 4061c53a5139..1ae568cebbfd 100644 --- 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 @@ -27,8 +27,10 @@ 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.BinaryData; 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.ProductsClient; @@ -84,6 +86,18 @@ Mono> listByInvoiceSection(@HostParam("$host") Strin @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, @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) + Response listByInvoiceSectionSync(@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, @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, + @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/products") @ExpectedResponses({ 200 }) @@ -95,6 +109,17 @@ Mono> listByBillingProfile(@HostParam("$host") Strin @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, @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) + Response listByBillingProfileSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @QueryParam("api-version") String apiVersion, + @QueryParam("filter") String filter, @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, + @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/products") @ExpectedResponses({ 200 }) @@ -106,6 +131,17 @@ Mono> listByCustomer(@HostParam("$host") String endp @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerName}/products") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByCustomerSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @PathParam("customerName") String customerName, + @QueryParam("api-version") String apiVersion, @QueryParam("filter") String filter, + @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, @QueryParam("skip") Long skip, + @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/move") @ExpectedResponses({ 200, 202 }) @@ -115,6 +151,15 @@ Mono>> move(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @BodyParam("application/json") MoveProductRequest 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) + Response moveSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @PathParam("productName") String productName, + @QueryParam("api-version") String apiVersion, @BodyParam("application/json") MoveProductRequest parameters, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}/validateMoveEligibility") @ExpectedResponses({ 200 }) @@ -124,6 +169,15 @@ Mono> validateMoveEligibility(@HostP @QueryParam("api-version") String apiVersion, @BodyParam("application/json") MoveProductRequest 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) + Response validateMoveEligibilitySync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @PathParam("productName") String productName, + @QueryParam("api-version") String apiVersion, @BodyParam("application/json") MoveProductRequest parameters, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}") @ExpectedResponses({ 200 }) @@ -132,6 +186,14 @@ 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" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@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 }) @@ -141,6 +203,15 @@ Mono> update(@HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @BodyParam("application/json") ProductPatch parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Patch("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products/{productName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @PathParam("productName") String productName, + @QueryParam("api-version") String apiVersion, @BodyParam("application/json") ProductPatch parameters, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products") @ExpectedResponses({ 200 }) @@ -151,6 +222,16 @@ Mono> listByBillingAccount(@HostParam("$host") Strin @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @QueryParam("api-version") String apiVersion, + @QueryParam("filter") String filter, @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, + @QueryParam("skip") Long skip, @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -159,6 +240,14 @@ 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) + Response listByInvoiceSectionNextSync( + @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 }) @@ -167,6 +256,14 @@ 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) + Response listByBillingProfileNextSync( + @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 }) @@ -175,6 +272,14 @@ 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) + Response listByCustomerNextSync( + @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 }) @@ -182,6 +287,14 @@ Mono> listByCustomerNext( 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) + Response listByBillingAccountNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -238,60 +351,6 @@ private Mono> listByInvoiceSectionSinglePageAsync(St .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 The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByInvoiceSectionSinglePageAsync(String billingAccountName, - String billingProfileName, String invoiceSectionName, String filter, String orderBy, Long top, Long skip, - Boolean count, String search, 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByInvoiceSection(this.client.getEndpoint(), billingAccountName, billingProfileName, invoiceSectionName, - this.client.getApiVersion(), filter, orderBy, top, skip, count, search, 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. @@ -351,6 +410,58 @@ private PagedFlux listByInvoiceSectionAsync(String billingAccountN 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 The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceSectionSinglePage(String billingAccountName, + String billingProfileName, String invoiceSectionName, String filter, String orderBy, Long top, Long skip, + Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByInvoiceSectionSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, invoiceSectionName, this.client.getApiVersion(), filter, orderBy, + top, skip, count, search, accept, Context.NONE); + return 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. @@ -373,16 +484,35 @@ private PagedFlux listByInvoiceSectionAsync(String billingAccountN * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, - String invoiceSectionName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, - Context context) { - return new PagedFlux<>( - () -> listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName, - filter, orderBy, top, skip, count, search, context), - nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceSectionSinglePage(String billingAccountName, + String billingProfileName, String invoiceSectionName, String filter, String orderBy, Long top, Long skip, + Boolean count, String search, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByInvoiceSectionSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, invoiceSectionName, this.client.getApiVersion(), filter, orderBy, + top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -406,8 +536,9 @@ public PagedIterable listByInvoiceSection(String billingAccountNam final Long skip = null; final Boolean count = null; final String search = null; - return new PagedIterable<>(listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, - filter, orderBy, top, skip, count, search)); + return new PagedIterable<>(() -> listByInvoiceSectionSinglePage(billingAccountName, billingProfileName, + invoiceSectionName, filter, orderBy, top, skip, count, search), + nextLink -> listByInvoiceSectionNextSinglePage(nextLink)); } /** @@ -438,8 +569,10 @@ public PagedIterable listByInvoiceSection(String billingAccountNam public PagedIterable listByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, - filter, orderBy, top, skip, count, search, context)); + return new PagedIterable<>( + () -> listByInvoiceSectionSinglePage(billingAccountName, billingProfileName, invoiceSectionName, filter, + orderBy, top, skip, count, search, context), + nextLink -> listByInvoiceSectionNextSinglePage(nextLink, context)); } /** @@ -490,55 +623,6 @@ private Mono> listByBillingProfileSinglePageAsync(St .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 The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingProfileSinglePageAsync(String billingAccountName, - String billingProfileName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, - 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingProfile(this.client.getEndpoint(), billingAccountName, billingProfileName, - this.client.getApiVersion(), filter, orderBy, top, skip, count, search, 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. @@ -591,6 +675,52 @@ private PagedFlux listByBillingProfileAsync(String billingAccountN orderBy, top, skip, count, search), 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 The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, + String billingProfileName, String filter, String orderBy, Long top, Long skip, Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingProfileSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, Context.NONE); + return 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. @@ -612,14 +742,31 @@ private PagedFlux listByBillingProfileAsync(String billingAccountN * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingProfileAsync(String billingAccountName, String billingProfileName, - String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>(() -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, filter, - orderBy, top, skip, count, search, context), - nextLink -> listByBillingProfileNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, + String billingProfileName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingProfileSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -641,8 +788,8 @@ public PagedIterable listByBillingProfile(String billingAccountNam final Long skip = null; final Boolean count = null; final String search = null; - return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, filter, orderBy, - top, skip, count, search)); + return new PagedIterable<>(() -> listByBillingProfileSinglePage(billingAccountName, billingProfileName, filter, + orderBy, top, skip, count, search), nextLink -> listByBillingProfileNextSinglePage(nextLink)); } /** @@ -671,8 +818,9 @@ public PagedIterable listByBillingProfile(String billingAccountNam @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, filter, orderBy, - top, skip, count, search, context)); + return new PagedIterable<>(() -> listByBillingProfileSinglePage(billingAccountName, billingProfileName, filter, + orderBy, top, skip, count, search, context), + nextLink -> listByBillingProfileNextSinglePage(nextLink, context)); } /** @@ -721,54 +869,6 @@ private Mono> listByCustomerSinglePageAsync(String b .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 filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByCustomerSinglePageAsync(String billingAccountName, - String customerName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, - 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByCustomer(this.client.getEndpoint(), billingAccountName, customerName, this.client.getApiVersion(), - filter, orderBy, top, skip, count, search, 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. @@ -821,6 +921,51 @@ private PagedFlux listByCustomerAsync(String billingAccountName, S top, skip, count, search), 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 filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerSinglePage(String billingAccountName, String customerName, + String filter, String orderBy, Long top, Long skip, Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByCustomerSync(this.client.getEndpoint(), billingAccountName, + customerName, this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, Context.NONE); + return 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. @@ -842,13 +987,29 @@ private PagedFlux listByCustomerAsync(String billingAccountName, S * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByCustomerAsync(String billingAccountName, String customerName, String filter, - String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>(() -> listByCustomerSinglePageAsync(billingAccountName, customerName, filter, orderBy, - top, skip, count, search, context), nextLink -> listByCustomerNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerSinglePage(String billingAccountName, String customerName, + String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByCustomerSync(this.client.getEndpoint(), billingAccountName, + customerName, this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -871,7 +1032,8 @@ public PagedIterable listByCustomer(String billingAccountName, Str final Boolean count = null; final String search = null; return new PagedIterable<>( - listByCustomerAsync(billingAccountName, customerName, filter, orderBy, top, skip, count, search)); + () -> listByCustomerSinglePage(billingAccountName, customerName, filter, orderBy, top, skip, count, search), + nextLink -> listByCustomerNextSinglePage(nextLink)); } /** @@ -900,8 +1062,8 @@ public PagedIterable listByCustomer(String billingAccountName, Str @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByCustomer(String billingAccountName, String customerName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>( - listByCustomerAsync(billingAccountName, customerName, filter, orderBy, top, skip, count, search, context)); + return new PagedIterable<>(() -> listByCustomerSinglePage(billingAccountName, customerName, filter, orderBy, + top, skip, count, search, context), nextLink -> listByCustomerNextSinglePage(nextLink, context)); } /** @@ -951,35 +1113,36 @@ private Mono>> moveWithResponseAsync(String billingAcc * @param billingAccountName The ID that uniquely identifies a billing account. * @param productName The ID that uniquely identifies a product. * @param parameters The properties of the product to initiate a transfer. - * @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 along with {@link Response} on successful completion of {@link Mono}. + * @return a product along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> moveWithResponseAsync(String billingAccountName, String productName, - MoveProductRequest parameters, Context context) { + private Response moveWithResponse(String billingAccountName, String productName, + MoveProductRequest parameters) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); } else { parameters.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.move(this.client.getEndpoint(), billingAccountName, productName, this.client.getApiVersion(), - parameters, accept, context); + return service.moveSync(this.client.getEndpoint(), billingAccountName, productName, this.client.getApiVersion(), + parameters, accept, Context.NONE); } /** @@ -990,17 +1153,37 @@ private Mono>> moveWithResponseAsync(String billingAcc * @param billingAccountName The ID that uniquely identifies a billing account. * @param productName The ID that uniquely identifies a product. * @param parameters The properties of the product to initiate a transfer. + * @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 {@link PollerFlux} for polling of a product. + * @return a product along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ProductInner> beginMoveAsync(String billingAccountName, - String productName, MoveProductRequest parameters) { - Mono>> mono = moveWithResponseAsync(billingAccountName, productName, parameters); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), - ProductInner.class, ProductInner.class, this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response moveWithResponse(String billingAccountName, String productName, + MoveProductRequest parameters, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (productName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.moveSync(this.client.getEndpoint(), billingAccountName, productName, this.client.getApiVersion(), + parameters, accept, context); } /** @@ -1011,7 +1194,6 @@ private PollerFlux, ProductInner> beginMoveAsync(String * @param billingAccountName The ID that uniquely identifies a billing account. * @param productName The ID that uniquely identifies a product. * @param parameters The properties of the product to initiate a transfer. - * @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. @@ -1019,12 +1201,10 @@ private PollerFlux, ProductInner> beginMoveAsync(String */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, ProductInner> beginMoveAsync(String billingAccountName, - String productName, MoveProductRequest parameters, Context context) { - context = this.client.mergeContext(context); - Mono>> mono - = moveWithResponseAsync(billingAccountName, productName, parameters, context); + String productName, MoveProductRequest parameters) { + Mono>> mono = moveWithResponseAsync(billingAccountName, productName, parameters); return this.client.getLroResult(mono, this.client.getHttpPipeline(), - ProductInner.class, ProductInner.class, context); + ProductInner.class, ProductInner.class, this.client.getContext()); } /** @@ -1043,7 +1223,9 @@ private PollerFlux, ProductInner> beginMoveAsync(String @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ProductInner> beginMove(String billingAccountName, String productName, MoveProductRequest parameters) { - return this.beginMoveAsync(billingAccountName, productName, parameters).getSyncPoller(); + Response response = moveWithResponse(billingAccountName, productName, parameters); + return this.client.getLroResult(response, ProductInner.class, ProductInner.class, + Context.NONE); } /** @@ -1063,7 +1245,9 @@ public SyncPoller, ProductInner> beginMove(String billi @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ProductInner> beginMove(String billingAccountName, String productName, MoveProductRequest parameters, Context context) { - return this.beginMoveAsync(billingAccountName, productName, parameters, context).getSyncPoller(); + Response response = moveWithResponse(billingAccountName, productName, parameters, context); + return this.client.getLroResult(response, ProductInner.class, ProductInner.class, + context); } /** @@ -1085,27 +1269,6 @@ private Mono moveAsync(String billingAccountName, String productNa .flatMap(this.client::getLroFinalResultOrError); } - /** - * 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 The properties of the product to initiate a transfer. - * @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 on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono moveAsync(String billingAccountName, String productName, MoveProductRequest parameters, - Context context) { - return beginMoveAsync(billingAccountName, productName, parameters, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * 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 @@ -1121,7 +1284,7 @@ private Mono moveAsync(String billingAccountName, String productNa */ @ServiceMethod(returns = ReturnType.SINGLE) public ProductInner move(String billingAccountName, String productName, MoveProductRequest parameters) { - return moveAsync(billingAccountName, productName, parameters).block(); + return beginMove(billingAccountName, productName, parameters).getFinalResult(); } /** @@ -1141,7 +1304,7 @@ public ProductInner move(String billingAccountName, String productName, MoveProd @ServiceMethod(returns = ReturnType.SINGLE) public ProductInner move(String billingAccountName, String productName, MoveProductRequest parameters, Context context) { - return moveAsync(billingAccountName, productName, parameters, context).block(); + return beginMove(billingAccountName, productName, parameters, context).getFinalResult(); } /** @@ -1184,46 +1347,6 @@ private Mono> validateMoveEligibilit .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 The properties of the product to initiate a transfer. - * @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 along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> validateMoveEligibilityWithResponseAsync( - String billingAccountName, String productName, MoveProductRequest 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.validateMoveEligibility(this.client.getEndpoint(), billingAccountName, productName, - this.client.getApiVersion(), 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 @@ -1261,7 +1384,28 @@ private Mono validateMoveEligibilityAsync(Str @ServiceMethod(returns = ReturnType.SINGLE) public Response validateMoveEligibilityWithResponse(String billingAccountName, String productName, MoveProductRequest parameters, Context context) { - return validateMoveEligibilityWithResponseAsync(billingAccountName, productName, parameters, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (productName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.validateMoveEligibilitySync(this.client.getEndpoint(), billingAccountName, productName, + this.client.getApiVersion(), parameters, accept, context); } /** @@ -1315,38 +1459,6 @@ private Mono> getWithResponseAsync(String billingAccountN .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 along with {@link Response} on successful completion of {@link Mono}. - */ - @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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), billingAccountName, productName, this.client.getApiVersion(), - accept, context); - } - /** * Gets a product by ID. The operation is supported only for billing accounts with agreement type Microsoft Customer * Agreement. @@ -1377,7 +1489,22 @@ private Mono getAsync(String billingAccountName, String productNam */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String billingAccountName, String productName, Context context) { - return getWithResponseAsync(billingAccountName, productName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (productName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), billingAccountName, productName, this.client.getApiVersion(), + accept, context); } /** @@ -1434,44 +1561,6 @@ private Mono> updateWithResponseAsync(String billingAccou .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 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 along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync(String billingAccountName, String productName, - ProductPatch 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.update(this.client.getEndpoint(), billingAccountName, productName, this.client.getApiVersion(), - 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. @@ -1506,7 +1595,28 @@ private Mono updateAsync(String billingAccountName, String product @ServiceMethod(returns = ReturnType.SINGLE) public Response updateWithResponse(String billingAccountName, String productName, ProductPatch parameters, Context context) { - return updateWithResponseAsync(billingAccountName, productName, parameters, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (productName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter productName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), billingAccountName, productName, + this.client.getApiVersion(), parameters, accept, context); } /** @@ -1568,49 +1678,6 @@ private Mono> listByBillingAccountSinglePageAsync(St .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 The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountSinglePageAsync(String billingAccountName, - String filter, String orderBy, Long top, Long skip, Boolean count, String search, 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingAccount(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), filter, - orderBy, top, skip, count, search, 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. @@ -1663,6 +1730,47 @@ private PagedFlux listByBillingAccountAsync(String billingAccountN 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 The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, String filter, + String orderBy, Long top, Long skip, Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountSync(this.client.getEndpoint(), billingAccountName, + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, Context.NONE); + return 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. @@ -1683,13 +1791,26 @@ private PagedFlux listByBillingAccountAsync(String billingAccountN * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName, String filter, String orderBy, - Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>(() -> listByBillingAccountSinglePageAsync(billingAccountName, filter, orderBy, top, skip, - count, search, context), nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, String filter, + String orderBy, Long top, Long skip, Boolean count, String search, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountSync(this.client.getEndpoint(), billingAccountName, + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1711,7 +1832,8 @@ public PagedIterable listByBillingAccount(String billingAccountNam final Boolean count = null; final String search = null; return new PagedIterable<>( - listByBillingAccountAsync(billingAccountName, filter, orderBy, top, skip, count, search)); + () -> listByBillingAccountSinglePage(billingAccountName, filter, orderBy, top, skip, count, search), + nextLink -> listByBillingAccountNextSinglePage(nextLink)); } /** @@ -1739,8 +1861,8 @@ public PagedIterable listByBillingAccount(String billingAccountNam @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingAccount(String billingAccountName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>( - listByBillingAccountAsync(billingAccountName, filter, orderBy, top, skip, count, search, context)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, filter, orderBy, top, skip, + count, search, context), nextLink -> listByBillingAccountNextSinglePage(nextLink, context)); } /** @@ -1771,6 +1893,33 @@ private Mono> listByInvoiceSectionNextSinglePageAsyn .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceSectionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByInvoiceSectionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1779,24 +1928,24 @@ private Mono> listByInvoiceSectionNextSinglePageAsyn * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByInvoiceSectionNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByInvoiceSectionNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByInvoiceSectionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1827,6 +1976,33 @@ private Mono> listByBillingProfileNextSinglePageAsyn .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1835,24 +2011,24 @@ private Mono> listByBillingProfileNextSinglePageAsyn * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingProfileNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingProfileNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1882,6 +2058,33 @@ private Mono> listByCustomerNextSinglePageAsync(Stri .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByCustomerNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1890,23 +2093,24 @@ private Mono> listByCustomerNextSinglePageAsync(Stri * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByCustomerNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listByCustomerNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByCustomerNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1937,6 +2141,33 @@ private Mono> listByBillingAccountNextSinglePageAsyn .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1945,23 +2176,25 @@ private Mono> listByBillingAccountNextSinglePageAsyn * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingAccountNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(ProductsClientImpl.class); } diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/RecipientTransfersClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/RecipientTransfersClientImpl.java index 922b616a3e63..18e568add0e7 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/RecipientTransfersClientImpl.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/RecipientTransfersClientImpl.java @@ -27,6 +27,7 @@ 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.RecipientTransfersClient; import com.azure.resourcemanager.billing.fluent.models.RecipientTransferDetailsInner; import com.azure.resourcemanager.billing.fluent.models.ValidateTransferListResponseInner; @@ -75,6 +76,15 @@ Mono> accept(@HostParam("$host") String @BodyParam("application/json") AcceptTransferRequest parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/transfers/{transferName}/accept") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response acceptSync(@HostParam("$host") String endpoint, + @PathParam("transferName") String transferName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AcceptTransferRequest parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/transfers/{transferName}/validate") @ExpectedResponses({ 200 }) @@ -84,6 +94,15 @@ Mono> validate(@HostParam("$host") S @BodyParam("application/json") AcceptTransferRequest parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/transfers/{transferName}/validate") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response validateSync(@HostParam("$host") String endpoint, + @PathParam("transferName") String transferName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AcceptTransferRequest parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/transfers/{transferName}/decline") @ExpectedResponses({ 200 }) @@ -92,6 +111,14 @@ Mono> decline(@HostParam("$host") String @PathParam("transferName") String transferName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/transfers/{transferName}/decline") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response declineSync(@HostParam("$host") String endpoint, + @PathParam("transferName") String transferName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/transfers/{transferName}") @ExpectedResponses({ 200 }) @@ -100,6 +127,14 @@ Mono> get(@HostParam("$host") String end @PathParam("transferName") String transferName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/transfers/{transferName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("transferName") String transferName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/transfers") @ExpectedResponses({ 200 }) @@ -107,6 +142,13 @@ Mono> get(@HostParam("$host") String end 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/transfers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -114,6 +156,14 @@ Mono> list(@HostParam("$host") Stri 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) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -148,38 +198,6 @@ private Mono> acceptWithResponseAsync(St .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Accepts a transfer request. - * - * @param transferName The ID that uniquely identifies a transfer request. - * @param parameters Request parameters that are provided to the accept transfer 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 details of the transfer along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> acceptWithResponseAsync(String transferName, - AcceptTransferRequest parameters, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (transferName == null) { - return Mono.error(new IllegalArgumentException("Parameter transferName 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.accept(this.client.getEndpoint(), transferName, this.client.getApiVersion(), parameters, accept, - context); - } - /** * Accepts a transfer request. * @@ -209,7 +227,24 @@ private Mono acceptAsync(String transferName, Acc @ServiceMethod(returns = ReturnType.SINGLE) public Response acceptWithResponse(String transferName, AcceptTransferRequest parameters, Context context) { - return acceptWithResponseAsync(transferName, parameters, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (transferName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter transferName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.acceptSync(this.client.getEndpoint(), transferName, this.client.getApiVersion(), parameters, + accept, context); } /** @@ -260,39 +295,6 @@ private Mono> validateWithResponseAs .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Validates if a subscription or a reservation can be transferred. Use this operation to validate your - * subscriptions or reservation before using the accept transfer operation. - * - * @param transferName The ID that uniquely identifies a transfer request. - * @param parameters Request parameters that are provided to the validate transfer 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 transfer validation along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> validateWithResponseAsync(String transferName, - AcceptTransferRequest parameters, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (transferName == null) { - return Mono.error(new IllegalArgumentException("Parameter transferName 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.validate(this.client.getEndpoint(), transferName, this.client.getApiVersion(), parameters, - accept, context); - } - /** * Validates if a subscription or a reservation can be transferred. Use this operation to validate your * subscriptions or reservation before using the accept transfer operation. @@ -325,7 +327,24 @@ private Mono validateAsync(String transferNam @ServiceMethod(returns = ReturnType.SINGLE) public Response validateWithResponse(String transferName, AcceptTransferRequest parameters, Context context) { - return validateWithResponseAsync(transferName, parameters, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (transferName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter transferName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.validateSync(this.client.getEndpoint(), transferName, this.client.getApiVersion(), parameters, + accept, context); } /** @@ -369,31 +388,6 @@ private Mono> declineWithResponseAsync(S .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Declines a transfer request. - * - * @param transferName The ID that uniquely identifies a transfer request. - * @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 details of the transfer along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> declineWithResponseAsync(String transferName, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (transferName == null) { - return Mono.error(new IllegalArgumentException("Parameter transferName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.decline(this.client.getEndpoint(), transferName, this.client.getApiVersion(), accept, context); - } - /** * Declines a transfer request. * @@ -420,7 +414,18 @@ private Mono declineAsync(String transferName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response declineWithResponse(String transferName, Context context) { - return declineWithResponseAsync(transferName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (transferName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter transferName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.declineSync(this.client.getEndpoint(), transferName, this.client.getApiVersion(), accept, + context); } /** @@ -462,30 +467,6 @@ private Mono> getWithResponseAsync(Strin .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets a transfer request by ID. The caller must be the recipient of the transfer request. - * - * @param transferName The ID that uniquely identifies a transfer request. - * @param 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 transfer request by ID along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String transferName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (transferName == null) { - return Mono.error(new IllegalArgumentException("Parameter transferName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), transferName, this.client.getApiVersion(), accept, context); - } - /** * Gets a transfer request by ID. The caller must be the recipient of the transfer request. * @@ -512,7 +493,17 @@ private Mono getAsync(String transferName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String transferName, Context context) { - return getWithResponseAsync(transferName, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (transferName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter transferName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), transferName, this.client.getApiVersion(), accept, context); } /** @@ -555,24 +546,13 @@ private Mono> listSinglePageAsync() /** * Lists the transfer requests received by the caller. * - * @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 transfers received by caller along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return the list of transfers received by caller as paginated response with {@link PagedFlux}. */ - @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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -580,11 +560,20 @@ private Mono> listSinglePageAsync(C * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of transfers received by caller as paginated response with {@link PagedFlux}. + * @return the list of transfers received by caller along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -594,12 +583,20 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of transfers received by caller as paginated response with {@link PagedFlux}. + * @return the list of transfers received by caller along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(Context context) { - return new PagedFlux<>(() -> listSinglePageAsync(context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -611,7 +608,7 @@ private PagedFlux listAsync(Context context) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { - return new PagedIterable<>(listAsync()); + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); } /** @@ -625,7 +622,7 @@ public PagedIterable list() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { - return new PagedIterable<>(listAsync(context)); + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -654,6 +651,33 @@ private Mono> listNextSinglePageAsy .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of transfers received by caller along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -662,23 +686,25 @@ private Mono> listNextSinglePageAsy * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of transfers received by caller along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return the list of transfers received by caller along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(RecipientTransfersClientImpl.class); } diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ReservationOrdersClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ReservationOrdersClientImpl.java index 39b4d7c6d244..69a0e2aeac1d 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ReservationOrdersClientImpl.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/ReservationOrdersClientImpl.java @@ -25,6 +25,7 @@ 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.ReservationOrdersClient; import com.azure.resourcemanager.billing.fluent.models.ReservationOrderInner; import com.azure.resourcemanager.billing.models.ReservationOrderList; @@ -71,6 +72,15 @@ Mono> getByBillingAccount(@HostParam("$host") St @PathParam("reservationOrderId") String reservationOrderId, @QueryParam("expand") String expand, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/reservationOrders/{reservationOrderId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByBillingAccountSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("billingAccountName") String billingAccountName, + @PathParam("reservationOrderId") String reservationOrderId, @QueryParam("expand") String expand, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/reservationOrders") @ExpectedResponses({ 200 }) @@ -80,6 +90,15 @@ Mono> listByBillingAccount(@HostParam("$host") St @QueryParam("filter") String filter, @QueryParam("orderBy") String orderBy, @QueryParam("skiptoken") Float skiptoken, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/reservationOrders") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingAccountSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("billingAccountName") String billingAccountName, + @QueryParam("filter") String filter, @QueryParam("orderBy") String orderBy, + @QueryParam("skiptoken") Float skiptoken, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -87,6 +106,14 @@ Mono> listByBillingAccount(@HostParam("$host") St 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) + Response listByBillingAccountNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -125,42 +152,6 @@ private Mono> getByBillingAccountWithResponseAsy .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Get a specific ReservationOrder in the billing account. - * - * Get the details of the ReservationOrder in the billing account. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param reservationOrderId Order Id of the reservation. - * @param expand May be used to expand the detail information of some properties. - * @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 details of the ReservationOrder in the billing account along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByBillingAccountWithResponseAsync(String billingAccountName, - String reservationOrderId, 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 (reservationOrderId == null) { - return Mono - .error(new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByBillingAccount(this.client.getEndpoint(), this.client.getApiVersion(), billingAccountName, - reservationOrderId, expand, accept, context); - } - /** * Get a specific ReservationOrder in the billing account. * @@ -197,7 +188,22 @@ private Mono getByBillingAccountAsync(String billingAccou @ServiceMethod(returns = ReturnType.SINGLE) public Response getByBillingAccountWithResponse(String billingAccountName, String reservationOrderId, String expand, Context context) { - return getByBillingAccountWithResponseAsync(billingAccountName, reservationOrderId, expand, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (reservationOrderId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByBillingAccountSync(this.client.getEndpoint(), this.client.getApiVersion(), + billingAccountName, reservationOrderId, expand, accept, context); } /** @@ -263,30 +269,17 @@ private Mono> listByBillingAccountSinglePag * request URL. * @param orderBy The orderby query option allows clients to request resources in a particular order. * @param skiptoken The number of reservations to skip from the list before returning results. - * @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 list of ReservationOrders along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return list of ReservationOrders as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountSinglePageAsync(String billingAccountName, - String filter, String orderBy, Float skiptoken, 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingAccount(this.client.getEndpoint(), this.client.getApiVersion(), billingAccountName, filter, - orderBy, skiptoken, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBillingAccountAsync(String billingAccountName, String filter, + String orderBy, Float skiptoken) { + return new PagedFlux<>( + () -> listByBillingAccountSinglePageAsync(billingAccountName, filter, orderBy, skiptoken), + nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); } /** @@ -295,18 +288,16 @@ private Mono> listByBillingAccountSinglePag * List all the `ReservationOrders in the billing account. * * @param billingAccountName The ID that uniquely identifies a billing account. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param skiptoken The number of reservations to skip from the list before returning results. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return list of ReservationOrders as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName, String filter, - String orderBy, Float skiptoken) { + private PagedFlux listByBillingAccountAsync(String billingAccountName) { + final String filter = null; + final String orderBy = null; + final Float skiptoken = null; return new PagedFlux<>( () -> listByBillingAccountSinglePageAsync(billingAccountName, filter, orderBy, skiptoken), nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); @@ -318,19 +309,32 @@ private PagedFlux listByBillingAccountAsync(String billin * List all the `ReservationOrders in the billing account. * * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param skiptoken The number of reservations to skip from the list before returning results. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of ReservationOrders as paginated response with {@link PagedFlux}. + * @return list of ReservationOrders along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName) { - final String filter = null; - final String orderBy = null; - final Float skiptoken = null; - return new PagedFlux<>( - () -> listByBillingAccountSinglePageAsync(billingAccountName, filter, orderBy, skiptoken), - nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, + String filter, String orderBy, Float skiptoken) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingAccountSync(this.client.getEndpoint(), + this.client.getApiVersion(), billingAccountName, filter, orderBy, skiptoken, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -347,14 +351,25 @@ private PagedFlux listByBillingAccountAsync(String billin * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of ReservationOrders as paginated response with {@link PagedFlux}. + * @return list of ReservationOrders along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName, String filter, - String orderBy, Float skiptoken, Context context) { - return new PagedFlux<>( - () -> listByBillingAccountSinglePageAsync(billingAccountName, filter, orderBy, skiptoken, context), - nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, + String filter, String orderBy, Float skiptoken, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingAccountSync(this.client.getEndpoint(), + this.client.getApiVersion(), billingAccountName, filter, orderBy, skiptoken, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -373,7 +388,8 @@ public PagedIterable listByBillingAccount(String billingA final String filter = null; final String orderBy = null; final Float skiptoken = null; - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, filter, orderBy, skiptoken)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, filter, orderBy, skiptoken), + nextLink -> listByBillingAccountNextSinglePage(nextLink)); } /** @@ -395,7 +411,9 @@ public PagedIterable listByBillingAccount(String billingA @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingAccount(String billingAccountName, String filter, String orderBy, Float skiptoken, Context context) { - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, filter, orderBy, skiptoken, context)); + return new PagedIterable<>( + () -> listByBillingAccountSinglePage(billingAccountName, filter, orderBy, skiptoken, context), + nextLink -> listByBillingAccountNextSinglePage(nextLink, context)); } /** @@ -425,6 +443,33 @@ private Mono> listByBillingAccountNextSingl .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ReservationOrders along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -433,22 +478,25 @@ private Mono> listByBillingAccountNextSingl * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of ReservationOrders along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return list of ReservationOrders along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingAccountNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(ReservationOrdersClientImpl.class); } 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 index 4b6728f7d6ac..c4015efc1610 100644 --- 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 @@ -26,8 +26,10 @@ 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.BinaryData; 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.ReservationsClient; @@ -82,6 +84,17 @@ Mono> listByBillingAccount(@HostParam("$host") @QueryParam("selectedState") String selectedState, @QueryParam("take") Float take, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/reservations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingAccountSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("billingAccountName") String billingAccountName, + @QueryParam("filter") String filter, @QueryParam("orderBy") String orderBy, + @QueryParam("skiptoken") Float skiptoken, @QueryParam("refreshSummary") String refreshSummary, + @QueryParam("selectedState") String selectedState, @QueryParam("take") Float take, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/reservations") @ExpectedResponses({ 200 }) @@ -93,6 +106,17 @@ Mono> listByBillingProfile(@HostParam("$host") @QueryParam("refreshSummary") String refreshSummary, @QueryParam("selectedState") String selectedState, @QueryParam("take") Float take, @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) + Response listByBillingProfileSync(@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("skiptoken") Float skiptoken, + @QueryParam("refreshSummary") String refreshSummary, @QueryParam("selectedState") String selectedState, + @QueryParam("take") Float take, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/reservationOrders/{reservationOrderId}/reservations/{reservationId}") @ExpectedResponses({ 200 }) @@ -103,6 +127,16 @@ Mono> getByReservationOrder(@HostParam("$host") Strin @PathParam("reservationId") String reservationId, @QueryParam("expand") String expand, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/reservationOrders/{reservationOrderId}/reservations/{reservationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByReservationOrderSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("billingAccountName") String billingAccountName, + @PathParam("reservationOrderId") String reservationOrderId, + @PathParam("reservationId") String reservationId, @QueryParam("expand") String expand, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Patch("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/reservationOrders/{reservationOrderId}/reservations/{reservationId}") @ExpectedResponses({ 200, 202 }) @@ -113,6 +147,16 @@ Mono>> updateByBillingAccount(@HostParam("$host") Stri @PathParam("reservationId") String reservationId, @QueryParam("api-version") String apiVersion, @BodyParam("application/json") PatchModel body, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Patch("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/reservationOrders/{reservationOrderId}/reservations/{reservationId}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("reservationOrderId") String reservationOrderId, + @PathParam("reservationId") String reservationId, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PatchModel body, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/reservationOrders/{reservationOrderId}/reservations") @ExpectedResponses({ 200 }) @@ -122,6 +166,15 @@ Mono> listByReservationOrder(@HostParam("$host") Strin @PathParam("reservationOrderId") String reservationOrderId, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/reservationOrders/{reservationOrderId}/reservations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByReservationOrderSync(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("billingAccountName") String billingAccountName, + @PathParam("reservationOrderId") String reservationOrderId, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -130,6 +183,14 @@ 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) + Response listByBillingAccountNextSync( + @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 }) @@ -138,6 +199,14 @@ 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) + Response listByBillingProfileNextSync( + @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 }) @@ -145,6 +214,14 @@ Mono> listByBillingProfileNext( Mono> listByReservationOrderNext( @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) + Response listByReservationOrderNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -186,47 +263,6 @@ private Mono> listByBillingAccountSinglePageAsyn .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Lists the reservations in the 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 The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param skiptoken The number of reservations to skip from the list before returning results. - * @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 take The number of reservations to return in API response. - * @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 along with - * {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountSinglePageAsync(String billingAccountName, - String filter, String orderBy, Float skiptoken, String refreshSummary, String selectedState, Float take, - 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingAccount(this.client.getEndpoint(), this.client.getApiVersion(), billingAccountName, filter, - orderBy, skiptoken, refreshSummary, selectedState, take, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - /** * Lists the reservations in the billing account and the roll up counts of reservations group by provisioning * states. @@ -276,6 +312,45 @@ private PagedFlux listByBillingAccountAsync(String billingAcco refreshSummary, selectedState, take), nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); } + /** + * Lists the reservations in the 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 The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param skiptoken The number of reservations to skip from the list before returning results. + * @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 take The number of reservations to return in API response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 along with + * {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, String filter, + String orderBy, Float skiptoken, String refreshSummary, String selectedState, Float take) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingAccountSync(this.client.getEndpoint(), + this.client.getApiVersion(), billingAccountName, filter, orderBy, skiptoken, refreshSummary, selectedState, + take, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Lists the reservations in the billing account and the roll up counts of reservations group by provisioning * states. @@ -293,15 +368,27 @@ private PagedFlux listByBillingAccountAsync(String billingAcco * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if 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 as paginated - * response with {@link PagedFlux}. + * @return the list of reservations and summary of roll out count of reservations in each state along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName, String filter, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, String filter, String orderBy, Float skiptoken, String refreshSummary, String selectedState, Float take, Context context) { - return new PagedFlux<>(() -> listByBillingAccountSinglePageAsync(billingAccountName, filter, orderBy, skiptoken, - refreshSummary, selectedState, take, context), - nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountSync(this.client.getEndpoint(), this.client.getApiVersion(), + billingAccountName, filter, orderBy, skiptoken, refreshSummary, selectedState, take, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -323,8 +410,8 @@ public PagedIterable listByBillingAccount(String billingAccoun final String refreshSummary = null; final String selectedState = null; final Float take = null; - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, filter, orderBy, skiptoken, - refreshSummary, selectedState, take)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, filter, orderBy, skiptoken, + refreshSummary, selectedState, take), nextLink -> listByBillingAccountNextSinglePage(nextLink)); } /** @@ -350,8 +437,9 @@ public PagedIterable listByBillingAccount(String billingAccoun @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingAccount(String billingAccountName, String filter, String orderBy, Float skiptoken, String refreshSummary, String selectedState, Float take, Context context) { - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, filter, orderBy, skiptoken, - refreshSummary, selectedState, take, context)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, filter, orderBy, skiptoken, + refreshSummary, selectedState, take, context), + nextLink -> listByBillingAccountNextSinglePage(nextLink, context)); } /** @@ -399,51 +487,6 @@ private Mono> listByBillingProfileSinglePageAsyn .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 The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param skiptoken The number of reservations to skip from the list before returning results. - * @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 take The number of reservations to return in API response. - * @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 along with - * {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingProfileSinglePageAsync(String billingAccountName, - String billingProfileName, String filter, String orderBy, Float skiptoken, String refreshSummary, - String selectedState, Float take, 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingProfile(this.client.getEndpoint(), this.client.getApiVersion(), billingAccountName, - billingProfileName, filter, orderBy, skiptoken, refreshSummary, selectedState, take, 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. * @@ -498,6 +541,50 @@ private PagedFlux listByBillingProfileAsync(String billingAcco 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 The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param skiptoken The number of reservations to skip from the list before returning results. + * @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 take The number of reservations to return in API response. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 along with + * {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, + String billingProfileName, String filter, String orderBy, Float skiptoken, String refreshSummary, + String selectedState, Float take) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingProfileSync(this.client.getEndpoint(), + this.client.getApiVersion(), billingAccountName, billingProfileName, filter, orderBy, skiptoken, + refreshSummary, selectedState, take, accept, Context.NONE); + return 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. * @@ -515,17 +602,32 @@ private PagedFlux listByBillingProfileAsync(String billingAcco * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if 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 as paginated - * response with {@link PagedFlux}. + * @return the list of reservations and summary of roll out count of reservations in each state along with + * {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingProfileAsync(String billingAccountName, String billingProfileName, - String filter, String orderBy, Float skiptoken, String refreshSummary, String selectedState, Float take, - Context context) { - return new PagedFlux<>( - () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, filter, orderBy, - skiptoken, refreshSummary, selectedState, take, context), - nextLink -> listByBillingProfileNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, + String billingProfileName, String filter, String orderBy, Float skiptoken, String refreshSummary, + String selectedState, Float take, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingProfileSync(this.client.getEndpoint(), + this.client.getApiVersion(), billingAccountName, billingProfileName, filter, orderBy, skiptoken, + refreshSummary, selectedState, take, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -547,8 +649,9 @@ public PagedIterable listByBillingProfile(String billingAccoun final String refreshSummary = null; final String selectedState = null; final Float take = null; - return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, filter, orderBy, - skiptoken, refreshSummary, selectedState, take)); + return new PagedIterable<>(() -> listByBillingProfileSinglePage(billingAccountName, billingProfileName, filter, + orderBy, skiptoken, refreshSummary, selectedState, take), + nextLink -> listByBillingProfileNextSinglePage(nextLink)); } /** @@ -575,8 +678,10 @@ public PagedIterable listByBillingProfile(String billingAccoun public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName, String filter, String orderBy, Float skiptoken, String refreshSummary, String selectedState, Float take, Context context) { - return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, filter, orderBy, - skiptoken, refreshSummary, selectedState, take, context)); + return new PagedIterable<>( + () -> listByBillingProfileSinglePage(billingAccountName, billingProfileName, filter, orderBy, skiptoken, + refreshSummary, selectedState, take, context), + nextLink -> listByBillingProfileNextSinglePage(nextLink, context)); } /** @@ -620,46 +725,6 @@ private Mono> getByReservationOrderWithResponseAsync( .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Get Reservation details in the billing account. - * - * Get specific Reservation details in the billing account. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param reservationOrderId Order Id of the reservation. - * @param reservationId Id of the reservation item. - * @param expand May be used to expand the detail information of some properties. - * @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 specific Reservation details in the billing account along with {@link Response} on successful completion - * of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByReservationOrderWithResponseAsync(String billingAccountName, - String reservationOrderId, String reservationId, 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 (reservationOrderId == null) { - return Mono - .error(new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null.")); - } - if (reservationId == null) { - return Mono.error(new IllegalArgumentException("Parameter reservationId is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByReservationOrder(this.client.getEndpoint(), this.client.getApiVersion(), billingAccountName, - reservationOrderId, reservationId, expand, accept, context); - } - /** * Get Reservation details in the billing account. * @@ -699,8 +764,26 @@ private Mono getByReservationOrderAsync(String billingAccountN @ServiceMethod(returns = ReturnType.SINGLE) public Response getByReservationOrderWithResponse(String billingAccountName, String reservationOrderId, String reservationId, String expand, Context context) { - return getByReservationOrderWithResponseAsync(billingAccountName, reservationOrderId, reservationId, expand, - context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (reservationOrderId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null.")); + } + if (reservationId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter reservationId is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByReservationOrderSync(this.client.getEndpoint(), this.client.getApiVersion(), + billingAccountName, reservationOrderId, reservationId, expand, accept, context); } /** @@ -773,39 +856,39 @@ private Mono>> updateByBillingAccountWithResponseAsync * @param reservationOrderId Order Id of the reservation. * @param reservationId Id of the reservation item. * @param body Request body for patching a reservation. - * @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 of the reservation along with {@link Response} on successful completion of {@link Mono}. + * @return the definition of the reservation along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> updateByBillingAccountWithResponseAsync(String billingAccountName, - String reservationOrderId, String reservationId, PatchModel body, Context context) { + private Response updateByBillingAccountWithResponse(String billingAccountName, + String reservationOrderId, String reservationId, PatchModel body) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); } if (reservationOrderId == null) { - return Mono - .error(new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null.")); } if (reservationId == null) { - return Mono.error(new IllegalArgumentException("Parameter reservationId is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter reservationId is required and cannot be null.")); } if (body == null) { - return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); } else { body.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.updateByBillingAccount(this.client.getEndpoint(), billingAccountName, reservationOrderId, - reservationId, this.client.getApiVersion(), body, accept, context); + return service.updateByBillingAccountSync(this.client.getEndpoint(), billingAccountName, reservationOrderId, + reservationId, this.client.getApiVersion(), body, accept, Context.NONE); } /** @@ -815,18 +898,40 @@ private Mono>> updateByBillingAccountWithResponseAsync * @param reservationOrderId Order Id of the reservation. * @param reservationId Id of the reservation item. * @param body Request body for patching a reservation. + * @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 {@link PollerFlux} for polling of the definition of the reservation. + * @return the definition of the reservation along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ReservationInner> beginUpdateByBillingAccountAsync( - String billingAccountName, String reservationOrderId, String reservationId, PatchModel body) { - Mono>> mono - = updateByBillingAccountWithResponseAsync(billingAccountName, reservationOrderId, reservationId, body); - return this.client.getLroResult(mono, this.client.getHttpPipeline(), - ReservationInner.class, ReservationInner.class, this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateByBillingAccountWithResponse(String billingAccountName, + String reservationOrderId, String reservationId, PatchModel body, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (reservationOrderId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null.")); + } + if (reservationId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter reservationId is required and cannot be null.")); + } + if (body == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return service.updateByBillingAccountSync(this.client.getEndpoint(), billingAccountName, reservationOrderId, + reservationId, this.client.getApiVersion(), body, accept, context); } /** @@ -836,7 +941,6 @@ private PollerFlux, ReservationInner> beginUpdateBy * @param reservationOrderId Order Id of the reservation. * @param reservationId Id of the reservation item. * @param body Request body for patching a reservation. - * @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. @@ -844,12 +948,11 @@ private PollerFlux, ReservationInner> beginUpdateBy */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, ReservationInner> beginUpdateByBillingAccountAsync( - String billingAccountName, String reservationOrderId, String reservationId, PatchModel body, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = updateByBillingAccountWithResponseAsync(billingAccountName, - reservationOrderId, reservationId, body, context); + String billingAccountName, String reservationOrderId, String reservationId, PatchModel body) { + Mono>> mono + = updateByBillingAccountWithResponseAsync(billingAccountName, reservationOrderId, reservationId, body); return this.client.getLroResult(mono, this.client.getHttpPipeline(), - ReservationInner.class, ReservationInner.class, context); + ReservationInner.class, ReservationInner.class, this.client.getContext()); } /** @@ -867,8 +970,10 @@ private PollerFlux, ReservationInner> beginUpdateBy @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ReservationInner> beginUpdateByBillingAccount( String billingAccountName, String reservationOrderId, String reservationId, PatchModel body) { - return this.beginUpdateByBillingAccountAsync(billingAccountName, reservationOrderId, reservationId, body) - .getSyncPoller(); + Response response + = updateByBillingAccountWithResponse(billingAccountName, reservationOrderId, reservationId, body); + return this.client.getLroResult(response, ReservationInner.class, + ReservationInner.class, Context.NONE); } /** @@ -887,9 +992,10 @@ public SyncPoller, ReservationInner> beginUpdateByB @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ReservationInner> beginUpdateByBillingAccount( String billingAccountName, String reservationOrderId, String reservationId, PatchModel body, Context context) { - return this - .beginUpdateByBillingAccountAsync(billingAccountName, reservationOrderId, reservationId, body, context) - .getSyncPoller(); + Response response + = updateByBillingAccountWithResponse(billingAccountName, reservationOrderId, reservationId, body, context); + return this.client.getLroResult(response, ReservationInner.class, + ReservationInner.class, context); } /** @@ -911,27 +1017,6 @@ private Mono updateByBillingAccountAsync(String billingAccount .flatMap(this.client::getLroFinalResultOrError); } - /** - * Update reservation by billing account. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param reservationOrderId Order Id of the reservation. - * @param reservationId Id of the reservation item. - * @param body Request body for patching a reservation. - * @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 of the reservation on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateByBillingAccountAsync(String billingAccountName, String reservationOrderId, - String reservationId, PatchModel body, Context context) { - return beginUpdateByBillingAccountAsync(billingAccountName, reservationOrderId, reservationId, body, context) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Update reservation by billing account. * @@ -947,7 +1032,8 @@ private Mono updateByBillingAccountAsync(String billingAccount @ServiceMethod(returns = ReturnType.SINGLE) public ReservationInner updateByBillingAccount(String billingAccountName, String reservationOrderId, String reservationId, PatchModel body) { - return updateByBillingAccountAsync(billingAccountName, reservationOrderId, reservationId, body).block(); + return beginUpdateByBillingAccount(billingAccountName, reservationOrderId, reservationId, body) + .getFinalResult(); } /** @@ -966,8 +1052,8 @@ public ReservationInner updateByBillingAccount(String billingAccountName, String @ServiceMethod(returns = ReturnType.SINGLE) public ReservationInner updateByBillingAccount(String billingAccountName, String reservationOrderId, String reservationId, PatchModel body, Context context) { - return updateByBillingAccountAsync(billingAccountName, reservationOrderId, reservationId, body, context) - .block(); + return beginUpdateByBillingAccount(billingAccountName, reservationOrderId, reservationId, body, context) + .getFinalResult(); } /** @@ -1013,34 +1099,16 @@ private Mono> listByReservationOrderSinglePageAs * * @param billingAccountName The ID that uniquely identifies a billing account. * @param reservationOrderId Order Id of the reservation. - * @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 list of `Reservations along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return list of `Reservations as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByReservationOrderSinglePageAsync(String billingAccountName, - String reservationOrderId, 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 (reservationOrderId == null) { - return Mono - .error(new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByReservationOrder(this.client.getEndpoint(), this.client.getApiVersion(), billingAccountName, - reservationOrderId, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByReservationOrderAsync(String billingAccountName, + String reservationOrderId) { + return new PagedFlux<>(() -> listByReservationOrderSinglePageAsync(billingAccountName, reservationOrderId), + nextLink -> listByReservationOrderNextSinglePageAsync(nextLink)); } /** @@ -1053,13 +1121,29 @@ private Mono> listByReservationOrderSinglePageAs * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of `Reservations as paginated response with {@link PagedFlux}. + * @return list of `Reservations along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByReservationOrderAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByReservationOrderSinglePage(String billingAccountName, String reservationOrderId) { - return new PagedFlux<>(() -> listByReservationOrderSinglePageAsync(billingAccountName, reservationOrderId), - nextLink -> listByReservationOrderNextSinglePageAsync(nextLink)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (reservationOrderId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByReservationOrderSync(this.client.getEndpoint(), + this.client.getApiVersion(), billingAccountName, reservationOrderId, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1073,14 +1157,29 @@ private PagedFlux listByReservationOrderAsync(String billingAc * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of `Reservations as paginated response with {@link PagedFlux}. + * @return list of `Reservations along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByReservationOrderAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByReservationOrderSinglePage(String billingAccountName, String reservationOrderId, Context context) { - return new PagedFlux<>( - () -> listByReservationOrderSinglePageAsync(billingAccountName, reservationOrderId, context), - nextLink -> listByReservationOrderNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (reservationOrderId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByReservationOrderSync(this.client.getEndpoint(), + this.client.getApiVersion(), billingAccountName, reservationOrderId, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1098,7 +1197,8 @@ private PagedFlux listByReservationOrderAsync(String billingAc @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByReservationOrder(String billingAccountName, String reservationOrderId) { - return new PagedIterable<>(listByReservationOrderAsync(billingAccountName, reservationOrderId)); + return new PagedIterable<>(() -> listByReservationOrderSinglePage(billingAccountName, reservationOrderId), + nextLink -> listByReservationOrderNextSinglePage(nextLink)); } /** @@ -1117,7 +1217,9 @@ public PagedIterable listByReservationOrder(String billingAcco @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByReservationOrder(String billingAccountName, String reservationOrderId, Context context) { - return new PagedIterable<>(listByReservationOrderAsync(billingAccountName, reservationOrderId, context)); + return new PagedIterable<>( + () -> listByReservationOrderSinglePage(billingAccountName, reservationOrderId, context), + nextLink -> listByReservationOrderNextSinglePage(nextLink, context)); } /** @@ -1148,6 +1250,34 @@ private Mono> listByBillingAccountNextSinglePage .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 along with + * {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1157,23 +1287,24 @@ private Mono> listByBillingAccountNextSinglePage * @throws ManagementException thrown if 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 along with - * {@link PagedResponse} on successful completion of {@link Mono}. + * {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingAccountNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1204,6 +1335,34 @@ private Mono> listByBillingProfileNextSinglePage .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 along with + * {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1213,23 +1372,24 @@ private Mono> listByBillingProfileNextSinglePage * @throws ManagementException thrown if 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 along with - * {@link PagedResponse} on successful completion of {@link Mono}. + * {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingProfileNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingProfileNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1259,6 +1419,33 @@ private Mono> listByReservationOrderNextSinglePa .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of `Reservations along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByReservationOrderNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByReservationOrderNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1267,22 +1454,25 @@ private Mono> listByReservationOrderNextSinglePa * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of `Reservations along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return list of `Reservations along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByReservationOrderNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByReservationOrderNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listByReservationOrderNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listByReservationOrderNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(ReservationsClientImpl.class); } diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/SavingsPlanOrdersClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/SavingsPlanOrdersClientImpl.java index 49108f0878cf..fec0a0d4e594 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/SavingsPlanOrdersClientImpl.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/SavingsPlanOrdersClientImpl.java @@ -25,6 +25,7 @@ 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.SavingsPlanOrdersClient; import com.azure.resourcemanager.billing.fluent.models.SavingsPlanOrderModelInner; import com.azure.resourcemanager.billing.models.SavingsPlanOrderModelList; @@ -71,6 +72,15 @@ Mono> getByBillingAccount(@HostParam("$host @PathParam("savingsPlanOrderId") String savingsPlanOrderId, @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}/savingsPlanOrders/{savingsPlanOrderId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("savingsPlanOrderId") String savingsPlanOrderId, @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}/savingsPlanOrders") @ExpectedResponses({ 200 }) @@ -80,6 +90,15 @@ Mono> listByBillingAccount(@HostParam("$host @QueryParam("filter") String filter, @QueryParam("orderBy") String orderBy, @QueryParam("skiptoken") Float skiptoken, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/savingsPlanOrders") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @QueryParam("api-version") String apiVersion, + @QueryParam("filter") String filter, @QueryParam("orderBy") String orderBy, + @QueryParam("skiptoken") Float skiptoken, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -87,6 +106,14 @@ Mono> listByBillingAccount(@HostParam("$host 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) + Response listByBillingAccountNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -123,40 +150,6 @@ private Mono> getByBillingAccountWithRespon .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Get a savings plan order by billing account. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param savingsPlanOrderId Order ID of the savings plan. - * @param expand May be used to expand the planInformation. - * @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 savings plan order by billing account along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByBillingAccountWithResponseAsync(String billingAccountName, - String savingsPlanOrderId, 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 (savingsPlanOrderId == null) { - return Mono - .error(new IllegalArgumentException("Parameter savingsPlanOrderId is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByBillingAccount(this.client.getEndpoint(), billingAccountName, savingsPlanOrderId, - this.client.getApiVersion(), expand, accept, context); - } - /** * Get a savings plan order by billing account. * @@ -190,7 +183,22 @@ private Mono getByBillingAccountAsync(String billing @ServiceMethod(returns = ReturnType.SINGLE) public Response getByBillingAccountWithResponse(String billingAccountName, String savingsPlanOrderId, String expand, Context context) { - return getByBillingAccountWithResponseAsync(billingAccountName, savingsPlanOrderId, expand, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (savingsPlanOrderId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter savingsPlanOrderId is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByBillingAccountSync(this.client.getEndpoint(), billingAccountName, savingsPlanOrderId, + this.client.getApiVersion(), expand, accept, context); } /** @@ -242,40 +250,6 @@ public SavingsPlanOrderModelInner getByBillingAccount(String billingAccountName, .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * List all Savings plan orders by billing account. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param skiptoken The number of savings plans to skip from the list before returning results. - * @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 list of savings plan orders along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountSinglePageAsync( - String billingAccountName, String filter, String orderBy, Float skiptoken, 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingAccount(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), filter, - orderBy, skiptoken, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - /** * List all Savings plan orders by billing account. * @@ -316,6 +290,38 @@ private PagedFlux listByBillingAccountAsync(String b nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); } + /** + * List all Savings plan orders by billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param skiptoken The number of savings plans to skip from the list before returning results. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of savings plan orders along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, + String filter, String orderBy, Float skiptoken) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingAccountSync(this.client.getEndpoint(), + billingAccountName, this.client.getApiVersion(), filter, orderBy, skiptoken, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * List all Savings plan orders by billing account. * @@ -328,14 +334,25 @@ private PagedFlux listByBillingAccountAsync(String b * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of savings plan orders as paginated response with {@link PagedFlux}. + * @return list of savings plan orders along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName, String filter, - String orderBy, Float skiptoken, Context context) { - return new PagedFlux<>( - () -> listByBillingAccountSinglePageAsync(billingAccountName, filter, orderBy, skiptoken, context), - nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, + String filter, String orderBy, Float skiptoken, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingAccountSync(this.client.getEndpoint(), + billingAccountName, this.client.getApiVersion(), filter, orderBy, skiptoken, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -352,7 +369,8 @@ public PagedIterable listByBillingAccount(String bil final String filter = null; final String orderBy = null; final Float skiptoken = null; - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, filter, orderBy, skiptoken)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, filter, orderBy, skiptoken), + nextLink -> listByBillingAccountNextSinglePage(nextLink)); } /** @@ -372,7 +390,9 @@ public PagedIterable listByBillingAccount(String bil @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingAccount(String billingAccountName, String filter, String orderBy, Float skiptoken, Context context) { - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, filter, orderBy, skiptoken, context)); + return new PagedIterable<>( + () -> listByBillingAccountSinglePage(billingAccountName, filter, orderBy, skiptoken, context), + nextLink -> listByBillingAccountNextSinglePage(nextLink, context)); } /** @@ -402,6 +422,33 @@ private Mono> listByBillingAccountNext .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of savings plan orders along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -410,22 +457,26 @@ private Mono> listByBillingAccountNext * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of savings plan orders along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return list of savings plan orders along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountNextSinglePageAsync(String nextLink, + private PagedResponse listByBillingAccountNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(SavingsPlanOrdersClientImpl.class); } diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/SavingsPlanValidateResponseImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/SavingsPlanValidateResponseImpl.java index 894a5e216e2b..3e1687ee4b01 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/SavingsPlanValidateResponseImpl.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/SavingsPlanValidateResponseImpl.java @@ -5,8 +5,8 @@ package com.azure.resourcemanager.billing.implementation; import com.azure.resourcemanager.billing.fluent.models.SavingsPlanValidateResponseInner; -import com.azure.resourcemanager.billing.models.SavingsPlanValidateResponse; import com.azure.resourcemanager.billing.models.SavingsPlanValidResponseProperty; +import com.azure.resourcemanager.billing.models.SavingsPlanValidateResponse; import java.util.Collections; import java.util.List; diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/SavingsPlansClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/SavingsPlansClientImpl.java index ba2e676dc898..c9ccb4e56149 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/SavingsPlansClientImpl.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/SavingsPlansClientImpl.java @@ -27,8 +27,10 @@ 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.BinaryData; 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.SavingsPlansClient; @@ -83,6 +85,15 @@ Mono> listBySavingsPlanOrder(@HostParam("$host") @PathParam("savingsPlanOrderId") String savingsPlanOrderId, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySavingsPlanOrderSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("savingsPlanOrderId") String savingsPlanOrderId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/savingsPlans") @ExpectedResponses({ 200 }) @@ -94,6 +105,17 @@ Mono> listByBillingAccount(@HostParam("$hos @QueryParam("selectedState") String selectedState, @QueryParam("refreshSummary") String refreshSummary, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/savingsPlans") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @QueryParam("api-version") String apiVersion, + @QueryParam("filter") String filter, @QueryParam("orderBy") String orderBy, + @QueryParam("skiptoken") Float skiptoken, @QueryParam("take") Float take, + @QueryParam("selectedState") String selectedState, @QueryParam("refreshSummary") String refreshSummary, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}") @ExpectedResponses({ 200 }) @@ -104,6 +126,16 @@ Mono> getByBillingAccount(@HostParam("$host") St @PathParam("savingsPlanId") String savingsPlanId, @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}/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("savingsPlanOrderId") String savingsPlanOrderId, + @PathParam("savingsPlanId") String savingsPlanId, @QueryParam("api-version") String apiVersion, + @QueryParam("expand") String expand, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Patch("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}") @ExpectedResponses({ 200, 202 }) @@ -115,6 +147,17 @@ Mono>> updateByBillingAccount(@HostParam("$host") Stri @BodyParam("application/json") SavingsPlanUpdateRequest body, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Patch("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateByBillingAccountSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("savingsPlanOrderId") String savingsPlanOrderId, + @PathParam("savingsPlanId") String savingsPlanId, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SavingsPlanUpdateRequest body, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/validate") @ExpectedResponses({ 200 }) @@ -126,6 +169,17 @@ Mono> validateUpdateByBillingAccount( @BodyParam("application/json") SavingsPlanUpdateValidateRequest body, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/savingsPlanOrders/{savingsPlanOrderId}/savingsPlans/{savingsPlanId}/validate") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response validateUpdateByBillingAccountSync( + @HostParam("$host") String endpoint, @PathParam("billingAccountName") String billingAccountName, + @PathParam("savingsPlanOrderId") String savingsPlanOrderId, + @PathParam("savingsPlanId") String savingsPlanId, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SavingsPlanUpdateValidateRequest body, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -134,6 +188,14 @@ Mono> listBySavingsPlanOrderNext( @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) + Response listBySavingsPlanOrderNextSync( + @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 }) @@ -141,6 +203,14 @@ Mono> listBySavingsPlanOrderNext( 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) + Response listByBillingAccountNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -182,34 +252,16 @@ private Mono> listBySavingsPlanOrderSingleP * * @param billingAccountName The ID that uniquely identifies a billing account. * @param savingsPlanOrderId Order ID of the savings plan. - * @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 list of savings plans along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return list of savings plans as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listBySavingsPlanOrderSinglePageAsync(String billingAccountName, - String savingsPlanOrderId, 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 (savingsPlanOrderId == null) { - return Mono - .error(new IllegalArgumentException("Parameter savingsPlanOrderId is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listBySavingsPlanOrder(this.client.getEndpoint(), billingAccountName, savingsPlanOrderId, - this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySavingsPlanOrderAsync(String billingAccountName, + String savingsPlanOrderId) { + return new PagedFlux<>(() -> listBySavingsPlanOrderSinglePageAsync(billingAccountName, savingsPlanOrderId), + nextLink -> listBySavingsPlanOrderNextSinglePageAsync(nextLink)); } /** @@ -220,13 +272,29 @@ private Mono> listBySavingsPlanOrderSingleP * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of savings plans as paginated response with {@link PagedFlux}. + * @return list of savings plans along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listBySavingsPlanOrderAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySavingsPlanOrderSinglePage(String billingAccountName, String savingsPlanOrderId) { - return new PagedFlux<>(() -> listBySavingsPlanOrderSinglePageAsync(billingAccountName, savingsPlanOrderId), - nextLink -> listBySavingsPlanOrderNextSinglePageAsync(nextLink)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (savingsPlanOrderId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter savingsPlanOrderId is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listBySavingsPlanOrderSync(this.client.getEndpoint(), + billingAccountName, savingsPlanOrderId, this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -238,14 +306,29 @@ private PagedFlux listBySavingsPlanOrderAsync(String bill * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of savings plans as paginated response with {@link PagedFlux}. + * @return list of savings plans along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listBySavingsPlanOrderAsync(String billingAccountName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySavingsPlanOrderSinglePage(String billingAccountName, String savingsPlanOrderId, Context context) { - return new PagedFlux<>( - () -> listBySavingsPlanOrderSinglePageAsync(billingAccountName, savingsPlanOrderId, context), - nextLink -> listBySavingsPlanOrderNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (savingsPlanOrderId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter savingsPlanOrderId is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listBySavingsPlanOrderSync(this.client.getEndpoint(), + billingAccountName, savingsPlanOrderId, this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -261,7 +344,8 @@ private PagedFlux listBySavingsPlanOrderAsync(String bill @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listBySavingsPlanOrder(String billingAccountName, String savingsPlanOrderId) { - return new PagedIterable<>(listBySavingsPlanOrderAsync(billingAccountName, savingsPlanOrderId)); + return new PagedIterable<>(() -> listBySavingsPlanOrderSinglePage(billingAccountName, savingsPlanOrderId), + nextLink -> listBySavingsPlanOrderNextSinglePage(nextLink)); } /** @@ -278,7 +362,9 @@ public PagedIterable listBySavingsPlanOrder(String billin @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listBySavingsPlanOrder(String billingAccountName, String savingsPlanOrderId, Context context) { - return new PagedIterable<>(listBySavingsPlanOrderAsync(billingAccountName, savingsPlanOrderId, context)); + return new PagedIterable<>( + () -> listBySavingsPlanOrderSinglePage(billingAccountName, savingsPlanOrderId, context), + nextLink -> listBySavingsPlanOrderNextSinglePage(nextLink, context)); } /** @@ -319,45 +405,6 @@ private Mono> listByBillingAccountSinglePag .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * List savings plans by billing account. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param skiptoken The number of savings plans to skip from the list before returning results. - * @param take The number of savings plans to return. - * @param selectedState The selected provisioning state. - * @param refreshSummary To indicate whether to refresh the roll up counts of the savings plans group by - * provisioning states. - * @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 list of savings plans along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountSinglePageAsync(String billingAccountName, - String filter, String orderBy, Float skiptoken, Float take, String selectedState, String refreshSummary, - 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingAccount(this.client.getEndpoint(), billingAccountName, this.client.getApiVersion(), filter, - orderBy, skiptoken, take, selectedState, refreshSummary, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - /** * List savings plans by billing account. * @@ -403,6 +450,43 @@ private PagedFlux listByBillingAccountAsync(String billin take, selectedState, refreshSummary), nextLink -> listByBillingAccountNextSinglePageAsync(nextLink)); } + /** + * List savings plans by billing account. + * + * @param billingAccountName The ID that uniquely identifies a billing account. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param skiptoken The number of savings plans to skip from the list before returning results. + * @param take The number of savings plans to return. + * @param selectedState The selected provisioning state. + * @param refreshSummary To indicate whether to refresh the roll up counts of the savings plans group by + * provisioning states. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of savings plans along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, + String filter, String orderBy, Float skiptoken, Float take, String selectedState, String refreshSummary) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingAccountSync(this.client.getEndpoint(), + billingAccountName, this.client.getApiVersion(), filter, orderBy, skiptoken, take, selectedState, + refreshSummary, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * List savings plans by billing account. * @@ -419,15 +503,27 @@ private PagedFlux listByBillingAccountAsync(String billin * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of savings plans as paginated response with {@link PagedFlux}. + * @return list of savings plans along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingAccountAsync(String billingAccountName, String filter, - String orderBy, Float skiptoken, Float take, String selectedState, String refreshSummary, Context context) { - return new PagedFlux<>( - () -> listByBillingAccountSinglePageAsync(billingAccountName, filter, orderBy, skiptoken, take, - selectedState, refreshSummary, context), - nextLink -> listByBillingAccountNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountSinglePage(String billingAccountName, + String filter, String orderBy, Float skiptoken, Float take, String selectedState, String refreshSummary, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingAccountSync(this.client.getEndpoint(), + billingAccountName, this.client.getApiVersion(), filter, orderBy, skiptoken, take, selectedState, + refreshSummary, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -447,8 +543,8 @@ public PagedIterable listByBillingAccount(String billingA final Float take = null; final String selectedState = null; final String refreshSummary = null; - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, filter, orderBy, skiptoken, take, - selectedState, refreshSummary)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, filter, orderBy, skiptoken, + take, selectedState, refreshSummary), nextLink -> listByBillingAccountNextSinglePage(nextLink)); } /** @@ -472,8 +568,9 @@ public PagedIterable listByBillingAccount(String billingA @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingAccount(String billingAccountName, String filter, String orderBy, Float skiptoken, Float take, String selectedState, String refreshSummary, Context context) { - return new PagedIterable<>(listByBillingAccountAsync(billingAccountName, filter, orderBy, skiptoken, take, - selectedState, refreshSummary, context)); + return new PagedIterable<>(() -> listByBillingAccountSinglePage(billingAccountName, filter, orderBy, skiptoken, + take, selectedState, refreshSummary, context), + nextLink -> listByBillingAccountNextSinglePage(nextLink, context)); } /** @@ -513,43 +610,6 @@ private Mono> getByBillingAccountWithResponseAsy .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Get savings plan by billing account. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param savingsPlanOrderId Order ID of the savings plan. - * @param savingsPlanId ID of the savings plan. - * @param expand May be used to expand the planInformation. - * @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 savings plan by billing account along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByBillingAccountWithResponseAsync(String billingAccountName, - String savingsPlanOrderId, String savingsPlanId, 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 (savingsPlanOrderId == null) { - return Mono - .error(new IllegalArgumentException("Parameter savingsPlanOrderId is required and cannot be null.")); - } - if (savingsPlanId == null) { - return Mono.error(new IllegalArgumentException("Parameter savingsPlanId is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.getByBillingAccount(this.client.getEndpoint(), billingAccountName, savingsPlanOrderId, - savingsPlanId, this.client.getApiVersion(), expand, accept, context); - } - /** * Get savings plan by billing account. * @@ -585,8 +645,26 @@ private Mono getByBillingAccountAsync(String billingAccou @ServiceMethod(returns = ReturnType.SINGLE) public Response getByBillingAccountWithResponse(String billingAccountName, String savingsPlanOrderId, String savingsPlanId, String expand, Context context) { - return getByBillingAccountWithResponseAsync(billingAccountName, savingsPlanOrderId, savingsPlanId, expand, - context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (savingsPlanOrderId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter savingsPlanOrderId is required and cannot be null.")); + } + if (savingsPlanId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter savingsPlanId is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByBillingAccountSync(this.client.getEndpoint(), billingAccountName, savingsPlanOrderId, + savingsPlanId, this.client.getApiVersion(), expand, accept, context); } /** @@ -657,39 +735,39 @@ private Mono>> updateByBillingAccountWithResponseAsync * @param savingsPlanOrderId Order ID of the savings plan. * @param savingsPlanId ID of the savings plan. * @param body Request body for patching a savings plan order alias. - * @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 savings plan along with {@link Response} on successful completion of {@link Mono}. + * @return savings plan along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> updateByBillingAccountWithResponseAsync(String billingAccountName, - String savingsPlanOrderId, String savingsPlanId, SavingsPlanUpdateRequest body, Context context) { + private Response updateByBillingAccountWithResponse(String billingAccountName, + String savingsPlanOrderId, String savingsPlanId, SavingsPlanUpdateRequest body) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); } if (savingsPlanOrderId == null) { - return Mono - .error(new IllegalArgumentException("Parameter savingsPlanOrderId is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter savingsPlanOrderId is required and cannot be null.")); } if (savingsPlanId == null) { - return Mono.error(new IllegalArgumentException("Parameter savingsPlanId is required and cannot be null.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter savingsPlanId is required and cannot be null.")); } if (body == null) { - return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); } else { body.validate(); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.updateByBillingAccount(this.client.getEndpoint(), billingAccountName, savingsPlanOrderId, - savingsPlanId, this.client.getApiVersion(), body, accept, context); + return service.updateByBillingAccountSync(this.client.getEndpoint(), billingAccountName, savingsPlanOrderId, + savingsPlanId, this.client.getApiVersion(), body, accept, Context.NONE); } /** @@ -699,19 +777,40 @@ private Mono>> updateByBillingAccountWithResponseAsync * @param savingsPlanOrderId Order ID of the savings plan. * @param savingsPlanId ID of the savings plan. * @param body Request body for patching a savings plan order alias. + * @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 {@link PollerFlux} for polling of savings plan. + * @return savings plan along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, SavingsPlanModelInner> beginUpdateByBillingAccountAsync( - String billingAccountName, String savingsPlanOrderId, String savingsPlanId, SavingsPlanUpdateRequest body) { - Mono>> mono - = updateByBillingAccountWithResponseAsync(billingAccountName, savingsPlanOrderId, savingsPlanId, body); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), SavingsPlanModelInner.class, SavingsPlanModelInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateByBillingAccountWithResponse(String billingAccountName, + String savingsPlanOrderId, String savingsPlanId, SavingsPlanUpdateRequest body, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (savingsPlanOrderId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter savingsPlanOrderId is required and cannot be null.")); + } + if (savingsPlanId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter savingsPlanId is required and cannot be null.")); + } + if (body == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return service.updateByBillingAccountSync(this.client.getEndpoint(), billingAccountName, savingsPlanOrderId, + savingsPlanId, this.client.getApiVersion(), body, accept, context); } /** @@ -721,7 +820,6 @@ private PollerFlux, SavingsPlanModelInner> beg * @param savingsPlanOrderId Order ID of the savings plan. * @param savingsPlanId ID of the savings plan. * @param body Request body for patching a savings plan order alias. - * @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. @@ -729,13 +827,12 @@ private PollerFlux, SavingsPlanModelInner> beg */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, SavingsPlanModelInner> beginUpdateByBillingAccountAsync( - String billingAccountName, String savingsPlanOrderId, String savingsPlanId, SavingsPlanUpdateRequest body, - Context context) { - context = this.client.mergeContext(context); - Mono>> mono = updateByBillingAccountWithResponseAsync(billingAccountName, - savingsPlanOrderId, savingsPlanId, body, context); + String billingAccountName, String savingsPlanOrderId, String savingsPlanId, SavingsPlanUpdateRequest body) { + Mono>> mono + = updateByBillingAccountWithResponseAsync(billingAccountName, savingsPlanOrderId, savingsPlanId, body); return this.client.getLroResult(mono, - this.client.getHttpPipeline(), SavingsPlanModelInner.class, SavingsPlanModelInner.class, context); + this.client.getHttpPipeline(), SavingsPlanModelInner.class, SavingsPlanModelInner.class, + this.client.getContext()); } /** @@ -753,8 +850,10 @@ private PollerFlux, SavingsPlanModelInner> beg @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, SavingsPlanModelInner> beginUpdateByBillingAccount( String billingAccountName, String savingsPlanOrderId, String savingsPlanId, SavingsPlanUpdateRequest body) { - return this.beginUpdateByBillingAccountAsync(billingAccountName, savingsPlanOrderId, savingsPlanId, body) - .getSyncPoller(); + Response response + = updateByBillingAccountWithResponse(billingAccountName, savingsPlanOrderId, savingsPlanId, body); + return this.client.getLroResult(response, + SavingsPlanModelInner.class, SavingsPlanModelInner.class, Context.NONE); } /** @@ -774,9 +873,10 @@ public SyncPoller, SavingsPlanModelInner> begi public SyncPoller, SavingsPlanModelInner> beginUpdateByBillingAccount( String billingAccountName, String savingsPlanOrderId, String savingsPlanId, SavingsPlanUpdateRequest body, Context context) { - return this - .beginUpdateByBillingAccountAsync(billingAccountName, savingsPlanOrderId, savingsPlanId, body, context) - .getSyncPoller(); + Response response + = updateByBillingAccountWithResponse(billingAccountName, savingsPlanOrderId, savingsPlanId, body, context); + return this.client.getLroResult(response, + SavingsPlanModelInner.class, SavingsPlanModelInner.class, context); } /** @@ -798,27 +898,6 @@ private Mono updateByBillingAccountAsync(String billingAc .flatMap(this.client::getLroFinalResultOrError); } - /** - * Update savings plan by billing account. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param savingsPlanOrderId Order ID of the savings plan. - * @param savingsPlanId ID of the savings plan. - * @param body Request body for patching a savings plan order alias. - * @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 savings plan on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateByBillingAccountAsync(String billingAccountName, - String savingsPlanOrderId, String savingsPlanId, SavingsPlanUpdateRequest body, Context context) { - return beginUpdateByBillingAccountAsync(billingAccountName, savingsPlanOrderId, savingsPlanId, body, context) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Update savings plan by billing account. * @@ -834,7 +913,8 @@ private Mono updateByBillingAccountAsync(String billingAc @ServiceMethod(returns = ReturnType.SINGLE) public SavingsPlanModelInner updateByBillingAccount(String billingAccountName, String savingsPlanOrderId, String savingsPlanId, SavingsPlanUpdateRequest body) { - return updateByBillingAccountAsync(billingAccountName, savingsPlanOrderId, savingsPlanId, body).block(); + return beginUpdateByBillingAccount(billingAccountName, savingsPlanOrderId, savingsPlanId, body) + .getFinalResult(); } /** @@ -853,8 +933,8 @@ public SavingsPlanModelInner updateByBillingAccount(String billingAccountName, S @ServiceMethod(returns = ReturnType.SINGLE) public SavingsPlanModelInner updateByBillingAccount(String billingAccountName, String savingsPlanOrderId, String savingsPlanId, SavingsPlanUpdateRequest body, Context context) { - return updateByBillingAccountAsync(billingAccountName, savingsPlanOrderId, savingsPlanId, body, context) - .block(); + return beginUpdateByBillingAccount(billingAccountName, savingsPlanOrderId, savingsPlanId, body, context) + .getFinalResult(); } /** @@ -902,50 +982,6 @@ private Mono> validateUpdateByBilling .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Validate savings plan patch by billing account. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param savingsPlanOrderId Order ID of the savings plan. - * @param savingsPlanId ID of the savings plan. - * @param body Request body for patching a savings plan order alias. - * @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 savings plan update validate response along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> validateUpdateByBillingAccountWithResponseAsync( - String billingAccountName, String savingsPlanOrderId, String savingsPlanId, - SavingsPlanUpdateValidateRequest body, 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 (savingsPlanOrderId == null) { - return Mono - .error(new IllegalArgumentException("Parameter savingsPlanOrderId is required and cannot be null.")); - } - if (savingsPlanId == null) { - return Mono.error(new IllegalArgumentException("Parameter savingsPlanId is required and cannot be null.")); - } - if (body == null) { - return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); - } else { - body.validate(); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.validateUpdateByBillingAccount(this.client.getEndpoint(), billingAccountName, savingsPlanOrderId, - savingsPlanId, this.client.getApiVersion(), body, accept, context); - } - /** * Validate savings plan patch by billing account. * @@ -982,8 +1018,31 @@ private Mono validateUpdateByBillingAccountAsy public Response validateUpdateByBillingAccountWithResponse( String billingAccountName, String savingsPlanOrderId, String savingsPlanId, SavingsPlanUpdateValidateRequest body, Context context) { - return validateUpdateByBillingAccountWithResponseAsync(billingAccountName, savingsPlanOrderId, savingsPlanId, - body, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (savingsPlanOrderId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter savingsPlanOrderId is required and cannot be null.")); + } + if (savingsPlanId == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter savingsPlanId is required and cannot be null.")); + } + if (body == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return service.validateUpdateByBillingAccountSync(this.client.getEndpoint(), billingAccountName, + savingsPlanOrderId, savingsPlanId, this.client.getApiVersion(), body, accept, context); } /** @@ -1032,6 +1091,33 @@ private Mono> listBySavingsPlanOrderNextSin .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of savings plans along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySavingsPlanOrderNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listBySavingsPlanOrderNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1040,23 +1126,25 @@ private Mono> listBySavingsPlanOrderNextSin * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of savings plans along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return list of savings plans along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listBySavingsPlanOrderNextSinglePageAsync(String nextLink, + private PagedResponse listBySavingsPlanOrderNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.listBySavingsPlanOrderNext(nextLink, this.client.getEndpoint(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + Response res + = service.listBySavingsPlanOrderNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1086,6 +1174,33 @@ private Mono> listByBillingAccountNextSingl .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of savings plans along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingAccountNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1094,22 +1209,25 @@ private Mono> listByBillingAccountNextSingl * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of savings plans along with {@link PagedResponse} on successful completion of {@link Mono}. + * @return list of savings plans along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingAccountNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingAccountNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(SavingsPlansClientImpl.class); } diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/SavingsPlansImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/SavingsPlansImpl.java index 7718b1b0132c..76309c3af8a4 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/SavingsPlansImpl.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/SavingsPlansImpl.java @@ -13,10 +13,10 @@ import com.azure.resourcemanager.billing.fluent.models.SavingsPlanModelInner; import com.azure.resourcemanager.billing.fluent.models.SavingsPlanValidateResponseInner; import com.azure.resourcemanager.billing.models.SavingsPlanModel; -import com.azure.resourcemanager.billing.models.SavingsPlans; import com.azure.resourcemanager.billing.models.SavingsPlanUpdateRequest; import com.azure.resourcemanager.billing.models.SavingsPlanUpdateValidateRequest; import com.azure.resourcemanager.billing.models.SavingsPlanValidateResponse; +import com.azure.resourcemanager.billing.models.SavingsPlans; public final class SavingsPlansImpl implements SavingsPlans { private static final ClientLogger LOGGER = new ClientLogger(SavingsPlansImpl.class); 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 index 3813a16df9b8..f8158e3b5149 100644 --- 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 @@ -25,8 +25,10 @@ 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.BinaryData; 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.TransactionsClient; @@ -86,6 +88,20 @@ Mono> listByCustomer(@HostParam("$host") String @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/customers/{customerName}/transactions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByCustomerSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, @PathParam("customerName") String customerName, + @QueryParam("periodStartDate") LocalDate periodStartDate, + @QueryParam("periodEndDate") LocalDate periodEndDate, @QueryParam("type") TransactionType type, + @QueryParam("api-version") String apiVersion, @QueryParam("filter") String filter, + @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, @QueryParam("skip") Long skip, + @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transactions") @ExpectedResponses({ 200 }) @@ -101,6 +117,21 @@ Mono> listByInvoiceSection(@HostParam("$host") S @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transactions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByInvoiceSectionSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("invoiceSectionName") String invoiceSectionName, + @QueryParam("periodStartDate") LocalDate periodStartDate, + @QueryParam("periodEndDate") LocalDate periodEndDate, @QueryParam("type") TransactionType type, + @QueryParam("api-version") String apiVersion, @QueryParam("filter") String filter, + @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, @QueryParam("skip") Long skip, + @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/transactions") @ExpectedResponses({ 200 }) @@ -115,6 +146,20 @@ Mono> listByBillingProfile(@HostParam("$host") S @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/transactions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBillingProfileSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @QueryParam("periodStartDate") LocalDate periodStartDate, + @QueryParam("periodEndDate") LocalDate periodEndDate, @QueryParam("type") TransactionType type, + @QueryParam("api-version") String apiVersion, @QueryParam("filter") String filter, + @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, @QueryParam("skip") Long skip, + @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/transactions") @ExpectedResponses({ 200 }) @@ -126,6 +171,17 @@ Mono> listByInvoice(@HostParam("$host") String e @QueryParam("count") Boolean count, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/transactions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByInvoiceSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @PathParam("invoiceName") String invoiceName, + @QueryParam("api-version") String apiVersion, @QueryParam("filter") String filter, + @QueryParam("orderBy") String orderBy, @QueryParam("top") Long top, @QueryParam("skip") Long skip, + @QueryParam("count") Boolean count, @QueryParam("search") String search, + @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/transactionsDownload") @ExpectedResponses({ 200, 202 }) @@ -134,6 +190,14 @@ Mono>> transactionsDownloadByInvoice(@HostParam("$host @PathParam("billingAccountName") String billingAccountName, @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/{billingAccountName}/invoices/{invoiceName}/transactionsDownload") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response transactionsDownloadByInvoiceSync(@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("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/transactionSummary") @ExpectedResponses({ 200 }) @@ -143,6 +207,15 @@ Mono> getTransactionSummaryByInvoice(@HostPara @QueryParam("api-version") String apiVersion, @QueryParam("filter") String filter, @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices/{invoiceName}/transactionSummary") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getTransactionSummaryByInvoiceSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, @PathParam("invoiceName") String invoiceName, + @QueryParam("api-version") String apiVersion, @QueryParam("filter") String filter, + @QueryParam("search") String search, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Get("{nextLink}") @ExpectedResponses({ 200 }) @@ -151,6 +224,14 @@ 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) + Response listByCustomerNextSync( + @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 }) @@ -159,6 +240,14 @@ 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) + Response listByInvoiceSectionNextSync( + @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 }) @@ -167,6 +256,14 @@ 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) + Response listByBillingProfileNextSync( + @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 }) @@ -174,6 +271,14 @@ Mono> listByBillingProfileNext( Mono> listByInvoiceNext( @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) + Response listByInvoiceNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); } /** @@ -267,51 +372,19 @@ private Mono> listByCustomerSinglePageAsync(Stri * resources in the response. * @param search The search query option allows clients to request items within a collection matching a free-text * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByCustomerSinglePageAsync(String billingAccountName, - String billingProfileName, String customerName, LocalDate periodStartDate, LocalDate periodEndDate, - TransactionType type, String filter, String orderBy, Long top, Long skip, Boolean count, String search, - 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 (customerName == null) { - return Mono.error(new IllegalArgumentException("Parameter customerName 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.")); - } - if (type == null) { - return Mono.error(new IllegalArgumentException("Parameter type is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByCustomer(this.client.getEndpoint(), billingAccountName, billingProfileName, customerName, - periodStartDate, periodEndDate, type, this.client.getApiVersion(), filter, orderBy, top, skip, count, - search, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCustomerAsync(String billingAccountName, String billingProfileName, + String customerName, LocalDate periodStartDate, LocalDate periodEndDate, TransactionType type, String filter, + String orderBy, Long top, Long skip, Boolean count, String search) { + return new PagedFlux<>( + () -> listByCustomerSinglePageAsync(billingAccountName, billingProfileName, customerName, periodStartDate, + periodEndDate, type, filter, orderBy, top, skip, count, search), + nextLink -> listByCustomerNextSinglePageAsync(nextLink)); } /** @@ -326,17 +399,6 @@ private Mono> listByCustomerSinglePageAsync(Stri * format. * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. * @param type The type of transaction. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -344,8 +406,13 @@ private Mono> listByCustomerSinglePageAsync(Stri */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByCustomerAsync(String billingAccountName, String billingProfileName, - String customerName, LocalDate periodStartDate, LocalDate periodEndDate, TransactionType type, String filter, - String orderBy, Long top, Long skip, Boolean count, String search) { + String customerName, LocalDate periodStartDate, LocalDate periodEndDate, TransactionType type) { + final String filter = null; + final String orderBy = null; + final Long top = null; + final Long skip = null; + final Boolean count = null; + final String search = null; return new PagedFlux<>( () -> listByCustomerSinglePageAsync(billingAccountName, billingProfileName, customerName, periodStartDate, periodEndDate, type, filter, orderBy, top, skip, count, search), @@ -364,24 +431,60 @@ private PagedFlux listByCustomerAsync(String billingAccountNam * format. * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. * @param type The type of transaction. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByCustomerAsync(String billingAccountName, String billingProfileName, - String customerName, LocalDate periodStartDate, LocalDate periodEndDate, TransactionType type) { - final String filter = null; - final String orderBy = null; - final Long top = null; - final Long skip = null; - final Boolean count = null; - final String search = null; - return new PagedFlux<>( - () -> listByCustomerSinglePageAsync(billingAccountName, billingProfileName, customerName, periodStartDate, - periodEndDate, type, filter, orderBy, top, skip, count, search), - nextLink -> listByCustomerNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerSinglePage(String billingAccountName, + String billingProfileName, String customerName, LocalDate periodStartDate, LocalDate periodEndDate, + TransactionType type, String filter, String orderBy, Long top, Long skip, Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + if (periodStartDate == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter periodStartDate is required and cannot be null.")); + } + if (periodEndDate == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter periodEndDate is required and cannot be null.")); + } + if (type == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter type is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByCustomerSync(this.client.getEndpoint(), billingAccountName, + billingProfileName, customerName, periodStartDate, periodEndDate, type, this.client.getApiVersion(), filter, + orderBy, top, skip, count, search, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -411,16 +514,47 @@ private PagedFlux listByCustomerAsync(String billingAccountNam * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByCustomerAsync(String billingAccountName, String billingProfileName, - String customerName, LocalDate periodStartDate, LocalDate periodEndDate, TransactionType type, String filter, - String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>( - () -> listByCustomerSinglePageAsync(billingAccountName, billingProfileName, customerName, periodStartDate, - periodEndDate, type, filter, orderBy, top, skip, count, search, context), - nextLink -> listByCustomerNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerSinglePage(String billingAccountName, + String billingProfileName, String customerName, LocalDate periodStartDate, LocalDate periodEndDate, + TransactionType type, String filter, String orderBy, Long top, Long skip, Boolean count, String search, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (customerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter customerName is required and cannot be null.")); + } + if (periodStartDate == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter periodStartDate is required and cannot be null.")); + } + if (periodEndDate == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter periodEndDate is required and cannot be null.")); + } + if (type == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter type is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByCustomerSync(this.client.getEndpoint(), billingAccountName, + billingProfileName, customerName, periodStartDate, periodEndDate, type, this.client.getApiVersion(), filter, + orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -449,8 +583,10 @@ public PagedIterable listByCustomer(String billingAccountName, final Long skip = null; final Boolean count = null; final String search = null; - return new PagedIterable<>(listByCustomerAsync(billingAccountName, billingProfileName, customerName, - periodStartDate, periodEndDate, type, filter, orderBy, top, skip, count, search)); + return new PagedIterable<>( + () -> listByCustomerSinglePage(billingAccountName, billingProfileName, customerName, periodStartDate, + periodEndDate, type, filter, orderBy, top, skip, count, search), + nextLink -> listByCustomerNextSinglePage(nextLink)); } /** @@ -486,8 +622,10 @@ public PagedIterable listByCustomer(String billingAccountName, public PagedIterable listByCustomer(String billingAccountName, String billingProfileName, String customerName, LocalDate periodStartDate, LocalDate periodEndDate, TransactionType type, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByCustomerAsync(billingAccountName, billingProfileName, customerName, - periodStartDate, periodEndDate, type, filter, orderBy, top, skip, count, search, context)); + return new PagedIterable<>( + () -> listByCustomerSinglePage(billingAccountName, billingProfileName, customerName, periodStartDate, + periodEndDate, type, filter, orderBy, top, skip, count, search, context), + nextLink -> listByCustomerNextSinglePage(nextLink, context)); } /** @@ -582,52 +720,19 @@ private Mono> listByInvoiceSectionSinglePageAsyn * resources in the response. * @param search The search query option allows clients to request items within a collection matching a free-text * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByInvoiceSectionSinglePageAsync(String billingAccountName, - String billingProfileName, String invoiceSectionName, LocalDate periodStartDate, LocalDate periodEndDate, - TransactionType type, String filter, String orderBy, Long top, Long skip, Boolean count, String search, - 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 (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.")); - } - if (type == null) { - return Mono.error(new IllegalArgumentException("Parameter type is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByInvoiceSection(this.client.getEndpoint(), billingAccountName, billingProfileName, invoiceSectionName, - periodStartDate, periodEndDate, type, this.client.getApiVersion(), filter, orderBy, top, skip, count, - search, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, + String invoiceSectionName, LocalDate periodStartDate, LocalDate periodEndDate, TransactionType type, + String filter, String orderBy, Long top, Long skip, Boolean count, String search) { + return new PagedFlux<>( + () -> listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName, + periodStartDate, periodEndDate, type, filter, orderBy, top, skip, count, search), + nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink)); } /** @@ -642,17 +747,6 @@ private Mono> listByInvoiceSectionSinglePageAsyn * format. * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. * @param type The type of transaction. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. @@ -660,8 +754,13 @@ private Mono> listByInvoiceSectionSinglePageAsyn */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, - String invoiceSectionName, LocalDate periodStartDate, LocalDate periodEndDate, TransactionType type, - String filter, String orderBy, Long top, Long skip, Boolean count, String search) { + String invoiceSectionName, LocalDate periodStartDate, LocalDate periodEndDate, TransactionType type) { + final String filter = null; + final String orderBy = null; + final Long top = null; + final Long skip = null; + final Boolean count = null; + final String search = null; return new PagedFlux<>( () -> listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName, periodStartDate, periodEndDate, type, filter, orderBy, top, skip, count, search), @@ -680,24 +779,60 @@ private PagedFlux listByInvoiceSectionAsync(String billingAcco * format. * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. * @param type The type of transaction. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, - String invoiceSectionName, LocalDate periodStartDate, LocalDate periodEndDate, TransactionType type) { - final String filter = null; - final String orderBy = null; - final Long top = null; - final Long skip = null; - final Boolean count = null; - final String search = null; - return new PagedFlux<>( - () -> listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName, - periodStartDate, periodEndDate, type, filter, orderBy, top, skip, count, search), - nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceSectionSinglePage(String billingAccountName, + String billingProfileName, String invoiceSectionName, LocalDate periodStartDate, LocalDate periodEndDate, + TransactionType type, String filter, String orderBy, Long top, Long skip, Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + if (periodStartDate == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter periodStartDate is required and cannot be null.")); + } + if (periodEndDate == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter periodEndDate is required and cannot be null.")); + } + if (type == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter type is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByInvoiceSectionSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, invoiceSectionName, periodStartDate, periodEndDate, type, + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -727,16 +862,47 @@ private PagedFlux listByInvoiceSectionAsync(String billingAcco * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByInvoiceSectionAsync(String billingAccountName, String billingProfileName, - String invoiceSectionName, LocalDate periodStartDate, LocalDate periodEndDate, TransactionType type, - String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>( - () -> listByInvoiceSectionSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName, - periodStartDate, periodEndDate, type, filter, orderBy, top, skip, count, search, context), - nextLink -> listByInvoiceSectionNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceSectionSinglePage(String billingAccountName, + String billingProfileName, String invoiceSectionName, LocalDate periodStartDate, LocalDate periodEndDate, + TransactionType type, String filter, String orderBy, Long top, Long skip, Boolean count, String search, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + if (periodStartDate == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter periodStartDate is required and cannot be null.")); + } + if (periodEndDate == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter periodEndDate is required and cannot be null.")); + } + if (type == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter type is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByInvoiceSectionSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, invoiceSectionName, periodStartDate, periodEndDate, type, + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -765,8 +931,10 @@ public PagedIterable listByInvoiceSection(String billingAccoun final Long skip = null; final Boolean count = null; final String search = null; - return new PagedIterable<>(listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, - periodStartDate, periodEndDate, type, filter, orderBy, top, skip, count, search)); + return new PagedIterable<>( + () -> listByInvoiceSectionSinglePage(billingAccountName, billingProfileName, invoiceSectionName, + periodStartDate, periodEndDate, type, filter, orderBy, top, skip, count, search), + nextLink -> listByInvoiceSectionNextSinglePage(nextLink)); } /** @@ -802,8 +970,10 @@ public PagedIterable listByInvoiceSection(String billingAccoun public PagedIterable listByInvoiceSection(String billingAccountName, String billingProfileName, String invoiceSectionName, LocalDate periodStartDate, LocalDate periodEndDate, TransactionType type, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByInvoiceSectionAsync(billingAccountName, billingProfileName, invoiceSectionName, - periodStartDate, periodEndDate, type, filter, orderBy, top, skip, count, search, context)); + return new PagedIterable<>( + () -> listByInvoiceSectionSinglePage(billingAccountName, billingProfileName, invoiceSectionName, + periodStartDate, periodEndDate, type, filter, orderBy, top, skip, count, search, context), + nextLink -> listByInvoiceSectionNextSinglePage(nextLink, context)); } /** @@ -870,71 +1040,6 @@ private Mono> listByBillingProfileSinglePageAsyn .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Lists the billed or unbilled transactions by billing profile name for given start and end date. Transactions - * include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and - * do not include tax. Tax is added to the amount once an invoice is generated. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY - * format. - * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. - * @param type The type of transaction. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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 container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingProfileSinglePageAsync(String billingAccountName, - String billingProfileName, LocalDate periodStartDate, LocalDate periodEndDate, TransactionType type, - String filter, String orderBy, Long top, Long skip, Boolean count, String search, 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.")); - } - if (type == null) { - return Mono.error(new IllegalArgumentException("Parameter type is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByBillingProfile(this.client.getEndpoint(), billingAccountName, billingProfileName, periodStartDate, - periodEndDate, type, this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, - context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); - } - /** * Lists the billed or unbilled transactions by billing profile name for given start and end date. Transactions * include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and @@ -1025,20 +1130,45 @@ private PagedFlux listByBillingProfileAsync(String billingAcco * resources in the response. * @param search The search query option allows clients to request items within a collection matching a free-text * search expression. search is only supported for string fields. - * @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 container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByBillingProfileAsync(String billingAccountName, String billingProfileName, - LocalDate periodStartDate, LocalDate periodEndDate, TransactionType type, String filter, String orderBy, - Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>( - () -> listByBillingProfileSinglePageAsync(billingAccountName, billingProfileName, periodStartDate, - periodEndDate, type, filter, orderBy, top, skip, count, search, context), - nextLink -> listByBillingProfileNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, + String billingProfileName, LocalDate periodStartDate, LocalDate periodEndDate, TransactionType type, + String filter, String orderBy, Long top, Long skip, Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (periodStartDate == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter periodStartDate is required and cannot be null.")); + } + if (periodEndDate == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter periodEndDate is required and cannot be null.")); + } + if (type == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter type is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingProfileSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, periodStartDate, periodEndDate, type, this.client.getApiVersion(), + filter, orderBy, top, skip, count, search, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1052,22 +1182,57 @@ private PagedFlux listByBillingProfileAsync(String billingAcco * format. * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. * @param type The type of transaction. + * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @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 container for a list of resources as paginated response with {@link PagedIterable}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName, - LocalDate periodStartDate, LocalDate periodEndDate, TransactionType type) { - final String filter = null; - final String orderBy = null; - final Long top = null; - final Long skip = null; - final Boolean count = null; - final String search = null; - return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, periodStartDate, - periodEndDate, type, filter, orderBy, top, skip, count, search)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileSinglePage(String billingAccountName, + String billingProfileName, LocalDate periodStartDate, LocalDate periodEndDate, TransactionType type, + String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (periodStartDate == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter periodStartDate is required and cannot be null.")); + } + if (periodEndDate == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter periodEndDate is required and cannot be null.")); + } + if (type == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter type is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByBillingProfileSync(this.client.getEndpoint(), + billingAccountName, billingProfileName, periodStartDate, periodEndDate, type, this.client.getApiVersion(), + filter, orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1081,18 +1246,6 @@ public PagedIterable listByBillingProfile(String billingAccoun * format. * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. * @param type The type of transaction. - * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a - * request URL. - * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @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. @@ -1100,55 +1253,55 @@ public PagedIterable listByBillingProfile(String billingAccoun */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName, - LocalDate periodStartDate, LocalDate periodEndDate, TransactionType type, String filter, String orderBy, - Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>(listByBillingProfileAsync(billingAccountName, billingProfileName, periodStartDate, - periodEndDate, type, filter, orderBy, top, skip, count, search, context)); + LocalDate periodStartDate, LocalDate periodEndDate, TransactionType type) { + final String filter = null; + final String orderBy = null; + final Long top = null; + final Long skip = null; + final Boolean count = null; + final String search = null; + return new PagedIterable<>( + () -> listByBillingProfileSinglePage(billingAccountName, billingProfileName, periodStartDate, periodEndDate, + type, filter, orderBy, top, skip, count, search), + nextLink -> listByBillingProfileNextSinglePage(nextLink)); } /** - * Lists the transactions for an invoice. Transactions include purchases, refunds and Azure usage charges. + * Lists the billed or unbilled transactions by billing profile name for given start and end date. Transactions + * include purchases, refunds and Azure usage charges. Unbilled transactions are listed under pending invoice Id and + * do not include tax. Tax is added to the amount once an invoice is generated. * * @param billingAccountName The ID that uniquely identifies a billing account. - * @param invoiceName The ID that uniquely identifies an invoice. + * @param billingProfileName The ID that uniquely identifies a billing profile. + * @param periodStartDate The start date to fetch the transactions. The date should be specified in MM-DD-YYYY + * format. + * @param periodEndDate The end date to fetch the transactions. The date should be specified in MM-DD-YYYY format. + * @param type The type of transaction. * @param filter The filter query option allows clients to filter a collection of resources that are addressed by a * request URL. * @param orderBy The orderby query option allows clients to request resources in a particular order. - * @param top The top query option requests the number of items in the queried collection to be included in the - * result. The maximum supported value for top is 50. - * @param skip The skip query option requests the number of items in the queried collection that are to be skipped - * and not included in the result. - * @param count The count query option allows clients to request a count of the matching resources included with the - * resources in the response. - * @param search The search query option allows clients to request items within a collection matching a free-text - * search expression. search is only supported for string fields. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByInvoiceSinglePageAsync(String billingAccountName, - String invoiceName, String filter, String orderBy, Long top, Long skip, Boolean count, String search) { - 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 accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByInvoice(this.client.getEndpoint(), billingAccountName, invoiceName, - this.client.getApiVersion(), filter, orderBy, top, skip, count, search, 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())); + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @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 container for a list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBillingProfile(String billingAccountName, String billingProfileName, + LocalDate periodStartDate, LocalDate periodEndDate, TransactionType type, String filter, String orderBy, + Long top, Long skip, Boolean count, String search, Context context) { + return new PagedIterable<>( + () -> listByBillingProfileSinglePage(billingAccountName, billingProfileName, periodStartDate, periodEndDate, + type, filter, orderBy, top, skip, count, search, context), + nextLink -> listByBillingProfileNextSinglePage(nextLink, context)); } /** @@ -1167,7 +1320,6 @@ private Mono> listByInvoiceSinglePageAsync(Strin * resources in the response. * @param search The search query option allows clients to request items within a collection matching a free-text * search expression. search is only supported for string fields. - * @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. @@ -1176,8 +1328,7 @@ private Mono> listByInvoiceSinglePageAsync(Strin */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByInvoiceSinglePageAsync(String billingAccountName, - String invoiceName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, - Context context) { + String invoiceName, String filter, String orderBy, Long top, Long skip, Boolean count, String search) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -1190,12 +1341,12 @@ private Mono> listByInvoiceSinglePageAsync(Strin return Mono.error(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByInvoice(this.client.getEndpoint(), billingAccountName, invoiceName, this.client.getApiVersion(), - filter, orderBy, top, skip, count, search, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + return FluxUtil + .withContext(context -> service.listByInvoice(this.client.getEndpoint(), billingAccountName, invoiceName, + this.client.getApiVersion(), filter, orderBy, top, skip, count, search, 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())); } /** @@ -1248,6 +1399,50 @@ private PagedFlux listByInvoiceAsync(String billingAccountName skip, count, search), 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 filter The filter query option allows clients to filter a collection of resources that are addressed by a + * request URL. + * @param orderBy The orderby query option allows clients to request resources in a particular order. + * @param top The top query option requests the number of items in the queried collection to be included in the + * result. The maximum supported value for top is 50. + * @param skip The skip query option requests the number of items in the queried collection that are to be skipped + * and not included in the result. + * @param count The count query option allows clients to request a count of the matching resources included with the + * resources in the response. + * @param search The search query option allows clients to request items within a collection matching a free-text + * search expression. search is only supported for string fields. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceSinglePage(String billingAccountName, String invoiceName, + String filter, String orderBy, Long top, Long skip, Boolean count, String search) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (invoiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByInvoiceSync(this.client.getEndpoint(), billingAccountName, + invoiceName, this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, Context.NONE); + return 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. * @@ -1268,13 +1463,29 @@ private PagedFlux listByInvoiceAsync(String billingAccountName * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources as paginated response with {@link PagedFlux}. + * @return a container for a list of resources along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByInvoiceAsync(String billingAccountName, String invoiceName, String filter, - String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedFlux<>(() -> listByInvoiceSinglePageAsync(billingAccountName, invoiceName, filter, orderBy, top, - skip, count, search, context), nextLink -> listByInvoiceNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceSinglePage(String billingAccountName, String invoiceName, + String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (invoiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByInvoiceSync(this.client.getEndpoint(), billingAccountName, + invoiceName, this.client.getApiVersion(), filter, orderBy, top, skip, count, search, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1296,7 +1507,8 @@ public PagedIterable listByInvoice(String billingAccountName, final Boolean count = null; final String search = null; return new PagedIterable<>( - listByInvoiceAsync(billingAccountName, invoiceName, filter, orderBy, top, skip, count, search)); + () -> listByInvoiceSinglePage(billingAccountName, invoiceName, filter, orderBy, top, skip, count, search), + nextLink -> listByInvoiceNextSinglePage(nextLink)); } /** @@ -1324,8 +1536,8 @@ public PagedIterable listByInvoice(String billingAccountName, @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByInvoice(String billingAccountName, String invoiceName, String filter, String orderBy, Long top, Long skip, Boolean count, String search, Context context) { - return new PagedIterable<>( - listByInvoiceAsync(billingAccountName, invoiceName, filter, orderBy, top, skip, count, search, context)); + return new PagedIterable<>(() -> listByInvoiceSinglePage(billingAccountName, invoiceName, filter, orderBy, top, + skip, count, search, context), nextLink -> listByInvoiceNextSinglePage(nextLink, context)); } /** @@ -1367,31 +1579,30 @@ private Mono>> transactionsDownloadByInvoiceWithRespon * * @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 a URL to download the transactions document for an invoice along with {@link Response} on successful - * completion of {@link Mono}. + * @return a URL to download the transactions document for an invoice along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> transactionsDownloadByInvoiceWithResponseAsync(String billingAccountName, - String invoiceName, Context context) { + private Response transactionsDownloadByInvoiceWithResponse(String billingAccountName, + String invoiceName) { if (this.client.getEndpoint() == null) { - return Mono.error( - new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); } final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.transactionsDownloadByInvoice(this.client.getEndpoint(), billingAccountName, invoiceName, - this.client.getApiVersion(), accept, context); + return service.transactionsDownloadByInvoiceSync(this.client.getEndpoint(), billingAccountName, invoiceName, + this.client.getApiVersion(), accept, Context.NONE); } /** @@ -1400,19 +1611,31 @@ private Mono>> transactionsDownloadByInvoiceWithRespon * * @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 {@link PollerFlux} for polling of a URL to download the transactions document for an invoice. + * @return a URL to download the transactions document for an invoice along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, DocumentDownloadResultInner> - beginTransactionsDownloadByInvoiceAsync(String billingAccountName, String invoiceName) { - Mono>> mono - = transactionsDownloadByInvoiceWithResponseAsync(billingAccountName, invoiceName); - return this.client.getLroResult(mono, - this.client.getHttpPipeline(), DocumentDownloadResultInner.class, DocumentDownloadResultInner.class, - this.client.getContext()); + @ServiceMethod(returns = ReturnType.SINGLE) + private Response transactionsDownloadByInvoiceWithResponse(String billingAccountName, + String invoiceName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (invoiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.transactionsDownloadByInvoiceSync(this.client.getEndpoint(), billingAccountName, invoiceName, + this.client.getApiVersion(), accept, context); } /** @@ -1421,7 +1644,6 @@ private Mono>> transactionsDownloadByInvoiceWithRespon * * @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. @@ -1429,13 +1651,12 @@ private Mono>> transactionsDownloadByInvoiceWithRespon */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, DocumentDownloadResultInner> - beginTransactionsDownloadByInvoiceAsync(String billingAccountName, String invoiceName, Context context) { - context = this.client.mergeContext(context); + beginTransactionsDownloadByInvoiceAsync(String billingAccountName, String invoiceName) { Mono>> mono - = transactionsDownloadByInvoiceWithResponseAsync(billingAccountName, invoiceName, context); + = transactionsDownloadByInvoiceWithResponseAsync(billingAccountName, invoiceName); return this.client.getLroResult(mono, this.client.getHttpPipeline(), DocumentDownloadResultInner.class, DocumentDownloadResultInner.class, - context); + this.client.getContext()); } /** @@ -1452,7 +1673,9 @@ private Mono>> transactionsDownloadByInvoiceWithRespon @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, DocumentDownloadResultInner> beginTransactionsDownloadByInvoice(String billingAccountName, String invoiceName) { - return this.beginTransactionsDownloadByInvoiceAsync(billingAccountName, invoiceName).getSyncPoller(); + Response response = transactionsDownloadByInvoiceWithResponse(billingAccountName, invoiceName); + return this.client.getLroResult(response, + DocumentDownloadResultInner.class, DocumentDownloadResultInner.class, Context.NONE); } /** @@ -1470,7 +1693,10 @@ private Mono>> transactionsDownloadByInvoiceWithRespon @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, DocumentDownloadResultInner> beginTransactionsDownloadByInvoice(String billingAccountName, String invoiceName, Context context) { - return this.beginTransactionsDownloadByInvoiceAsync(billingAccountName, invoiceName, context).getSyncPoller(); + Response response + = transactionsDownloadByInvoiceWithResponse(billingAccountName, invoiceName, context); + return this.client.getLroResult(response, + DocumentDownloadResultInner.class, DocumentDownloadResultInner.class, context); } /** @@ -1491,25 +1717,6 @@ private Mono transactionsDownloadByInvoiceAsync(Str .flatMap(this.client::getLroFinalResultOrError); } - /** - * Gets a URL to download the transactions document for an invoice. The operation is supported for billing accounts - * with agreement type Enterprise 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 a URL to download the transactions document for an invoice on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono transactionsDownloadByInvoiceAsync(String billingAccountName, - String invoiceName, Context context) { - return beginTransactionsDownloadByInvoiceAsync(billingAccountName, invoiceName, context).last() - .flatMap(this.client::getLroFinalResultOrError); - } - /** * Gets a URL to download the transactions document for an invoice. The operation is supported for billing accounts * with agreement type Enterprise Agreement. @@ -1523,7 +1730,7 @@ private Mono transactionsDownloadByInvoiceAsync(Str */ @ServiceMethod(returns = ReturnType.SINGLE) public DocumentDownloadResultInner transactionsDownloadByInvoice(String billingAccountName, String invoiceName) { - return transactionsDownloadByInvoiceAsync(billingAccountName, invoiceName).block(); + return beginTransactionsDownloadByInvoice(billingAccountName, invoiceName).getFinalResult(); } /** @@ -1541,7 +1748,7 @@ public DocumentDownloadResultInner transactionsDownloadByInvoice(String billingA @ServiceMethod(returns = ReturnType.SINGLE) public DocumentDownloadResultInner transactionsDownloadByInvoice(String billingAccountName, String invoiceName, Context context) { - return transactionsDownloadByInvoiceAsync(billingAccountName, invoiceName, context).block(); + return beginTransactionsDownloadByInvoice(billingAccountName, invoiceName, context).getFinalResult(); } /** @@ -1580,42 +1787,6 @@ private Mono> getTransactionSummaryByInvoiceWi .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets the transaction summary 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 filter The filter query option allows clients to filter the line items that are aggregated to create the - * line item summary. - * @param search The search query option allows clients to filter the line items that are aggregated to create the - * line item summary. - * @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 transaction summary for an invoice along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getTransactionSummaryByInvoiceWithResponseAsync( - String billingAccountName, String invoiceName, String filter, String search, 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.getTransactionSummaryByInvoice(this.client.getEndpoint(), billingAccountName, invoiceName, - this.client.getApiVersion(), filter, search, accept, context); - } - /** * Gets the transaction summary for an invoice. Transactions include purchases, refunds and Azure usage charges. * @@ -1653,8 +1824,22 @@ private Mono getTransactionSummaryByInvoiceAsync(String @ServiceMethod(returns = ReturnType.SINGLE) public Response getTransactionSummaryByInvoiceWithResponse(String billingAccountName, String invoiceName, String filter, String search, Context context) { - return getTransactionSummaryByInvoiceWithResponseAsync(billingAccountName, invoiceName, filter, search, context) - .block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (invoiceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getTransactionSummaryByInvoiceSync(this.client.getEndpoint(), billingAccountName, invoiceName, + this.client.getApiVersion(), filter, search, accept, context); } /** @@ -1702,6 +1887,33 @@ private Mono> listByCustomerNextSinglePageAsync( .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCustomerNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByCustomerNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1710,23 +1922,24 @@ private Mono> listByCustomerNextSinglePageAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByCustomerNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listByCustomerNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByCustomerNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1757,6 +1970,33 @@ private Mono> listByInvoiceSectionNextSinglePage .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceSectionNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByInvoiceSectionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1765,24 +2005,24 @@ private Mono> listByInvoiceSectionNextSinglePage * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByInvoiceSectionNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByInvoiceSectionNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByInvoiceSectionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1813,6 +2053,33 @@ private Mono> listByBillingProfileNextSinglePage .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBillingProfileNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1821,24 +2088,24 @@ private Mono> listByBillingProfileNextSinglePage * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByBillingProfileNextSinglePageAsync(String nextLink, - Context context) { + private PagedResponse listByBillingProfileNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByBillingProfileNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -1868,6 +2135,33 @@ private Mono> listByInvoiceNextSinglePageAsync(S .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container for a list of resources along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByInvoiceNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByInvoiceNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -1876,22 +2170,25 @@ private Mono> listByInvoiceNextSinglePageAsync(S * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a container for a list of resources along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return a container for a list of resources along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByInvoiceNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listByInvoiceNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listByInvoiceNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(TransactionsClientImpl.class); } 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 index bf0201428bcb..78cfc51d40b3 100644 --- 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 @@ -15,9 +15,9 @@ import com.azure.resourcemanager.billing.fluent.models.TransactionSummaryInner; import com.azure.resourcemanager.billing.models.DocumentDownloadResult; import com.azure.resourcemanager.billing.models.Transaction; -import com.azure.resourcemanager.billing.models.Transactions; import com.azure.resourcemanager.billing.models.TransactionSummary; import com.azure.resourcemanager.billing.models.TransactionType; +import com.azure.resourcemanager.billing.models.Transactions; import java.time.LocalDate; public final class TransactionsImpl implements Transactions { diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/TransfersClientImpl.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/TransfersClientImpl.java index 7cf2102f59d6..3e4aa3aa6a79 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/TransfersClientImpl.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/TransfersClientImpl.java @@ -28,6 +28,7 @@ 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.TransfersClient; import com.azure.resourcemanager.billing.fluent.models.TransferDetailsInner; import com.azure.resourcemanager.billing.models.InitiateTransferRequest; @@ -76,6 +77,16 @@ Mono> get(@HostParam("$host") String endpoint, @PathParam("invoiceSectionName") String invoiceSectionName, @PathParam("transferName") String transferName, @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}/transfers/{transferName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("invoiceSectionName") String invoiceSectionName, @PathParam("transferName") String transferName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transfers/{transferName}") @ExpectedResponses({ 200, 201 }) @@ -88,6 +99,18 @@ Mono> initiate(@HostParam("$host") String endpoin @BodyParam("application/json") InitiateTransferRequest parameters, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Put("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transfers/{transferName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response initiateSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("invoiceSectionName") String invoiceSectionName, @PathParam("transferName") String transferName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") InitiateTransferRequest parameters, @HeaderParam("Accept") String accept, + Context context); + @Headers({ "Content-Type: application/json" }) @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transfers/{transferName}/cancel") @ExpectedResponses({ 200 }) @@ -98,6 +121,16 @@ Mono> cancel(@HostParam("$host") String endpoint, @PathParam("invoiceSectionName") String invoiceSectionName, @PathParam("transferName") String transferName, @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @Headers({ "Content-Type: application/json" }) + @Post("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transfers/{transferName}/cancel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response cancelSync(@HostParam("$host") String endpoint, + @PathParam("billingAccountName") String billingAccountName, + @PathParam("billingProfileName") String billingProfileName, + @PathParam("invoiceSectionName") String invoiceSectionName, @PathParam("transferName") String transferName, + @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}/transfers") @ExpectedResponses({ 200 }) @@ -108,6 +141,16 @@ Mono> list(@HostParam("$host") String endpoi @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}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/transfers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@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("{nextLink}") @ExpectedResponses({ 200 }) @@ -115,6 +158,13 @@ Mono> list(@HostParam("$host") String endpoi 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) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** @@ -159,48 +209,6 @@ private Mono> getWithResponseAsync(String billing .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Gets a transfer request by ID. The operation is supported only for billing accounts with agreement type Microsoft - * Customer Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param invoiceSectionName The ID that uniquely identifies an invoice section. - * @param transferName The ID that uniquely identifies a transfer request. - * @param 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 transfer request by ID along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String billingAccountName, - String billingProfileName, String invoiceSectionName, String transferName, 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 (transferName == null) { - return Mono.error(new IllegalArgumentException("Parameter transferName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.get(this.client.getEndpoint(), billingAccountName, billingProfileName, invoiceSectionName, - transferName, this.client.getApiVersion(), accept, context); - } - /** * Gets a transfer request by ID. The operation is supported only for billing accounts with agreement type Microsoft * Customer Agreement. @@ -238,8 +246,30 @@ private Mono getAsync(String billingAccountName, String bi @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse(String billingAccountName, String billingProfileName, String invoiceSectionName, String transferName, Context context) { - return getWithResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, transferName, context) - .block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + if (transferName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter transferName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), billingAccountName, billingProfileName, invoiceSectionName, + transferName, this.client.getApiVersion(), accept, context); } /** @@ -310,55 +340,6 @@ private Mono> initiateWithResponseAsync(String bi .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Sends a request to a user in another billing account to transfer billing ownership of their subscriptions. The - * operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param invoiceSectionName The ID that uniquely identifies an invoice section. - * @param transferName The ID that uniquely identifies a transfer request. - * @param parameters Request parameters that are provided to the initiate transfer 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 details of the transfer along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> initiateWithResponseAsync(String billingAccountName, - String billingProfileName, String invoiceSectionName, String transferName, InitiateTransferRequest 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 (transferName == null) { - return Mono.error(new IllegalArgumentException("Parameter transferName 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 accept = "application/json"; - context = this.client.mergeContext(context); - return service.initiate(this.client.getEndpoint(), billingAccountName, billingProfileName, invoiceSectionName, - transferName, this.client.getApiVersion(), parameters, accept, context); - } - /** * Sends a request to a user in another billing account to transfer billing ownership of their subscriptions. The * operation is supported only for billing accounts with agreement type Microsoft Customer Agreement. @@ -398,8 +379,36 @@ private Mono initiateAsync(String billingAccountName, Stri @ServiceMethod(returns = ReturnType.SINGLE) public Response initiateWithResponse(String billingAccountName, String billingProfileName, String invoiceSectionName, String transferName, InitiateTransferRequest parameters, Context context) { - return initiateWithResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, transferName, - parameters, context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + if (transferName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter transferName is required and cannot be null.")); + } + if (parameters == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return service.initiateSync(this.client.getEndpoint(), billingAccountName, billingProfileName, + invoiceSectionName, transferName, this.client.getApiVersion(), parameters, accept, context); } /** @@ -465,48 +474,6 @@ private Mono> cancelWithResponseAsync(String bill .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } - /** - * Cancels a transfer request. The operation is supported only for billing accounts with agreement type Microsoft - * Customer Agreement. - * - * @param billingAccountName The ID that uniquely identifies a billing account. - * @param billingProfileName The ID that uniquely identifies a billing profile. - * @param invoiceSectionName The ID that uniquely identifies an invoice section. - * @param transferName The ID that uniquely identifies a transfer request. - * @param 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 details of the transfer along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> cancelWithResponseAsync(String billingAccountName, - String billingProfileName, String invoiceSectionName, String transferName, 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 (transferName == null) { - return Mono.error(new IllegalArgumentException("Parameter transferName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.cancel(this.client.getEndpoint(), billingAccountName, billingProfileName, invoiceSectionName, - transferName, this.client.getApiVersion(), accept, context); - } - /** * Cancels a transfer request. The operation is supported only for billing accounts with agreement type Microsoft * Customer Agreement. @@ -544,8 +511,30 @@ private Mono cancelAsync(String billingAccountName, String @ServiceMethod(returns = ReturnType.SINGLE) public Response cancelWithResponse(String billingAccountName, String billingProfileName, String invoiceSectionName, String transferName, Context context) { - return cancelWithResponseAsync(billingAccountName, billingProfileName, invoiceSectionName, transferName, - context).block(); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + if (transferName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter transferName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.cancelSync(this.client.getEndpoint(), billingAccountName, billingProfileName, invoiceSectionName, + transferName, this.client.getApiVersion(), accept, context); } /** @@ -616,39 +605,16 @@ private Mono> listSinglePageAsync(String bil * @param billingAccountName The ID that uniquely 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 transfers initiated by caller along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return the list of transfers initiated by caller as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listSinglePageAsync(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 accept = "application/json"; - context = this.client.mergeContext(context); - return service - .list(this.client.getEndpoint(), billingAccountName, billingProfileName, invoiceSectionName, - this.client.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().value(), res.getValue().nextLink(), null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String billingAccountName, String billingProfileName, + String invoiceSectionName) { + return new PagedFlux<>(() -> listSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName), + nextLink -> listNextSinglePageAsync(nextLink)); } /** @@ -661,13 +627,33 @@ private Mono> listSinglePageAsync(String bil * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of transfers initiated by caller as paginated response with {@link PagedFlux}. + * @return the list of transfers initiated by caller along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String billingAccountName, String billingProfileName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String billingAccountName, String billingProfileName, String invoiceSectionName) { - return new PagedFlux<>(() -> listSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName), - nextLink -> listNextSinglePageAsync(nextLink)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), billingAccountName, + billingProfileName, invoiceSectionName, this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -681,14 +667,33 @@ private PagedFlux listAsync(String billingAccountName, Str * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of transfers initiated by caller as paginated response with {@link PagedFlux}. + * @return the list of transfers initiated by caller along with {@link PagedResponse}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String billingAccountName, String billingProfileName, + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { - return new PagedFlux<>( - () -> listSinglePageAsync(billingAccountName, billingProfileName, invoiceSectionName, context), - nextLink -> listNextSinglePageAsync(nextLink, context)); + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (billingAccountName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingAccountName is required and cannot be null.")); + } + if (billingProfileName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter billingProfileName is required and cannot be null.")); + } + if (invoiceSectionName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter invoiceSectionName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), billingAccountName, + billingProfileName, invoiceSectionName, this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } /** @@ -706,7 +711,8 @@ private PagedFlux listAsync(String billingAccountName, Str @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String billingAccountName, String billingProfileName, String invoiceSectionName) { - return new PagedIterable<>(listAsync(billingAccountName, billingProfileName, invoiceSectionName)); + return new PagedIterable<>(() -> listSinglePage(billingAccountName, billingProfileName, invoiceSectionName), + nextLink -> listNextSinglePage(nextLink)); } /** @@ -725,7 +731,9 @@ public PagedIterable list(String billingAccountName, Strin @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String billingAccountName, String billingProfileName, String invoiceSectionName, Context context) { - return new PagedIterable<>(listAsync(billingAccountName, billingProfileName, invoiceSectionName, context)); + return new PagedIterable<>( + () -> listSinglePage(billingAccountName, billingProfileName, invoiceSectionName, context), + nextLink -> listNextSinglePage(nextLink, context)); } /** @@ -754,6 +762,33 @@ private Mono> listNextSinglePageAsync(String .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of transfers initiated by caller along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + /** * Get the next page of items. * @@ -762,22 +797,25 @@ private Mono> listNextSinglePageAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of transfers initiated by caller along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * @return the list of transfers initiated by caller along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { + private PagedResponse listNextSinglePage(String nextLink, Context context) { if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + throw LOGGER.atError() + .log(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.")); + throw LOGGER.atError() + .log(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)); + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); } + + private static final ClientLogger LOGGER = new ClientLogger(TransfersClientImpl.class); } 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 index 4bf3ca182ad0..c9c4ffba3e93 100644 --- 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 @@ -207,7 +207,7 @@ public interface BillingSubscription { /** * Gets the offerId property: The offer ID for the subscription. This field is only available for the Microsoft - * Online Services Program billing accounts. + * Online Services Program billing accounts or billing accounts with agreement type Enterprise Agreement. * * @return the offerId value. */ diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionAlias.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionAlias.java index e7691d88e3a7..8d7b80b18876 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionAlias.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionAlias.java @@ -230,7 +230,7 @@ public interface BillingSubscriptionAlias { /** * Gets the offerId property: The offer ID for the subscription. This field is only available for the Microsoft - * Online Services Program billing accounts. + * Online Services Program billing accounts or billing accounts with agreement type Enterprise Agreement. * * @return the offerId value. */ diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionPatch.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionPatch.java index 0662e65286b0..fe4338a6dace 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionPatch.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/BillingSubscriptionPatch.java @@ -434,7 +434,7 @@ public NextBillingCycleDetails nextBillingCycleDetails() { /** * Get the offerId property: The offer ID for the subscription. This field is only available for the Microsoft - * Online Services Program billing accounts. + * Online Services Program billing accounts or billing accounts with agreement type Enterprise Agreement. * * @return the offerId value. */ diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransactionProperties.java b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransactionProperties.java index a9a64c5065c4..6e0ac3703f1a 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransactionProperties.java +++ b/sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/TransactionProperties.java @@ -1064,7 +1064,9 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeJsonField("azureCreditApplied", this.azureCreditApplied); jsonWriter.writeStringField("azurePlan", this.azurePlan); jsonWriter.writeStringField("billingCurrency", this.billingCurrency); - jsonWriter.writeUntypedField("billingProfileDisplayName", this.billingProfileDisplayName); + if (this.billingProfileDisplayName != null) { + jsonWriter.writeUntypedField("billingProfileDisplayName", this.billingProfileDisplayName); + } jsonWriter.writeStringField("billingProfileId", this.billingProfileId); jsonWriter.writeJsonField("consumptionCommitmentDecremented", this.consumptionCommitmentDecremented); jsonWriter.writeStringField("customerDisplayName", this.customerDisplayName); diff --git a/sdk/billing/azure-resourcemanager-billing/src/main/resources/azure-resourcemanager-billing.properties b/sdk/billing/azure-resourcemanager-billing/src/main/resources/azure-resourcemanager-billing.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/billing/azure-resourcemanager-billing/src/main/resources/azure-resourcemanager-billing.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/billing/azure-resourcemanager-billing/src/samples/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsCancelSamples.java b/sdk/billing/azure-resourcemanager-billing/src/samples/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsCancelSamples.java index b8ed15673cc4..44299ac004db 100644 --- a/sdk/billing/azure-resourcemanager-billing/src/samples/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsCancelSamples.java +++ b/sdk/billing/azure-resourcemanager-billing/src/samples/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsCancelSamples.java @@ -4,8 +4,8 @@ package com.azure.resourcemanager.billing.generated; -import com.azure.resourcemanager.billing.models.CancellationReason; import com.azure.resourcemanager.billing.models.CancelSubscriptionRequest; +import com.azure.resourcemanager.billing.models.CancellationReason; /** * Samples for BillingSubscriptions Cancel. diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AcceptTransferPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AcceptTransferPropertiesTests.java deleted file mode 100644 index f69422954319..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AcceptTransferPropertiesTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.AcceptTransferProperties; -import com.azure.resourcemanager.billing.models.ProductDetails; -import com.azure.resourcemanager.billing.models.ProductType; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class AcceptTransferPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AcceptTransferProperties model = BinaryData.fromString( - "{\"productDetails\":[{\"productType\":\"AzureSubscription\",\"productId\":\"dmkr\"},{\"productType\":\"AzureSubscription\",\"productId\":\"gqvqokqluj\"},{\"productType\":\"AzureSubscription\",\"productId\":\"abwlyvx\"}]}") - .toObject(AcceptTransferProperties.class); - Assertions.assertEquals(ProductType.AZURE_SUBSCRIPTION, model.productDetails().get(0).productType()); - Assertions.assertEquals("dmkr", model.productDetails().get(0).productId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AcceptTransferProperties model = new AcceptTransferProperties().withProductDetails( - Arrays.asList(new ProductDetails().withProductType(ProductType.AZURE_SUBSCRIPTION).withProductId("dmkr"), - new ProductDetails().withProductType(ProductType.AZURE_SUBSCRIPTION).withProductId("gqvqokqluj"), - new ProductDetails().withProductType(ProductType.AZURE_SUBSCRIPTION).withProductId("abwlyvx"))); - model = BinaryData.fromObject(model).toObject(AcceptTransferProperties.class); - Assertions.assertEquals(ProductType.AZURE_SUBSCRIPTION, model.productDetails().get(0).productType()); - Assertions.assertEquals("dmkr", model.productDetails().get(0).productId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AcceptTransferRequestTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AcceptTransferRequestTests.java deleted file mode 100644 index 37b5ad9474ba..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AcceptTransferRequestTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.AcceptTransferRequest; -import com.azure.resourcemanager.billing.models.ProductDetails; -import com.azure.resourcemanager.billing.models.ProductType; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class AcceptTransferRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AcceptTransferRequest model = BinaryData - .fromString( - "{\"properties\":{\"productDetails\":[{\"productType\":\"SAAS\",\"productId\":\"ktyhhmvfxl\"}]}}") - .toObject(AcceptTransferRequest.class); - Assertions.assertEquals(ProductType.SAAS, model.productDetails().get(0).productType()); - Assertions.assertEquals("ktyhhmvfxl", model.productDetails().get(0).productId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AcceptTransferRequest model = new AcceptTransferRequest().withProductDetails( - Arrays.asList(new ProductDetails().withProductType(ProductType.SAAS).withProductId("ktyhhmvfxl"))); - model = BinaryData.fromObject(model).toObject(AcceptTransferRequest.class); - Assertions.assertEquals(ProductType.SAAS, model.productDetails().get(0).productType()); - Assertions.assertEquals("ktyhhmvfxl", model.productDetails().get(0).productId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AgreementInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AgreementInnerTests.java deleted file mode 100644 index 6c7fafba4747..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AgreementInnerTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.AgreementInner; -import com.azure.resourcemanager.billing.models.AgreementProperties; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AgreementInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AgreementInner model = BinaryData.fromString( - "{\"properties\":{\"acceptanceMode\":\"PhysicalSign\",\"agreementLink\":\"uv\",\"billingProfileInfo\":[{\"billingAccountId\":\"ybczmehmtzo\",\"billingProfileDisplayName\":\"sphrupidgs\",\"billingProfileId\":\"bejhphoycmsxa\",\"billingProfileSystemId\":\"hdxbmtqio\",\"indirectRelationshipOrganizationName\":\"zehtbmu\"}],\"category\":\"UKCloudComputeFramework\",\"displayName\":\"noi\",\"effectiveDate\":\"2021-08-05T07:19:53Z\",\"expirationDate\":\"2021-12-07T12:09:55Z\",\"participants\":[{\"email\":\"qsoqijgkd\",\"status\":\"pazlobcufpdz\",\"statusDate\":\"2021-10-17T14:34:33Z\"},{\"email\":\"cqqjnqglhqgn\",\"status\":\"ooojywifsqe\",\"statusDate\":\"2021-01-27T01:57:14Z\"},{\"email\":\"dfmglzlhjx\",\"status\":\"f\",\"statusDate\":\"2021-09-21T00:46:54Z\"}],\"status\":\"vktsizntocipao\",\"leadBillingAccountName\":\"jpsq\"},\"tags\":{\"gjofjd\":\"poyfdkfogkn\",\"zyf\":\"eqsrdeupewnwreit\"},\"id\":\"sarhmofc\",\"name\":\"hs\",\"type\":\"yurkdtmlxhekuksj\"}") - .toObject(AgreementInner.class); - Assertions.assertEquals("poyfdkfogkn", model.tags().get("gjofjd")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AgreementInner model = new AgreementInner().withTags(mapOf("gjofjd", "poyfdkfogkn", "zyf", "eqsrdeupewnwreit")) - .withProperties(new AgreementProperties()); - model = BinaryData.fromObject(model).toObject(AgreementInner.class); - Assertions.assertEquals("poyfdkfogkn", model.tags().get("gjofjd")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AgreementListResultTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AgreementListResultTests.java deleted file mode 100644 index 2833f3f2e67e..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AgreementListResultTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.AgreementListResult; - -public final class AgreementListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AgreementListResult model = BinaryData.fromString( - "{\"nextLink\":\"jaeq\",\"value\":[{\"properties\":{\"acceptanceMode\":\"PhysicalSign\",\"agreementLink\":\"v\",\"billingProfileInfo\":[{\"billingAccountId\":\"qulngsntnbybkzgc\",\"billingProfileDisplayName\":\"wclxxwrl\",\"billingProfileId\":\"ouskcqvkocrc\",\"billingProfileSystemId\":\"kwt\",\"indirectRelationshipOrganizationName\":\"xbnjbiksq\"},{\"billingAccountId\":\"lssai\",\"billingProfileDisplayName\":\"p\",\"billingProfileId\":\"nzl\",\"billingProfileSystemId\":\"fmppe\",\"indirectRelationshipOrganizationName\":\"vmgxsab\"},{\"billingAccountId\":\"qduujitcjczdz\",\"billingProfileDisplayName\":\"ndhkrw\",\"billingProfileId\":\"appd\",\"billingProfileSystemId\":\"dkvwrwjfe\",\"indirectRelationshipOrganizationName\":\"nhutjeltmrldhugj\"}],\"category\":\"MicrosoftCustomerAgreement\",\"displayName\":\"tqxhocdgeab\",\"effectiveDate\":\"2021-05-27T22:50:20Z\",\"expirationDate\":\"2021-10-17T04:41:11Z\",\"participants\":[{\"email\":\"ndv\",\"status\":\"ozwyiftyhxhuro\",\"statusDate\":\"2020-12-20T08:53:33Z\"},{\"email\":\"xolniwpwcukjfk\",\"status\":\"awxklr\",\"statusDate\":\"2021-02-17T21:17:55Z\"},{\"email\":\"ckbasyypndd\",\"status\":\"gcbacphejkot\",\"statusDate\":\"2021-05-11T13:05:51Z\"},{\"email\":\"oulzndlikwyq\",\"status\":\"fgibmadgakeq\",\"statusDate\":\"2021-06-20T22:32:23Z\"}],\"status\":\"bzqqedqytbciq\",\"leadBillingAccountName\":\"uflmm\"},\"tags\":{\"b\":\"smodmgloug\"},\"id\":\"tmut\",\"name\":\"uqktap\",\"type\":\"pwgcuertu\"},{\"properties\":{\"acceptanceMode\":\"PhysicalSign\",\"agreementLink\":\"vqwhbmdgbbjfd\",\"billingProfileInfo\":[{\"billingAccountId\":\"mbe\",\"billingProfileDisplayName\":\"pbhtqqrolfpfpsa\",\"billingProfileId\":\"bquxigjy\",\"billingProfileSystemId\":\"zjaoyfhrtxil\",\"indirectRelationshipOrganizationName\":\"rkujy\"},{\"billingAccountId\":\"l\",\"billingProfileDisplayName\":\"uvfqawrlyxwj\",\"billingProfileId\":\"prbnwbxgjvtbv\",\"billingProfileSystemId\":\"sszdnru\",\"indirectRelationshipOrganizationName\":\"guhmuouqfpr\"},{\"billingAccountId\":\"wbnguitnwui\",\"billingProfileDisplayName\":\"a\",\"billingProfileId\":\"ufizuckyf\",\"billingProfileSystemId\":\"rfidfvzwdz\",\"indirectRelationshipOrganizationName\":\"tymw\"}],\"category\":\"MicrosoftPartnerAgreement\",\"displayName\":\"fthwxmnteiwa\",\"effectiveDate\":\"2021-07-09T10:48:35Z\",\"expirationDate\":\"2021-04-07T17:13:30Z\",\"participants\":[{\"email\":\"mmxdcu\",\"status\":\"fsrpymzidnse\",\"statusDate\":\"2021-09-08T03:00:46Z\"},{\"email\":\"bzsgfyccsne\",\"status\":\"dwzjeiach\",\"statusDate\":\"2021-09-14T11:53:52Z\"},{\"email\":\"flnrosfqpteehzz\",\"status\":\"pyqr\",\"statusDate\":\"2021-02-03T19:04:42Z\"},{\"email\":\"npvswjdkirso\",\"status\":\"qxhcrmn\",\"statusDate\":\"2021-05-15T08:21:17Z\"}],\"status\":\"ckwhds\",\"leadBillingAccountName\":\"fiyipjxsqwpgrj\"},\"tags\":{\"qabnmoc\":\"orcjxvsnby\",\"toqcjmklja\":\"cyshurzafbljjgp\",\"yulpkudjkr\":\"bqidtqaj\",\"e\":\"khbzhfepgzg\"},\"id\":\"locx\",\"name\":\"c\",\"type\":\"aierhhb\"}]}") - .toObject(AgreementListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AgreementListResult model = new AgreementListResult(); - model = BinaryData.fromObject(model).toObject(AgreementListResult.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AgreementPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AgreementPropertiesTests.java deleted file mode 100644 index e0ff61988e03..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AgreementPropertiesTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.AgreementProperties; - -public final class AgreementPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AgreementProperties model = BinaryData.fromString( - "{\"acceptanceMode\":\"Other\",\"agreementLink\":\"cdm\",\"billingProfileInfo\":[{\"billingAccountId\":\"ryuanzwuxzdxtay\",\"billingProfileDisplayName\":\"hmwhfpmrqo\",\"billingProfileId\":\"tu\",\"billingProfileSystemId\":\"nryrtihf\",\"indirectRelationshipOrganizationName\":\"ijbpzvgnwzsymgl\"},{\"billingAccountId\":\"fcyzkohdbihanufh\",\"billingProfileDisplayName\":\"bj\",\"billingProfileId\":\"a\",\"billingProfileSystemId\":\"th\",\"indirectRelationshipOrganizationName\":\"hab\"},{\"billingAccountId\":\"pikxwczbyscnpqxu\",\"billingProfileDisplayName\":\"vyq\",\"billingProfileId\":\"wby\",\"billingProfileSystemId\":\"k\",\"indirectRelationshipOrganizationName\":\"dumjgrtfwvuk\"},{\"billingAccountId\":\"audccsnhs\",\"billingProfileDisplayName\":\"nyejhkryhtnap\",\"billingProfileId\":\"wlokjyem\",\"billingProfileSystemId\":\"vnipjox\",\"indirectRelationshipOrganizationName\":\"nchgej\"}],\"category\":\"AffiliatePurchaseTerms\",\"displayName\":\"mailzydehojw\",\"effectiveDate\":\"2021-10-12T05:13:50Z\",\"expirationDate\":\"2021-07-17T00:42:06Z\",\"participants\":[{\"email\":\"mqnjaqw\",\"status\":\"jsprozvcpute\",\"statusDate\":\"2021-06-05T01:38:25Z\"},{\"email\":\"mfdatscmdvpj\",\"status\":\"lsuuvmkjozkrwfnd\",\"statusDate\":\"2021-06-07T05:45:20Z\"},{\"email\":\"pslwejdpvw\",\"status\":\"oqpsoa\",\"statusDate\":\"2021-07-20T12:53:26Z\"},{\"email\":\"zakljlahbc\",\"status\":\"ffdfdosygexpa\",\"statusDate\":\"2021-04-29T11:27:29Z\"}],\"status\":\"hmsbzjhcrzevdp\",\"leadBillingAccountName\":\"xaolth\"}") - .toObject(AgreementProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AgreementProperties model = new AgreementProperties(); - model = BinaryData.fromObject(model).toObject(AgreementProperties.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AgreementsGetWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AgreementsGetWithResponseMockTests.java deleted file mode 100644 index b01e93c7d233..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AgreementsGetWithResponseMockTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.Agreement; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class AgreementsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"acceptanceMode\":\"ESignOffline\",\"agreementLink\":\"tdds\",\"billingProfileInfo\":[{\"billingAccountId\":\"pnouhbqezkqx\",\"billingProfileDisplayName\":\"lu\",\"billingProfileId\":\"igfcvcewbwqhd\",\"billingProfileSystemId\":\"jsatm\",\"indirectRelationshipOrganizationName\":\"c\"},{\"billingAccountId\":\"zdfsqxhyqmr\",\"billingProfileDisplayName\":\"parn\",\"billingProfileId\":\"grszrbwtdrcwg\",\"billingProfileSystemId\":\"ll\",\"indirectRelationshipOrganizationName\":\"lhhfi\"},{\"billingAccountId\":\"cfculzj\",\"billingProfileDisplayName\":\"hp\",\"billingProfileId\":\"wvyldqpzf\",\"billingProfileSystemId\":\"soxinu\",\"indirectRelationshipOrganizationName\":\"lzkdrocqsxy\"}],\"category\":\"IndirectForGovernmentAgreement\",\"displayName\":\"cmiwdw\",\"effectiveDate\":\"2021-10-07T11:57Z\",\"expirationDate\":\"2021-10-01T08:58:47Z\",\"participants\":[{\"email\":\"ajamc\",\"status\":\"yh\",\"statusDate\":\"2021-02-08T06:18:05Z\"},{\"email\":\"c\",\"status\":\"yklleynqanhkiggl\",\"statusDate\":\"2021-08-29T00:53:27Z\"}],\"status\":\"lhv\",\"leadBillingAccountName\":\"hg\"},\"tags\":{\"alec\":\"etxdqcmyctajqzj\",\"egyxsbfpzvoik\":\"bibiwks\",\"pblalhhez\":\"ntwczfzwushlc\",\"qdsgptotxj\":\"fkissaidqzsaa\"},\"id\":\"ia\",\"name\":\"cnlrt\",\"type\":\"fijzz\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Agreement response = manager.agreements() - .getWithResponse("kvycqqqdseipnquw", "xhrptyodlh", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("etxdqcmyctajqzj", response.tags().get("alec")); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AgreementsListByBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AgreementsListByBillingAccountMockTests.java deleted file mode 100644 index d07e0548fd5b..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AgreementsListByBillingAccountMockTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.Agreement; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class AgreementsListByBillingAccountMockTests { - @Test - public void testListByBillingAccount() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"acceptanceMode\":\"Implicit\",\"agreementLink\":\"eopex\",\"billingProfileInfo\":[{\"billingAccountId\":\"dwrswyiljpi\",\"billingProfileDisplayName\":\"gxyxyauxredd\",\"billingProfileId\":\"mcnltmwytkujsqyc\",\"billingProfileSystemId\":\"oxfab\",\"indirectRelationshipOrganizationName\":\"gpwb\"}],\"category\":\"IndirectForGovernmentAgreement\",\"displayName\":\"ialiwry\",\"effectiveDate\":\"2021-12-08T20:40:38Z\",\"expirationDate\":\"2021-06-19T07:09:30Z\",\"participants\":[{\"email\":\"bphct\",\"status\":\"bibticuhqvum\",\"statusDate\":\"2021-01-28T06:24:15Z\"},{\"email\":\"sfeqbbe\",\"status\":\"cuq\",\"statusDate\":\"2021-09-17T00:32:07Z\"},{\"email\":\"xmzrmtmvwitu\",\"status\":\"yyjshcybwfuppo\",\"statusDate\":\"2021-01-28T05:44:39Z\"}],\"status\":\"mvouujxdii\",\"leadBillingAccountName\":\"oxrezsvavlrxik\"},\"tags\":{\"fncn\":\"ywlunpipcwybs\",\"saebwfwhxorpwal\":\"atpf\",\"ojfccylhtrht\":\"zwuge\",\"zp\":\"vazjpwexcd\"},\"id\":\"bzzxezm\",\"name\":\"rkjg\",\"type\":\"jeuxsphlo\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.agreements().listByBillingAccount("aoijolb", "a", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("ywlunpipcwybs", response.iterator().next().tags().get("fncn")); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AmountTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AmountTests.java deleted file mode 100644 index e2a04710f9ae..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AmountTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.Amount; - -public final class AmountTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Amount model - = BinaryData.fromString("{\"currency\":\"dwtiukbldngkp\",\"value\":96.508446}").toObject(Amount.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Amount model = new Amount(); - model = BinaryData.fromObject(model).toObject(Amount.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AppliedScopePropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AppliedScopePropertiesTests.java deleted file mode 100644 index 08c1777c5253..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AppliedScopePropertiesTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.AppliedScopeProperties; -import org.junit.jupiter.api.Assertions; - -public final class AppliedScopePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AppliedScopeProperties model = BinaryData.fromString( - "{\"tenantId\":\"uvyinzqodfvpgs\",\"managementGroupId\":\"xgsg\",\"subscriptionId\":\"fgzdjtxvz\",\"resourceGroupId\":\"bqvgaqv\",\"displayName\":\"a\"}") - .toObject(AppliedScopeProperties.class); - Assertions.assertEquals("uvyinzqodfvpgs", model.tenantId()); - Assertions.assertEquals("xgsg", model.managementGroupId()); - Assertions.assertEquals("fgzdjtxvz", model.subscriptionId()); - Assertions.assertEquals("bqvgaqv", model.resourceGroupId()); - Assertions.assertEquals("a", model.displayName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AppliedScopeProperties model = new AppliedScopeProperties().withTenantId("uvyinzqodfvpgs") - .withManagementGroupId("xgsg") - .withSubscriptionId("fgzdjtxvz") - .withResourceGroupId("bqvgaqv") - .withDisplayName("a"); - model = BinaryData.fromObject(model).toObject(AppliedScopeProperties.class); - Assertions.assertEquals("uvyinzqodfvpgs", model.tenantId()); - Assertions.assertEquals("xgsg", model.managementGroupId()); - Assertions.assertEquals("fgzdjtxvz", model.subscriptionId()); - Assertions.assertEquals("bqvgaqv", model.resourceGroupId()); - Assertions.assertEquals("a", model.displayName()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantInnerTests.java deleted file mode 100644 index 7846f9ad91b9..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantInnerTests.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.AssociatedTenantInner; -import com.azure.resourcemanager.billing.models.AssociatedTenantProperties; -import com.azure.resourcemanager.billing.models.BillingManagementTenantState; -import com.azure.resourcemanager.billing.models.ProvisioningTenantState; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AssociatedTenantInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AssociatedTenantInner model = BinaryData.fromString( - "{\"properties\":{\"provisioningState\":\"Expired\",\"displayName\":\"mmajtjaodx\",\"tenantId\":\"nbdxk\",\"billingManagementState\":\"Other\",\"provisioningManagementState\":\"Active\",\"provisioningBillingRequestId\":\"jionpimexgstxgc\"},\"tags\":{\"djwzrlov\":\"gmaajrm\"},\"id\":\"lwhijcoejctbzaq\",\"name\":\"qsycbkbfkgu\",\"type\":\"dkexxppofm\"}") - .toObject(AssociatedTenantInner.class); - Assertions.assertEquals("gmaajrm", model.tags().get("djwzrlov")); - Assertions.assertEquals("mmajtjaodx", model.properties().displayName()); - Assertions.assertEquals("nbdxk", model.properties().tenantId()); - Assertions.assertEquals(BillingManagementTenantState.OTHER, model.properties().billingManagementState()); - Assertions.assertEquals(ProvisioningTenantState.ACTIVE, model.properties().provisioningManagementState()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AssociatedTenantInner model = new AssociatedTenantInner().withTags(mapOf("djwzrlov", "gmaajrm")) - .withProperties(new AssociatedTenantProperties().withDisplayName("mmajtjaodx") - .withTenantId("nbdxk") - .withBillingManagementState(BillingManagementTenantState.OTHER) - .withProvisioningManagementState(ProvisioningTenantState.ACTIVE)); - model = BinaryData.fromObject(model).toObject(AssociatedTenantInner.class); - Assertions.assertEquals("gmaajrm", model.tags().get("djwzrlov")); - Assertions.assertEquals("mmajtjaodx", model.properties().displayName()); - Assertions.assertEquals("nbdxk", model.properties().tenantId()); - Assertions.assertEquals(BillingManagementTenantState.OTHER, model.properties().billingManagementState()); - Assertions.assertEquals(ProvisioningTenantState.ACTIVE, model.properties().provisioningManagementState()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantListResultTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantListResultTests.java deleted file mode 100644 index 4c87c9d971ff..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantListResultTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.AssociatedTenantListResult; - -public final class AssociatedTenantListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AssociatedTenantListResult model = BinaryData.fromString( - "{\"nextLink\":\"ndei\",\"value\":[{\"properties\":{\"provisioningState\":\"Expired\",\"displayName\":\"aoqvuh\",\"tenantId\":\"cffcyddglmj\",\"billingManagementState\":\"Active\",\"provisioningManagementState\":\"Revoked\",\"provisioningBillingRequestId\":\"pyeicxm\"},\"tags\":{\"pbobjo\":\"wqvhkhixuigdt\",\"w\":\"hm\"},\"id\":\"m\",\"name\":\"uhrzayvvt\",\"type\":\"gvdfgiotkftutq\"},{\"properties\":{\"provisioningState\":\"Creating\",\"displayName\":\"lefgugnxk\",\"tenantId\":\"dqmidtt\",\"billingManagementState\":\"NotAllowed\",\"provisioningManagementState\":\"Other\",\"provisioningBillingRequestId\":\"rabhjybigeho\"},\"tags\":{\"cuiywgqyw\":\"owskanyktz\",\"phrcgyncoc\":\"ndrvynhzg\"},\"id\":\"cfvmmco\",\"name\":\"fsxlzevgbmqjqa\",\"type\":\"c\"},{\"properties\":{\"provisioningState\":\"New\",\"displayName\":\"kwlzuvccfwnfn\",\"tenantId\":\"cfionl\",\"billingManagementState\":\"Other\",\"provisioningManagementState\":\"Pending\",\"provisioningBillingRequestId\":\"gtzxdpn\"},\"tags\":{\"ubisnjampmng\":\"qwxrjfeallnw\"},\"id\":\"scxaq\",\"name\":\"ooch\",\"type\":\"bonqvpkvlrxnjeas\"},{\"properties\":{\"provisioningState\":\"Succeeded\",\"displayName\":\"oflokey\",\"tenantId\":\"enjbdlwtgrhp\",\"billingManagementState\":\"Other\",\"provisioningManagementState\":\"BillingRequestExpired\",\"provisioningBillingRequestId\":\"asxazjpqyegualhb\"},\"tags\":{\"jzzvdud\":\"e\",\"pwlbjnpg\":\"wdslfhotwmcy\"},\"id\":\"ftadehxnltyfs\",\"name\":\"ppusuesnzwdejba\",\"type\":\"orxzdmohctbqvud\"}]}") - .toObject(AssociatedTenantListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AssociatedTenantListResult model = new AssociatedTenantListResult(); - model = BinaryData.fromObject(model).toObject(AssociatedTenantListResult.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantPropertiesTests.java deleted file mode 100644 index 3f27e2f357b8..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantPropertiesTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.AssociatedTenantProperties; -import com.azure.resourcemanager.billing.models.BillingManagementTenantState; -import com.azure.resourcemanager.billing.models.ProvisioningTenantState; -import org.junit.jupiter.api.Assertions; - -public final class AssociatedTenantPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AssociatedTenantProperties model = BinaryData.fromString( - "{\"provisioningState\":\"Created\",\"displayName\":\"fjpgddtocjjxhvp\",\"tenantId\":\"uexhdzx\",\"billingManagementState\":\"Revoked\",\"provisioningManagementState\":\"Pending\",\"provisioningBillingRequestId\":\"nxqbzvddn\"}") - .toObject(AssociatedTenantProperties.class); - Assertions.assertEquals("fjpgddtocjjxhvp", model.displayName()); - Assertions.assertEquals("uexhdzx", model.tenantId()); - Assertions.assertEquals(BillingManagementTenantState.REVOKED, model.billingManagementState()); - Assertions.assertEquals(ProvisioningTenantState.PENDING, model.provisioningManagementState()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AssociatedTenantProperties model = new AssociatedTenantProperties().withDisplayName("fjpgddtocjjxhvp") - .withTenantId("uexhdzx") - .withBillingManagementState(BillingManagementTenantState.REVOKED) - .withProvisioningManagementState(ProvisioningTenantState.PENDING); - model = BinaryData.fromObject(model).toObject(AssociatedTenantProperties.class); - Assertions.assertEquals("fjpgddtocjjxhvp", model.displayName()); - Assertions.assertEquals("uexhdzx", model.tenantId()); - Assertions.assertEquals(BillingManagementTenantState.REVOKED, model.billingManagementState()); - Assertions.assertEquals(ProvisioningTenantState.PENDING, model.provisioningManagementState()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantsCreateOrUpdateMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantsCreateOrUpdateMockTests.java deleted file mode 100644 index 6892a2655167..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantsCreateOrUpdateMockTests.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.fluent.models.AssociatedTenantInner; -import com.azure.resourcemanager.billing.models.AssociatedTenant; -import com.azure.resourcemanager.billing.models.AssociatedTenantProperties; -import com.azure.resourcemanager.billing.models.BillingManagementTenantState; -import com.azure.resourcemanager.billing.models.ProvisioningTenantState; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class AssociatedTenantsCreateOrUpdateMockTests { - @Test - public void testCreateOrUpdate() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"displayName\":\"oyvhtuqbpeln\",\"tenantId\":\"bncgagdvcdqhftzb\",\"billingManagementState\":\"NotAllowed\",\"provisioningManagementState\":\"Revoked\",\"provisioningBillingRequestId\":\"df\"},\"tags\":{\"rf\":\"ncwmhjob\",\"dc\":\"ri\",\"f\":\"h\",\"oorssatfy\":\"cvbzwgwhgkgsoa\"},\"id\":\"pufdmxuqbdqn\",\"name\":\"sttuxv\",\"type\":\"fqayopbtsix\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - AssociatedTenant response = manager.associatedTenants() - .createOrUpdate("cqzoofjnqjsve", "fbhtleberp", - new AssociatedTenantInner() - .withTags(mapOf("uqlhfwaf", "wonoehr", "guyfazbkocbygvt", "jzmpy", "aw", "rmxkbcjwwdxom", - "gaedaoiq", "pkeboozflyac")) - .withProperties(new AssociatedTenantProperties().withDisplayName("nfqnwj") - .withTenantId("xowkdnj") - .withBillingManagementState(BillingManagementTenantState.OTHER) - .withProvisioningManagementState(ProvisioningTenantState.REVOKED)), - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("ncwmhjob", response.tags().get("rf")); - Assertions.assertEquals("oyvhtuqbpeln", response.properties().displayName()); - Assertions.assertEquals("bncgagdvcdqhftzb", response.properties().tenantId()); - Assertions.assertEquals(BillingManagementTenantState.NOT_ALLOWED, - response.properties().billingManagementState()); - Assertions.assertEquals(ProvisioningTenantState.REVOKED, response.properties().provisioningManagementState()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantsGetWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantsGetWithResponseMockTests.java deleted file mode 100644 index 79d708b0339f..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantsGetWithResponseMockTests.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AssociatedTenant; -import com.azure.resourcemanager.billing.models.BillingManagementTenantState; -import com.azure.resourcemanager.billing.models.ProvisioningTenantState; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class AssociatedTenantsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"displayName\":\"ambhbafebzxf\",\"tenantId\":\"qutibhl\",\"billingManagementState\":\"Active\",\"provisioningManagementState\":\"Other\",\"provisioningBillingRequestId\":\"rkp\"},\"tags\":{\"xvzmlghny\":\"d\",\"pye\":\"v\",\"xvhhyqq\":\"ukppdixqbo\",\"xch\":\"gatxgrznmginmtsd\"},\"id\":\"ibmg\",\"name\":\"ymncjc\",\"type\":\"gair\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - AssociatedTenant response = manager.associatedTenants() - .getWithResponse("fpmijpdvzvfbhwbd", "ufvcgnrgl", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("d", response.tags().get("xvzmlghny")); - Assertions.assertEquals("ambhbafebzxf", response.properties().displayName()); - Assertions.assertEquals("qutibhl", response.properties().tenantId()); - Assertions.assertEquals(BillingManagementTenantState.ACTIVE, response.properties().billingManagementState()); - Assertions.assertEquals(ProvisioningTenantState.OTHER, response.properties().provisioningManagementState()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantsListByBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantsListByBillingAccountMockTests.java deleted file mode 100644 index e5e4ed7b89d3..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AssociatedTenantsListByBillingAccountMockTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AssociatedTenant; -import com.azure.resourcemanager.billing.models.BillingManagementTenantState; -import com.azure.resourcemanager.billing.models.ProvisioningTenantState; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class AssociatedTenantsListByBillingAccountMockTests { - @Test - public void testListByBillingAccount() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"provisioningState\":\"Succeeded\",\"displayName\":\"ypwyiulayno\",\"tenantId\":\"gkfh\",\"billingManagementState\":\"Active\",\"provisioningManagementState\":\"BillingRequestExpired\",\"provisioningBillingRequestId\":\"smwgsghqucumldd\"},\"tags\":{\"feothxu\":\"ml\"},\"id\":\"igrjdljlkqhvkrbz\",\"name\":\"uast\",\"type\":\"xk\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.associatedTenants() - .listByBillingAccount("gvbhxmndztgs", false, "ayqmarxneibpgbrh", "jdqknhqn", 4606678382697661021L, - 8293041789953549022L, false, "nnohmmzngo", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("ml", response.iterator().next().tags().get("feothxu")); - Assertions.assertEquals("ypwyiulayno", response.iterator().next().properties().displayName()); - Assertions.assertEquals("gkfh", response.iterator().next().properties().tenantId()); - Assertions.assertEquals(BillingManagementTenantState.ACTIVE, - response.iterator().next().properties().billingManagementState()); - Assertions.assertEquals(ProvisioningTenantState.BILLING_REQUEST_EXPIRED, - response.iterator().next().properties().provisioningManagementState()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalanceInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalanceInnerTests.java deleted file mode 100644 index 02e2e86bb83f..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalanceInnerTests.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.AvailableBalanceInner; -import com.azure.resourcemanager.billing.models.AvailableBalanceProperties; -import com.azure.resourcemanager.billing.models.AvailableBalancePropertiesAmount; -import com.azure.resourcemanager.billing.models.AvailableBalancePropertiesTotalPaymentsOnAccount; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class AvailableBalanceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AvailableBalanceInner model = BinaryData.fromString( - "{\"properties\":{\"amount\":{\"currency\":\"dnvowg\",\"value\":70.59679},\"paymentsOnAccount\":[{\"amount\":{\"currency\":\"kcglhslaz\",\"value\":50.55987},\"billingProfileId\":\"gdtjixhbkuofqwey\",\"billingProfileDisplayName\":\"menevfyexfwh\",\"invoiceId\":\"cibvyvdcsitynn\",\"invoiceName\":\"mdectehfiqscjey\",\"date\":\"2021-03-08T20:07:33Z\",\"paymentMethodType\":\"TaskOrder\"},{\"amount\":{\"currency\":\"gqhcjrefovg\",\"value\":15.571833},\"billingProfileId\":\"leyyvx\",\"billingProfileDisplayName\":\"jpkcattpng\",\"invoiceId\":\"rcczsqpjhvmd\",\"invoiceName\":\"v\",\"date\":\"2021-09-30T19:57Z\",\"paymentMethodType\":\"CheckWire\"},{\"amount\":{\"currency\":\"e\",\"value\":21.057589},\"billingProfileId\":\"ae\",\"billingProfileDisplayName\":\"fhyhltrpmopjmcma\",\"invoiceId\":\"okth\",\"invoiceName\":\"iuaod\",\"date\":\"2021-03-11T15:37:41Z\",\"paymentMethodType\":\"CreditCard\"}],\"totalPaymentsOnAccount\":{\"currency\":\"odpuozmyzydag\",\"value\":52.79117}},\"tags\":{\"ywqsmbsurexim\":\"ezyiuokktwhrdxw\"},\"id\":\"yocf\",\"name\":\"fksymddystki\",\"type\":\"uxh\"}") - .toObject(AvailableBalanceInner.class); - Assertions.assertEquals("ezyiuokktwhrdxw", model.tags().get("ywqsmbsurexim")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AvailableBalanceInner model = new AvailableBalanceInner().withTags(mapOf("ywqsmbsurexim", "ezyiuokktwhrdxw")) - .withProperties(new AvailableBalanceProperties().withAmount(new AvailableBalancePropertiesAmount()) - .withTotalPaymentsOnAccount(new AvailableBalancePropertiesTotalPaymentsOnAccount())); - model = BinaryData.fromObject(model).toObject(AvailableBalanceInner.class); - Assertions.assertEquals("ezyiuokktwhrdxw", model.tags().get("ywqsmbsurexim")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalancePropertiesAmountTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalancePropertiesAmountTests.java deleted file mode 100644 index f1574f4b95ad..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalancePropertiesAmountTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.AvailableBalancePropertiesAmount; - -public final class AvailableBalancePropertiesAmountTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AvailableBalancePropertiesAmount model = BinaryData.fromString("{\"currency\":\"ou\",\"value\":75.86161}") - .toObject(AvailableBalancePropertiesAmount.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AvailableBalancePropertiesAmount model = new AvailableBalancePropertiesAmount(); - model = BinaryData.fromObject(model).toObject(AvailableBalancePropertiesAmount.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalancePropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalancePropertiesTests.java deleted file mode 100644 index 31f38da52dbb..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalancePropertiesTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.AvailableBalanceProperties; -import com.azure.resourcemanager.billing.models.AvailableBalancePropertiesAmount; -import com.azure.resourcemanager.billing.models.AvailableBalancePropertiesTotalPaymentsOnAccount; - -public final class AvailableBalancePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AvailableBalanceProperties model = BinaryData.fromString( - "{\"amount\":{\"currency\":\"dxorrqnbpoczv\",\"value\":97.52604},\"paymentsOnAccount\":[{\"amount\":{\"currency\":\"dvjsllrmvvdf\",\"value\":2.8410316},\"billingProfileId\":\"pnpulexxbczwtru\",\"billingProfileDisplayName\":\"qzbqjvsov\",\"invoiceId\":\"okacspk\",\"invoiceName\":\"hzdobpxjmflbvvnc\",\"date\":\"2021-05-23T11:48:05Z\",\"paymentMethodType\":\"EWallet\"},{\"amount\":{\"currency\":\"wzjuqk\",\"value\":7.702547},\"billingProfileId\":\"jiwkuofoskghsau\",\"billingProfileDisplayName\":\"mjmvxieduugidyjr\",\"invoiceId\":\"byao\",\"invoiceName\":\"e\",\"date\":\"2021-10-23T12:01:36Z\",\"paymentMethodType\":\"None\"},{\"amount\":{\"currency\":\"lhocohslkev\",\"value\":33.826637},\"billingProfileId\":\"zfbuhf\",\"billingProfileDisplayName\":\"faxkffeii\",\"invoiceId\":\"lvmezyvshxmzsbbz\",\"invoiceName\":\"gigr\",\"date\":\"2021-05-16T13:08:42Z\",\"paymentMethodType\":\"None\"}],\"totalPaymentsOnAccount\":{\"currency\":\"xxjnspydptk\",\"value\":34.515266}}") - .toObject(AvailableBalanceProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AvailableBalanceProperties model - = new AvailableBalanceProperties().withAmount(new AvailableBalancePropertiesAmount()) - .withTotalPaymentsOnAccount(new AvailableBalancePropertiesTotalPaymentsOnAccount()); - model = BinaryData.fromObject(model).toObject(AvailableBalanceProperties.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalancePropertiesTotalPaymentsOnAccountTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalancePropertiesTotalPaymentsOnAccountTests.java deleted file mode 100644 index a9d7bda4ea0b..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalancePropertiesTotalPaymentsOnAccountTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.AvailableBalancePropertiesTotalPaymentsOnAccount; - -public final class AvailableBalancePropertiesTotalPaymentsOnAccountTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AvailableBalancePropertiesTotalPaymentsOnAccount model - = BinaryData.fromString("{\"currency\":\"buxwgip\",\"value\":26.74622}") - .toObject(AvailableBalancePropertiesTotalPaymentsOnAccount.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AvailableBalancePropertiesTotalPaymentsOnAccount model = new AvailableBalancePropertiesTotalPaymentsOnAccount(); - model = BinaryData.fromObject(model).toObject(AvailableBalancePropertiesTotalPaymentsOnAccount.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalancesGetByBillingAccountWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalancesGetByBillingAccountWithResponseMockTests.java deleted file mode 100644 index 995d9bdb0a04..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalancesGetByBillingAccountWithResponseMockTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AvailableBalance; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class AvailableBalancesGetByBillingAccountWithResponseMockTests { - @Test - public void testGetByBillingAccountWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"amount\":{\"currency\":\"zwxvscksgf\",\"value\":68.861595},\"paymentsOnAccount\":[{\"amount\":{\"currency\":\"gafxczvf\",\"value\":23.742544},\"billingProfileId\":\"rtwletyves\",\"billingProfileDisplayName\":\"tlh\",\"invoiceId\":\"hwynct\",\"invoiceName\":\"zcnjfmbbfnvjxit\",\"date\":\"2021-12-03T14:45:06Z\",\"paymentMethodType\":\"None\"},{\"amount\":{\"currency\":\"iklsmni\",\"value\":60.79074},\"billingProfileId\":\"oqksyiibhyxwbgbu\",\"billingProfileDisplayName\":\"vqdorbccqcd\",\"invoiceId\":\"hojvlirkn\",\"invoiceName\":\"osa\",\"date\":\"2021-07-27T15:49:59Z\",\"paymentMethodType\":\"CreditCard\"}],\"totalPaymentsOnAccount\":{\"currency\":\"zl\",\"value\":55.205856}},\"tags\":{\"uy\":\"xihzqjjts\",\"mcdcpkshl\":\"qfttkacybdueur\"},\"id\":\"ermhzicsbfdjhyaa\",\"name\":\"nyukibx\",\"type\":\"glhphzwx\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - AvailableBalance response = manager.availableBalances() - .getByBillingAccountWithResponse("pruulhg", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("xihzqjjts", response.tags().get("uy")); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalancesGetByBillingProfileWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalancesGetByBillingProfileWithResponseMockTests.java deleted file mode 100644 index 110995a628ba..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AvailableBalancesGetByBillingProfileWithResponseMockTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AvailableBalance; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class AvailableBalancesGetByBillingProfileWithResponseMockTests { - @Test - public void testGetByBillingProfileWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"amount\":{\"currency\":\"bylhy\",\"value\":55.25609},\"paymentsOnAccount\":[{\"amount\":{\"currency\":\"vqzrwtrd\",\"value\":45.049225},\"billingProfileId\":\"vq\",\"billingProfileDisplayName\":\"nsgnwxlwmez\",\"invoiceId\":\"hxpthceop\",\"invoiceName\":\"vtwfvesobpbokhm\",\"date\":\"2021-03-14T06:57:13Z\",\"paymentMethodType\":\"DirectDebit\"},{\"amount\":{\"currency\":\"nggcjfwblq\",\"value\":83.98086},\"billingProfileId\":\"smcolmugpy\",\"billingProfileDisplayName\":\"osdkluwzxey\",\"invoiceId\":\"vtyevjh\",\"invoiceName\":\"nobguqisqsqkpdmi\",\"date\":\"2021-09-10T10:06:52Z\",\"paymentMethodType\":\"CreditCard\"},{\"amount\":{\"currency\":\"viqcpszp\",\"value\":92.64978},\"billingProfileId\":\"dv\",\"billingProfileDisplayName\":\"mvxyrxdh\",\"invoiceId\":\"qojbxao\",\"invoiceName\":\"gbzxmbtplefoioy\",\"date\":\"2021-10-15T06:52:33Z\",\"paymentMethodType\":\"None\"}],\"totalPaymentsOnAccount\":{\"currency\":\"gvdtmuuv\",\"value\":48.35115}},\"tags\":{\"zutylcu\":\"mrszbknimxlpnerx\",\"mnb\":\"za\",\"bjmbnvynfaooeac\":\"qaeht\",\"kakddidahzllrqm\":\"edcgl\"},\"id\":\"pbyxroiduyqy\",\"name\":\"ffmnoiics\",\"type\":\"dyhbrjj\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - AvailableBalance response = manager.availableBalances() - .getByBillingProfileWithResponse("tej", "iilhvtozyagj", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("mrszbknimxlpnerx", response.tags().get("zutylcu")); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AzurePlanTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AzurePlanTests.java deleted file mode 100644 index b8dc53e6caad..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/AzurePlanTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.AzurePlan; -import org.junit.jupiter.api.Assertions; - -public final class AzurePlanTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - AzurePlan model - = BinaryData.fromString("{\"productId\":\"zb\",\"skuId\":\"uebbaumnyqup\",\"skuDescription\":\"eojnabc\"}") - .toObject(AzurePlan.class); - Assertions.assertEquals("zb", model.productId()); - Assertions.assertEquals("uebbaumnyqup", model.skuId()); - Assertions.assertEquals("eojnabc", model.skuDescription()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - AzurePlan model = new AzurePlan().withProductId("zb").withSkuId("uebbaumnyqup").withSkuDescription("eojnabc"); - model = BinaryData.fromObject(model).toObject(AzurePlan.class); - Assertions.assertEquals("zb", model.productId()); - Assertions.assertEquals("uebbaumnyqup", model.skuId()); - Assertions.assertEquals("eojnabc", model.skuDescription()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BeneficiaryTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BeneficiaryTests.java deleted file mode 100644 index a95eddc6104e..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BeneficiaryTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.Beneficiary; -import org.junit.jupiter.api.Assertions; - -public final class BeneficiaryTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Beneficiary model = BinaryData.fromString("{\"tenantId\":\"zlbiojlvfhrbbpn\",\"objectId\":\"vcwwyyurmochppr\"}") - .toObject(Beneficiary.class); - Assertions.assertEquals("zlbiojlvfhrbbpn", model.tenantId()); - Assertions.assertEquals("vcwwyyurmochppr", model.objectId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Beneficiary model = new Beneficiary().withTenantId("zlbiojlvfhrbbpn").withObjectId("vcwwyyurmochppr"); - model = BinaryData.fromObject(model).toObject(Beneficiary.class); - Assertions.assertEquals("zlbiojlvfhrbbpn", model.tenantId()); - Assertions.assertEquals("vcwwyyurmochppr", model.objectId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingAccountPolicyInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingAccountPolicyInnerTests.java deleted file mode 100644 index c993e6c0477c..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingAccountPolicyInnerTests.java +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.BillingAccountPolicyInner; -import com.azure.resourcemanager.billing.models.BillingAccountPolicyProperties; -import com.azure.resourcemanager.billing.models.BillingAccountPolicyPropertiesEnterpriseAgreementPolicies; -import com.azure.resourcemanager.billing.models.EnrollmentAccountOwnerViewCharges; -import com.azure.resourcemanager.billing.models.EnrollmentAuthLevelState; -import com.azure.resourcemanager.billing.models.EnrollmentDepartmentAdminViewCharges; -import com.azure.resourcemanager.billing.models.MarketplacePurchasesPolicy; -import com.azure.resourcemanager.billing.models.PolicySummary; -import com.azure.resourcemanager.billing.models.PolicyType; -import com.azure.resourcemanager.billing.models.ReservationPurchasesPolicy; -import com.azure.resourcemanager.billing.models.SavingsPlanPurchasesPolicy; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class BillingAccountPolicyInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingAccountPolicyInner model = BinaryData.fromString( - "{\"properties\":{\"provisioningState\":\"Canceled\",\"enterpriseAgreementPolicies\":{\"authenticationType\":\"MicrosoftAccountOnly\",\"accountOwnerViewCharges\":\"Allowed\",\"departmentAdminViewCharges\":\"Disabled\"},\"marketplacePurchases\":\"Other\",\"reservationPurchases\":\"Allowed\",\"savingsPlanPurchases\":\"Other\",\"policies\":[{\"name\":\"wza\",\"value\":\"zuu\",\"policyType\":\"SystemControlled\",\"scope\":\"irvpefycdve\"},{\"name\":\"itjn\",\"value\":\"zaj\",\"policyType\":\"Other\",\"scope\":\"hwjuyxxbxqvmvua\"}]},\"tags\":{\"sa\":\"adxkxeqbwpntghy\"},\"id\":\"drnxsluvlzla\",\"name\":\"ltxkpb\",\"type\":\"hvfdqqj\"}") - .toObject(BillingAccountPolicyInner.class); - Assertions.assertEquals("adxkxeqbwpntghy", model.tags().get("sa")); - Assertions.assertEquals(EnrollmentAuthLevelState.MICROSOFT_ACCOUNT_ONLY, - model.properties().enterpriseAgreementPolicies().authenticationType()); - Assertions.assertEquals(EnrollmentAccountOwnerViewCharges.ALLOWED, - model.properties().enterpriseAgreementPolicies().accountOwnerViewCharges()); - Assertions.assertEquals(EnrollmentDepartmentAdminViewCharges.DISABLED, - model.properties().enterpriseAgreementPolicies().departmentAdminViewCharges()); - Assertions.assertEquals(MarketplacePurchasesPolicy.OTHER, model.properties().marketplacePurchases()); - Assertions.assertEquals(ReservationPurchasesPolicy.ALLOWED, model.properties().reservationPurchases()); - Assertions.assertEquals(SavingsPlanPurchasesPolicy.OTHER, model.properties().savingsPlanPurchases()); - Assertions.assertEquals("wza", model.properties().policies().get(0).name()); - Assertions.assertEquals("zuu", model.properties().policies().get(0).value()); - Assertions.assertEquals(PolicyType.SYSTEM_CONTROLLED, model.properties().policies().get(0).policyType()); - Assertions.assertEquals("irvpefycdve", model.properties().policies().get(0).scope()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingAccountPolicyInner model = new BillingAccountPolicyInner().withTags(mapOf("sa", "adxkxeqbwpntghy")) - .withProperties(new BillingAccountPolicyProperties() - .withEnterpriseAgreementPolicies(new BillingAccountPolicyPropertiesEnterpriseAgreementPolicies() - .withAuthenticationType(EnrollmentAuthLevelState.MICROSOFT_ACCOUNT_ONLY) - .withAccountOwnerViewCharges(EnrollmentAccountOwnerViewCharges.ALLOWED) - .withDepartmentAdminViewCharges(EnrollmentDepartmentAdminViewCharges.DISABLED)) - .withMarketplacePurchases(MarketplacePurchasesPolicy.OTHER) - .withReservationPurchases(ReservationPurchasesPolicy.ALLOWED) - .withSavingsPlanPurchases(SavingsPlanPurchasesPolicy.OTHER) - .withPolicies(Arrays.asList( - new PolicySummary().withName("wza") - .withValue("zuu") - .withPolicyType(PolicyType.SYSTEM_CONTROLLED) - .withScope("irvpefycdve"), - new PolicySummary().withName("itjn") - .withValue("zaj") - .withPolicyType(PolicyType.OTHER) - .withScope("hwjuyxxbxqvmvua")))); - model = BinaryData.fromObject(model).toObject(BillingAccountPolicyInner.class); - Assertions.assertEquals("adxkxeqbwpntghy", model.tags().get("sa")); - Assertions.assertEquals(EnrollmentAuthLevelState.MICROSOFT_ACCOUNT_ONLY, - model.properties().enterpriseAgreementPolicies().authenticationType()); - Assertions.assertEquals(EnrollmentAccountOwnerViewCharges.ALLOWED, - model.properties().enterpriseAgreementPolicies().accountOwnerViewCharges()); - Assertions.assertEquals(EnrollmentDepartmentAdminViewCharges.DISABLED, - model.properties().enterpriseAgreementPolicies().departmentAdminViewCharges()); - Assertions.assertEquals(MarketplacePurchasesPolicy.OTHER, model.properties().marketplacePurchases()); - Assertions.assertEquals(ReservationPurchasesPolicy.ALLOWED, model.properties().reservationPurchases()); - Assertions.assertEquals(SavingsPlanPurchasesPolicy.OTHER, model.properties().savingsPlanPurchases()); - Assertions.assertEquals("wza", model.properties().policies().get(0).name()); - Assertions.assertEquals("zuu", model.properties().policies().get(0).value()); - Assertions.assertEquals(PolicyType.SYSTEM_CONTROLLED, model.properties().policies().get(0).policyType()); - Assertions.assertEquals("irvpefycdve", model.properties().policies().get(0).scope()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingAccountPolicyPropertiesEnterpriseAgreementPoliciesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingAccountPolicyPropertiesEnterpriseAgreementPoliciesTests.java deleted file mode 100644 index 83f5869d0687..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingAccountPolicyPropertiesEnterpriseAgreementPoliciesTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.BillingAccountPolicyPropertiesEnterpriseAgreementPolicies; -import com.azure.resourcemanager.billing.models.EnrollmentAccountOwnerViewCharges; -import com.azure.resourcemanager.billing.models.EnrollmentAuthLevelState; -import com.azure.resourcemanager.billing.models.EnrollmentDepartmentAdminViewCharges; -import org.junit.jupiter.api.Assertions; - -public final class BillingAccountPolicyPropertiesEnterpriseAgreementPoliciesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingAccountPolicyPropertiesEnterpriseAgreementPolicies model = BinaryData.fromString( - "{\"authenticationType\":\"OrganizationalAccountCrossTenant\",\"accountOwnerViewCharges\":\"NotAllowed\",\"departmentAdminViewCharges\":\"Other\"}") - .toObject(BillingAccountPolicyPropertiesEnterpriseAgreementPolicies.class); - Assertions.assertEquals(EnrollmentAuthLevelState.ORGANIZATIONAL_ACCOUNT_CROSS_TENANT, - model.authenticationType()); - Assertions.assertEquals(EnrollmentAccountOwnerViewCharges.NOT_ALLOWED, model.accountOwnerViewCharges()); - Assertions.assertEquals(EnrollmentDepartmentAdminViewCharges.OTHER, model.departmentAdminViewCharges()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingAccountPolicyPropertiesEnterpriseAgreementPolicies model - = new BillingAccountPolicyPropertiesEnterpriseAgreementPolicies() - .withAuthenticationType(EnrollmentAuthLevelState.ORGANIZATIONAL_ACCOUNT_CROSS_TENANT) - .withAccountOwnerViewCharges(EnrollmentAccountOwnerViewCharges.NOT_ALLOWED) - .withDepartmentAdminViewCharges(EnrollmentDepartmentAdminViewCharges.OTHER); - model = BinaryData.fromObject(model).toObject(BillingAccountPolicyPropertiesEnterpriseAgreementPolicies.class); - Assertions.assertEquals(EnrollmentAuthLevelState.ORGANIZATIONAL_ACCOUNT_CROSS_TENANT, - model.authenticationType()); - Assertions.assertEquals(EnrollmentAccountOwnerViewCharges.NOT_ALLOWED, model.accountOwnerViewCharges()); - Assertions.assertEquals(EnrollmentDepartmentAdminViewCharges.OTHER, model.departmentAdminViewCharges()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingAccountPolicyPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingAccountPolicyPropertiesTests.java deleted file mode 100644 index 71573e86e42a..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingAccountPolicyPropertiesTests.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.BillingAccountPolicyProperties; -import com.azure.resourcemanager.billing.models.BillingAccountPolicyPropertiesEnterpriseAgreementPolicies; -import com.azure.resourcemanager.billing.models.EnrollmentAccountOwnerViewCharges; -import com.azure.resourcemanager.billing.models.EnrollmentAuthLevelState; -import com.azure.resourcemanager.billing.models.EnrollmentDepartmentAdminViewCharges; -import com.azure.resourcemanager.billing.models.MarketplacePurchasesPolicy; -import com.azure.resourcemanager.billing.models.PolicySummary; -import com.azure.resourcemanager.billing.models.PolicyType; -import com.azure.resourcemanager.billing.models.ReservationPurchasesPolicy; -import com.azure.resourcemanager.billing.models.SavingsPlanPurchasesPolicy; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class BillingAccountPolicyPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingAccountPolicyProperties model = BinaryData.fromString( - "{\"provisioningState\":\"Pending\",\"enterpriseAgreementPolicies\":{\"authenticationType\":\"MicrosoftAccountOnly\",\"accountOwnerViewCharges\":\"NotAllowed\",\"departmentAdminViewCharges\":\"Allowed\"},\"marketplacePurchases\":\"OnlyFreeAllowed\",\"reservationPurchases\":\"Allowed\",\"savingsPlanPurchases\":\"Allowed\",\"policies\":[{\"name\":\"katuztjctib\",\"value\":\"bk\",\"policyType\":\"Other\",\"scope\":\"smz\"},{\"name\":\"dfwakwseivmak\",\"value\":\"ysowl\",\"policyType\":\"UserControlled\",\"scope\":\"kb\"}]}") - .toObject(BillingAccountPolicyProperties.class); - Assertions.assertEquals(EnrollmentAuthLevelState.MICROSOFT_ACCOUNT_ONLY, - model.enterpriseAgreementPolicies().authenticationType()); - Assertions.assertEquals(EnrollmentAccountOwnerViewCharges.NOT_ALLOWED, - model.enterpriseAgreementPolicies().accountOwnerViewCharges()); - Assertions.assertEquals(EnrollmentDepartmentAdminViewCharges.ALLOWED, - model.enterpriseAgreementPolicies().departmentAdminViewCharges()); - Assertions.assertEquals(MarketplacePurchasesPolicy.ONLY_FREE_ALLOWED, model.marketplacePurchases()); - Assertions.assertEquals(ReservationPurchasesPolicy.ALLOWED, model.reservationPurchases()); - Assertions.assertEquals(SavingsPlanPurchasesPolicy.ALLOWED, model.savingsPlanPurchases()); - Assertions.assertEquals("katuztjctib", model.policies().get(0).name()); - Assertions.assertEquals("bk", model.policies().get(0).value()); - Assertions.assertEquals(PolicyType.OTHER, model.policies().get(0).policyType()); - Assertions.assertEquals("smz", model.policies().get(0).scope()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingAccountPolicyProperties model = new BillingAccountPolicyProperties() - .withEnterpriseAgreementPolicies(new BillingAccountPolicyPropertiesEnterpriseAgreementPolicies() - .withAuthenticationType(EnrollmentAuthLevelState.MICROSOFT_ACCOUNT_ONLY) - .withAccountOwnerViewCharges(EnrollmentAccountOwnerViewCharges.NOT_ALLOWED) - .withDepartmentAdminViewCharges(EnrollmentDepartmentAdminViewCharges.ALLOWED)) - .withMarketplacePurchases(MarketplacePurchasesPolicy.ONLY_FREE_ALLOWED) - .withReservationPurchases(ReservationPurchasesPolicy.ALLOWED) - .withSavingsPlanPurchases(SavingsPlanPurchasesPolicy.ALLOWED) - .withPolicies(Arrays.asList( - new PolicySummary().withName("katuztjctib") - .withValue("bk") - .withPolicyType(PolicyType.OTHER) - .withScope("smz"), - new PolicySummary().withName("dfwakwseivmak") - .withValue("ysowl") - .withPolicyType(PolicyType.USER_CONTROLLED) - .withScope("kb"))); - model = BinaryData.fromObject(model).toObject(BillingAccountPolicyProperties.class); - Assertions.assertEquals(EnrollmentAuthLevelState.MICROSOFT_ACCOUNT_ONLY, - model.enterpriseAgreementPolicies().authenticationType()); - Assertions.assertEquals(EnrollmentAccountOwnerViewCharges.NOT_ALLOWED, - model.enterpriseAgreementPolicies().accountOwnerViewCharges()); - Assertions.assertEquals(EnrollmentDepartmentAdminViewCharges.ALLOWED, - model.enterpriseAgreementPolicies().departmentAdminViewCharges()); - Assertions.assertEquals(MarketplacePurchasesPolicy.ONLY_FREE_ALLOWED, model.marketplacePurchases()); - Assertions.assertEquals(ReservationPurchasesPolicy.ALLOWED, model.reservationPurchases()); - Assertions.assertEquals(SavingsPlanPurchasesPolicy.ALLOWED, model.savingsPlanPurchases()); - Assertions.assertEquals("katuztjctib", model.policies().get(0).name()); - Assertions.assertEquals("bk", model.policies().get(0).value()); - Assertions.assertEquals(PolicyType.OTHER, model.policies().get(0).policyType()); - Assertions.assertEquals("smz", model.policies().get(0).scope()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingAccountPropertiesRegistrationNumberTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingAccountPropertiesRegistrationNumberTests.java deleted file mode 100644 index 06c806184421..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingAccountPropertiesRegistrationNumberTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.BillingAccountPropertiesRegistrationNumber; -import org.junit.jupiter.api.Assertions; - -public final class BillingAccountPropertiesRegistrationNumberTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingAccountPropertiesRegistrationNumber model - = BinaryData.fromString("{\"id\":\"edckzywbiexzfey\",\"required\":false,\"type\":[\"bxu\"]}") - .toObject(BillingAccountPropertiesRegistrationNumber.class); - Assertions.assertEquals("edckzywbiexzfey", model.id()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingAccountPropertiesRegistrationNumber model - = new BillingAccountPropertiesRegistrationNumber().withId("edckzywbiexzfey"); - model = BinaryData.fromObject(model).toObject(BillingAccountPropertiesRegistrationNumber.class); - Assertions.assertEquals("edckzywbiexzfey", model.id()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingAccountsConfirmTransitionWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingAccountsConfirmTransitionWithResponseMockTests.java deleted file mode 100644 index ed485a7d3c93..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingAccountsConfirmTransitionWithResponseMockTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.TransitionDetails; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingAccountsConfirmTransitionWithResponseMockTests { - @Test - public void testConfirmTransitionWithResponse() throws Exception { - String responseStr = "{\"transitionDate\":\"2021-10-09T14:53:27Z\",\"anniversaryDay\":826543892}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - TransitionDetails response = manager.billingAccounts() - .confirmTransitionWithResponse("bbaex", com.azure.core.util.Context.NONE) - .getValue(); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionInnerTests.java deleted file mode 100644 index f5bd4046e128..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionInnerTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.BillingPermissionInner; - -public final class BillingPermissionInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingPermissionInner model - = BinaryData.fromString("{\"actions\":[\"misgwbnb\",\"e\"],\"notActions\":[\"wkz\"]}") - .toObject(BillingPermissionInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingPermissionInner model = new BillingPermissionInner(); - model = BinaryData.fromObject(model).toObject(BillingPermissionInner.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionListResultTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionListResultTests.java deleted file mode 100644 index b5dc02de12c5..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionListResultTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.BillingPermissionListResult; - -public final class BillingPermissionListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingPermissionListResult model = BinaryData.fromString( - "{\"nextLink\":\"epsbjtazqu\",\"value\":[{\"actions\":[\"mueef\",\"zwfqkqujidsuyon\",\"bglaocqxtccm\"],\"notActions\":[\"dxyt\",\"moyrxvwfudwpz\",\"txhdzh\"]},{\"actions\":[\"jbhckfrlhr\"],\"notActions\":[\"kyv\",\"ycanuzbpzkafku\"]},{\"actions\":[\"rnwb\",\"ehhseyvjusrts\"],\"notActions\":[\"pkdeemaofmxagkvt\",\"elmqk\"]},{\"actions\":[\"hvljuahaquh\",\"dhmdua\",\"aex\"],\"notActions\":[\"fadmws\",\"crgvxpvgom\"]}]}") - .toObject(BillingPermissionListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingPermissionListResult model = new BillingPermissionListResult(); - model = BinaryData.fromObject(model).toObject(BillingPermissionListResult.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByBillingAccountWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByBillingAccountWithResponseMockTests.java deleted file mode 100644 index 5e5dc038aa24..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByBillingAccountWithResponseMockTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.CheckAccessRequest; -import com.azure.resourcemanager.billing.models.CheckAccessResponse; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.List; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingPermissionsCheckAccessByBillingAccountWithResponseMockTests { - @Test - public void testCheckAccessByBillingAccountWithResponse() throws Exception { - String responseStr - = "[{\"accessDecision\":\"NotAllowed\",\"action\":\"urhzzf\"},{\"accessDecision\":\"Allowed\",\"action\":\"oqusvwlu\"}]"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - List response = manager.billingPermissions() - .checkAccessByBillingAccountWithResponse("moeobdoe", - new CheckAccessRequest().withActions(Arrays.asList("pnimtwuuh", "uegn", "wmnfeubtzjyrkwfu", "iphrrku")), - com.azure.core.util.Context.NONE) - .getValue(); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByBillingProfileWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByBillingProfileWithResponseMockTests.java deleted file mode 100644 index 8ceba820a979..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByBillingProfileWithResponseMockTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.CheckAccessRequest; -import com.azure.resourcemanager.billing.models.CheckAccessResponse; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.List; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingPermissionsCheckAccessByBillingProfileWithResponseMockTests { - @Test - public void testCheckAccessByBillingProfileWithResponse() throws Exception { - String responseStr - = "[{\"accessDecision\":\"Other\",\"action\":\"jimejtgzj\"},{\"accessDecision\":\"Allowed\",\"action\":\"e\"},{\"accessDecision\":\"NotAllowed\",\"action\":\"qloiwyayyziv\"},{\"accessDecision\":\"Allowed\",\"action\":\"cdq\"}]"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - List response = manager.billingPermissions() - .checkAccessByBillingProfileWithResponse("wxjgvhxccbmkak", "kookbputmgvmuyak", - new CheckAccessRequest().withActions(Arrays.asList("ktfowzkroyrdur")), com.azure.core.util.Context.NONE) - .getValue(); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByCustomerWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByCustomerWithResponseMockTests.java deleted file mode 100644 index 2996770b5fa1..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByCustomerWithResponseMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.CheckAccessRequest; -import com.azure.resourcemanager.billing.models.CheckAccessResponse; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.List; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingPermissionsCheckAccessByCustomerWithResponseMockTests { - @Test - public void testCheckAccessByCustomerWithResponse() throws Exception { - String responseStr = "[{\"accessDecision\":\"NotAllowed\",\"action\":\"frrynjcwmhl\"}]"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - List response = manager.billingPermissions() - .checkAccessByCustomerWithResponse("dllc", "dpr", "nhkgq", - new CheckAccessRequest().withActions(Arrays.asList("xs", "tc")), com.azure.core.util.Context.NONE) - .getValue(); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByDepartmentWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByDepartmentWithResponseMockTests.java deleted file mode 100644 index 290668f7a397..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByDepartmentWithResponseMockTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.CheckAccessRequest; -import com.azure.resourcemanager.billing.models.CheckAccessResponse; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.List; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingPermissionsCheckAccessByDepartmentWithResponseMockTests { - @Test - public void testCheckAccessByDepartmentWithResponse() throws Exception { - String responseStr - = "[{\"accessDecision\":\"NotAllowed\",\"action\":\"cweakfec\"},{\"accessDecision\":\"NotAllowed\",\"action\":\"aqufqizjvppwoo\"}]"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - List response = manager.billingPermissions() - .checkAccessByDepartmentWithResponse("cucsqsnxfbxu", "eapdrbzyv", - new CheckAccessRequest() - .withActions(Arrays.asList("adulpodkaxp", "obkzhmhjdqltdel", "qrojadhfztlray", "rkgzkyhudbkuw")), - com.azure.core.util.Context.NONE) - .getValue(); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByEnrollmentAccountWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByEnrollmentAccountWithResponseMockTests.java deleted file mode 100644 index 5eba6cdfc79d..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByEnrollmentAccountWithResponseMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.CheckAccessRequest; -import com.azure.resourcemanager.billing.models.CheckAccessResponse; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.List; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingPermissionsCheckAccessByEnrollmentAccountWithResponseMockTests { - @Test - public void testCheckAccessByEnrollmentAccountWithResponse() throws Exception { - String responseStr = "[{\"accessDecision\":\"NotAllowed\",\"action\":\"kyfozkbnzxbyp\"}]"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - List response = manager.billingPermissions() - .checkAccessByEnrollmentAccountWithResponse("tldsvczdjiahuq", "mjzucwwme", - new CheckAccessRequest().withActions(Arrays.asList("hddwvmq")), com.azure.core.util.Context.NONE) - .getValue(); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByInvoiceSectionWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByInvoiceSectionWithResponseMockTests.java deleted file mode 100644 index e5b716cedc8f..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsCheckAccessByInvoiceSectionWithResponseMockTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.CheckAccessRequest; -import com.azure.resourcemanager.billing.models.CheckAccessResponse; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.List; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingPermissionsCheckAccessByInvoiceSectionWithResponseMockTests { - @Test - public void testCheckAccessByInvoiceSectionWithResponse() throws Exception { - String responseStr - = "[{\"accessDecision\":\"NotAllowed\",\"action\":\"xurfqazcsozjvx\"},{\"accessDecision\":\"NotAllowed\",\"action\":\"ggbnvtxo\"},{\"accessDecision\":\"Other\",\"action\":\"zyxwhoe\"}]"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - List response = manager.billingPermissions() - .checkAccessByInvoiceSectionWithResponse("wkhojqttbspvkhg", "aqjsgyzstujr", "xrk", - new CheckAccessRequest().withActions(Arrays.asList("d", "lduyehiiittugyuq")), - com.azure.core.util.Context.NONE) - .getValue(); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByBillingAccountMockTests.java deleted file mode 100644 index a8417f84379f..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByBillingAccountMockTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingPermission; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingPermissionsListByBillingAccountMockTests { - @Test - public void testListByBillingAccount() throws Exception { - String responseStr - = "{\"value\":[{\"actions\":[\"udpabcreuwzos\",\"yjxvc\"],\"notActions\":[\"ormrexzv\",\"ubewgzygba\"]}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.billingPermissions().listByBillingAccount("ozonynp", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByBillingProfileMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByBillingProfileMockTests.java deleted file mode 100644 index 95fffe73208a..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByBillingProfileMockTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingPermission; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingPermissionsListByBillingProfileMockTests { - @Test - public void testListByBillingProfile() throws Exception { - String responseStr - = "{\"value\":[{\"actions\":[\"rlimzfvppkeqs\",\"fjmclngygnhrkomb\"],\"notActions\":[\"ajdopggor\",\"jo\",\"trotpvclpofyrl\",\"wkpts\"]}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.billingPermissions().listByBillingProfile("uvecovsd", "hzrtd", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByCustomerAtBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByCustomerAtBillingAccountMockTests.java deleted file mode 100644 index 1949445dfd15..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByCustomerAtBillingAccountMockTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingPermission; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingPermissionsListByCustomerAtBillingAccountMockTests { - @Test - public void testListByCustomerAtBillingAccount() throws Exception { - String responseStr = "{\"value\":[{\"actions\":[\"mqvfm\"],\"notActions\":[\"ddtgctxegtvgwy\"]}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingPermissions() - .listByCustomerAtBillingAccount("opwnib", "ttoztj", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByCustomerMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByCustomerMockTests.java deleted file mode 100644 index a8dce241a8b5..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByCustomerMockTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingPermission; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingPermissionsListByCustomerMockTests { - @Test - public void testListByCustomer() throws Exception { - String responseStr - = "{\"value\":[{\"actions\":[\"yeyzm\",\"dsqcmhnxl\",\"buwodmachbkv\",\"rpbj\"],\"notActions\":[\"goqple\",\"mumk\"]}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingPermissions() - .listByCustomer("hchwhrktjleif", "bfi", "lhxfnsmycj", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByDepartmentMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByDepartmentMockTests.java deleted file mode 100644 index ae1e2171c084..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByDepartmentMockTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingPermission; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingPermissionsListByDepartmentMockTests { - @Test - public void testListByDepartment() throws Exception { - String responseStr - = "{\"value\":[{\"actions\":[\"omirhp\"],\"notActions\":[\"enqlamwmgewayx\",\"lnbcpjstb\",\"em\"]}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingPermissions() - .listByDepartment("rbelfnzz", "yizwbxgdebxla", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByEnrollmentAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByEnrollmentAccountMockTests.java deleted file mode 100644 index 9b662fb3ce9b..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByEnrollmentAccountMockTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingPermission; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingPermissionsListByEnrollmentAccountMockTests { - @Test - public void testListByEnrollmentAccount() throws Exception { - String responseStr = "{\"value\":[{\"actions\":[\"jtyqpd\"],\"notActions\":[\"egh\"]}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingPermissions() - .listByEnrollmentAccount("jeyyjmjjxizxp", "hnzlslekctt", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByInvoiceSectionMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByInvoiceSectionMockTests.java deleted file mode 100644 index 3017df998eab..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPermissionsListByInvoiceSectionMockTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingPermission; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingPermissionsListByInvoiceSectionMockTests { - @Test - public void testListByInvoiceSection() throws Exception { - String responseStr - = "{\"value\":[{\"actions\":[\"kucddwnhczbutouc\",\"jtirjwayhicqq\",\"wvgwkslvli\"],\"notActions\":[\"vbia\",\"v\",\"srgekzyqxadyfhb\"]}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingPermissions() - .listByInvoiceSection("mgnukxrke", "jpequlrlzaudgjt", "bc", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfileInfoTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfileInfoTests.java deleted file mode 100644 index 52dd1254438e..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfileInfoTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.BillingProfileInfo; -import org.junit.jupiter.api.Assertions; - -public final class BillingProfileInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingProfileInfo model = BinaryData.fromString( - "{\"billingAccountId\":\"rgqjbpfzfsinzg\",\"billingProfileDisplayName\":\"cjrwzoxxjtfellu\",\"billingProfileId\":\"zitonpeqfpjkjl\",\"billingProfileSystemId\":\"fpdvhpfxxypi\",\"indirectRelationshipOrganizationName\":\"nmayhuybb\"}") - .toObject(BillingProfileInfo.class); - Assertions.assertEquals("rgqjbpfzfsinzg", model.billingAccountId()); - Assertions.assertEquals("cjrwzoxxjtfellu", model.billingProfileDisplayName()); - Assertions.assertEquals("zitonpeqfpjkjl", model.billingProfileId()); - Assertions.assertEquals("fpdvhpfxxypi", model.billingProfileSystemId()); - Assertions.assertEquals("nmayhuybb", model.indirectRelationshipOrganizationName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingProfileInfo model = new BillingProfileInfo().withBillingAccountId("rgqjbpfzfsinzg") - .withBillingProfileDisplayName("cjrwzoxxjtfellu") - .withBillingProfileId("zitonpeqfpjkjl") - .withBillingProfileSystemId("fpdvhpfxxypi") - .withIndirectRelationshipOrganizationName("nmayhuybb"); - model = BinaryData.fromObject(model).toObject(BillingProfileInfo.class); - Assertions.assertEquals("rgqjbpfzfsinzg", model.billingAccountId()); - Assertions.assertEquals("cjrwzoxxjtfellu", model.billingProfileDisplayName()); - Assertions.assertEquals("zitonpeqfpjkjl", model.billingProfileId()); - Assertions.assertEquals("fpdvhpfxxypi", model.billingProfileSystemId()); - Assertions.assertEquals("nmayhuybb", model.indirectRelationshipOrganizationName()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfilePolicyInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfilePolicyInnerTests.java deleted file mode 100644 index ef93aa2968d1..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfilePolicyInnerTests.java +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.BillingProfilePolicyInner; -import com.azure.resourcemanager.billing.models.BillingProfilePolicyProperties; -import com.azure.resourcemanager.billing.models.BillingProfilePolicyPropertiesEnterpriseAgreementPolicies; -import com.azure.resourcemanager.billing.models.EnrollmentAccountOwnerViewCharges; -import com.azure.resourcemanager.billing.models.EnrollmentAuthLevelState; -import com.azure.resourcemanager.billing.models.EnrollmentDepartmentAdminViewCharges; -import com.azure.resourcemanager.billing.models.InvoiceSectionLabelManagementPolicy; -import com.azure.resourcemanager.billing.models.MarketplacePurchasesPolicy; -import com.azure.resourcemanager.billing.models.PolicySummary; -import com.azure.resourcemanager.billing.models.PolicyType; -import com.azure.resourcemanager.billing.models.ReservationPurchasesPolicy; -import com.azure.resourcemanager.billing.models.SavingsPlanPurchasesPolicy; -import com.azure.resourcemanager.billing.models.ViewChargesPolicy; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class BillingProfilePolicyInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingProfilePolicyInner model = BinaryData.fromString( - "{\"properties\":{\"provisioningState\":\"Canceled\",\"enterpriseAgreementPolicies\":{\"authenticationType\":\"Other\",\"accountOwnerViewCharges\":\"Disabled\",\"departmentAdminViewCharges\":\"Disabled\"},\"invoiceSectionLabelManagement\":\"NotAllowed\",\"marketplacePurchases\":\"AllAllowed\",\"reservationPurchases\":\"Other\",\"savingsPlanPurchases\":\"Disabled\",\"viewCharges\":\"Other\",\"policies\":[{\"name\":\"rfgdrwj\",\"value\":\"ewhfjsrwqrxetf\",\"policyType\":\"UserControlled\",\"scope\":\"rrmdqntycna\"},{\"name\":\"hvmaxgnuyeamcmhu\",\"value\":\"jecehokwc\",\"policyType\":\"UserControlled\",\"scope\":\"loesqrggvr\"},{\"name\":\"yrukoi\",\"value\":\"ciduwjle\",\"policyType\":\"SystemControlled\",\"scope\":\"h\"}]},\"tags\":{\"ruzythqkkwhbg\":\"p\",\"jdtvmclyymffhmj\":\"vellvulnxdmnitm\",\"jqrbrpvnm\":\"ddnyxfzuvrzmzqm\"},\"id\":\"foebo\",\"name\":\"tjpp\",\"type\":\"laohoqkp\"}") - .toObject(BillingProfilePolicyInner.class); - Assertions.assertEquals("p", model.tags().get("ruzythqkkwhbg")); - Assertions.assertEquals(EnrollmentAuthLevelState.OTHER, - model.properties().enterpriseAgreementPolicies().authenticationType()); - Assertions.assertEquals(EnrollmentAccountOwnerViewCharges.DISABLED, - model.properties().enterpriseAgreementPolicies().accountOwnerViewCharges()); - Assertions.assertEquals(EnrollmentDepartmentAdminViewCharges.DISABLED, - model.properties().enterpriseAgreementPolicies().departmentAdminViewCharges()); - Assertions.assertEquals(InvoiceSectionLabelManagementPolicy.NOT_ALLOWED, - model.properties().invoiceSectionLabelManagement()); - Assertions.assertEquals(MarketplacePurchasesPolicy.ALL_ALLOWED, model.properties().marketplacePurchases()); - Assertions.assertEquals(ReservationPurchasesPolicy.OTHER, model.properties().reservationPurchases()); - Assertions.assertEquals(SavingsPlanPurchasesPolicy.DISABLED, model.properties().savingsPlanPurchases()); - Assertions.assertEquals(ViewChargesPolicy.OTHER, model.properties().viewCharges()); - Assertions.assertEquals("rfgdrwj", model.properties().policies().get(0).name()); - Assertions.assertEquals("ewhfjsrwqrxetf", model.properties().policies().get(0).value()); - Assertions.assertEquals(PolicyType.USER_CONTROLLED, model.properties().policies().get(0).policyType()); - Assertions.assertEquals("rrmdqntycna", model.properties().policies().get(0).scope()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingProfilePolicyInner model = new BillingProfilePolicyInner() - .withTags(mapOf("ruzythqkkwhbg", "p", "jdtvmclyymffhmj", "vellvulnxdmnitm", "jqrbrpvnm", "ddnyxfzuvrzmzqm")) - .withProperties(new BillingProfilePolicyProperties() - .withEnterpriseAgreementPolicies(new BillingProfilePolicyPropertiesEnterpriseAgreementPolicies() - .withAuthenticationType(EnrollmentAuthLevelState.OTHER) - .withAccountOwnerViewCharges(EnrollmentAccountOwnerViewCharges.DISABLED) - .withDepartmentAdminViewCharges(EnrollmentDepartmentAdminViewCharges.DISABLED)) - .withInvoiceSectionLabelManagement(InvoiceSectionLabelManagementPolicy.NOT_ALLOWED) - .withMarketplacePurchases(MarketplacePurchasesPolicy.ALL_ALLOWED) - .withReservationPurchases(ReservationPurchasesPolicy.OTHER) - .withSavingsPlanPurchases(SavingsPlanPurchasesPolicy.DISABLED) - .withViewCharges(ViewChargesPolicy.OTHER) - .withPolicies(Arrays.asList( - new PolicySummary().withName("rfgdrwj") - .withValue("ewhfjsrwqrxetf") - .withPolicyType(PolicyType.USER_CONTROLLED) - .withScope("rrmdqntycna"), - new PolicySummary().withName("hvmaxgnuyeamcmhu") - .withValue("jecehokwc") - .withPolicyType(PolicyType.USER_CONTROLLED) - .withScope("loesqrggvr"), - new PolicySummary().withName("yrukoi") - .withValue("ciduwjle") - .withPolicyType(PolicyType.SYSTEM_CONTROLLED) - .withScope("h")))); - model = BinaryData.fromObject(model).toObject(BillingProfilePolicyInner.class); - Assertions.assertEquals("p", model.tags().get("ruzythqkkwhbg")); - Assertions.assertEquals(EnrollmentAuthLevelState.OTHER, - model.properties().enterpriseAgreementPolicies().authenticationType()); - Assertions.assertEquals(EnrollmentAccountOwnerViewCharges.DISABLED, - model.properties().enterpriseAgreementPolicies().accountOwnerViewCharges()); - Assertions.assertEquals(EnrollmentDepartmentAdminViewCharges.DISABLED, - model.properties().enterpriseAgreementPolicies().departmentAdminViewCharges()); - Assertions.assertEquals(InvoiceSectionLabelManagementPolicy.NOT_ALLOWED, - model.properties().invoiceSectionLabelManagement()); - Assertions.assertEquals(MarketplacePurchasesPolicy.ALL_ALLOWED, model.properties().marketplacePurchases()); - Assertions.assertEquals(ReservationPurchasesPolicy.OTHER, model.properties().reservationPurchases()); - Assertions.assertEquals(SavingsPlanPurchasesPolicy.DISABLED, model.properties().savingsPlanPurchases()); - Assertions.assertEquals(ViewChargesPolicy.OTHER, model.properties().viewCharges()); - Assertions.assertEquals("rfgdrwj", model.properties().policies().get(0).name()); - Assertions.assertEquals("ewhfjsrwqrxetf", model.properties().policies().get(0).value()); - Assertions.assertEquals(PolicyType.USER_CONTROLLED, model.properties().policies().get(0).policyType()); - Assertions.assertEquals("rrmdqntycna", model.properties().policies().get(0).scope()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfilePolicyPropertiesEnterpriseAgreementPoliciesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfilePolicyPropertiesEnterpriseAgreementPoliciesTests.java deleted file mode 100644 index fcbc173ac1d7..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfilePolicyPropertiesEnterpriseAgreementPoliciesTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.BillingProfilePolicyPropertiesEnterpriseAgreementPolicies; -import com.azure.resourcemanager.billing.models.EnrollmentAccountOwnerViewCharges; -import com.azure.resourcemanager.billing.models.EnrollmentAuthLevelState; -import com.azure.resourcemanager.billing.models.EnrollmentDepartmentAdminViewCharges; -import org.junit.jupiter.api.Assertions; - -public final class BillingProfilePolicyPropertiesEnterpriseAgreementPoliciesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingProfilePolicyPropertiesEnterpriseAgreementPolicies model = BinaryData.fromString( - "{\"authenticationType\":\"MixedAccount\",\"accountOwnerViewCharges\":\"Allowed\",\"departmentAdminViewCharges\":\"Disabled\"}") - .toObject(BillingProfilePolicyPropertiesEnterpriseAgreementPolicies.class); - Assertions.assertEquals(EnrollmentAuthLevelState.MIXED_ACCOUNT, model.authenticationType()); - Assertions.assertEquals(EnrollmentAccountOwnerViewCharges.ALLOWED, model.accountOwnerViewCharges()); - Assertions.assertEquals(EnrollmentDepartmentAdminViewCharges.DISABLED, model.departmentAdminViewCharges()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingProfilePolicyPropertiesEnterpriseAgreementPolicies model - = new BillingProfilePolicyPropertiesEnterpriseAgreementPolicies() - .withAuthenticationType(EnrollmentAuthLevelState.MIXED_ACCOUNT) - .withAccountOwnerViewCharges(EnrollmentAccountOwnerViewCharges.ALLOWED) - .withDepartmentAdminViewCharges(EnrollmentDepartmentAdminViewCharges.DISABLED); - model = BinaryData.fromObject(model).toObject(BillingProfilePolicyPropertiesEnterpriseAgreementPolicies.class); - Assertions.assertEquals(EnrollmentAuthLevelState.MIXED_ACCOUNT, model.authenticationType()); - Assertions.assertEquals(EnrollmentAccountOwnerViewCharges.ALLOWED, model.accountOwnerViewCharges()); - Assertions.assertEquals(EnrollmentDepartmentAdminViewCharges.DISABLED, model.departmentAdminViewCharges()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfilePolicyPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfilePolicyPropertiesTests.java deleted file mode 100644 index e6564659532c..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfilePolicyPropertiesTests.java +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.BillingProfilePolicyProperties; -import com.azure.resourcemanager.billing.models.BillingProfilePolicyPropertiesEnterpriseAgreementPolicies; -import com.azure.resourcemanager.billing.models.EnrollmentAccountOwnerViewCharges; -import com.azure.resourcemanager.billing.models.EnrollmentAuthLevelState; -import com.azure.resourcemanager.billing.models.EnrollmentDepartmentAdminViewCharges; -import com.azure.resourcemanager.billing.models.InvoiceSectionLabelManagementPolicy; -import com.azure.resourcemanager.billing.models.MarketplacePurchasesPolicy; -import com.azure.resourcemanager.billing.models.PolicySummary; -import com.azure.resourcemanager.billing.models.PolicyType; -import com.azure.resourcemanager.billing.models.ReservationPurchasesPolicy; -import com.azure.resourcemanager.billing.models.SavingsPlanPurchasesPolicy; -import com.azure.resourcemanager.billing.models.ViewChargesPolicy; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class BillingProfilePolicyPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingProfilePolicyProperties model = BinaryData.fromString( - "{\"provisioningState\":\"Pending\",\"enterpriseAgreementPolicies\":{\"authenticationType\":\"OrganizationalAccountOnly\",\"accountOwnerViewCharges\":\"NotAllowed\",\"departmentAdminViewCharges\":\"Allowed\"},\"invoiceSectionLabelManagement\":\"Other\",\"marketplacePurchases\":\"AllAllowed\",\"reservationPurchases\":\"NotAllowed\",\"savingsPlanPurchases\":\"NotAllowed\",\"viewCharges\":\"Other\",\"policies\":[{\"name\":\"xdqaolfylnkkb\",\"value\":\"jvlywl\",\"policyType\":\"SystemControlled\",\"scope\":\"obbjwhlwy\"},{\"name\":\"nqzocrdzg\",\"value\":\"euntgxdncaqtti\",\"policyType\":\"SystemControlled\",\"scope\":\"fuvnyttzgixgyri\"},{\"name\":\"gm\",\"value\":\"ehlq\",\"policyType\":\"UserControlled\",\"scope\":\"flkn\"}]}") - .toObject(BillingProfilePolicyProperties.class); - Assertions.assertEquals(EnrollmentAuthLevelState.ORGANIZATIONAL_ACCOUNT_ONLY, - model.enterpriseAgreementPolicies().authenticationType()); - Assertions.assertEquals(EnrollmentAccountOwnerViewCharges.NOT_ALLOWED, - model.enterpriseAgreementPolicies().accountOwnerViewCharges()); - Assertions.assertEquals(EnrollmentDepartmentAdminViewCharges.ALLOWED, - model.enterpriseAgreementPolicies().departmentAdminViewCharges()); - Assertions.assertEquals(InvoiceSectionLabelManagementPolicy.OTHER, model.invoiceSectionLabelManagement()); - Assertions.assertEquals(MarketplacePurchasesPolicy.ALL_ALLOWED, model.marketplacePurchases()); - Assertions.assertEquals(ReservationPurchasesPolicy.NOT_ALLOWED, model.reservationPurchases()); - Assertions.assertEquals(SavingsPlanPurchasesPolicy.NOT_ALLOWED, model.savingsPlanPurchases()); - Assertions.assertEquals(ViewChargesPolicy.OTHER, model.viewCharges()); - Assertions.assertEquals("xdqaolfylnkkb", model.policies().get(0).name()); - Assertions.assertEquals("jvlywl", model.policies().get(0).value()); - Assertions.assertEquals(PolicyType.SYSTEM_CONTROLLED, model.policies().get(0).policyType()); - Assertions.assertEquals("obbjwhlwy", model.policies().get(0).scope()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingProfilePolicyProperties model = new BillingProfilePolicyProperties() - .withEnterpriseAgreementPolicies(new BillingProfilePolicyPropertiesEnterpriseAgreementPolicies() - .withAuthenticationType(EnrollmentAuthLevelState.ORGANIZATIONAL_ACCOUNT_ONLY) - .withAccountOwnerViewCharges(EnrollmentAccountOwnerViewCharges.NOT_ALLOWED) - .withDepartmentAdminViewCharges(EnrollmentDepartmentAdminViewCharges.ALLOWED)) - .withInvoiceSectionLabelManagement(InvoiceSectionLabelManagementPolicy.OTHER) - .withMarketplacePurchases(MarketplacePurchasesPolicy.ALL_ALLOWED) - .withReservationPurchases(ReservationPurchasesPolicy.NOT_ALLOWED) - .withSavingsPlanPurchases(SavingsPlanPurchasesPolicy.NOT_ALLOWED) - .withViewCharges(ViewChargesPolicy.OTHER) - .withPolicies(Arrays.asList( - new PolicySummary().withName("xdqaolfylnkkb") - .withValue("jvlywl") - .withPolicyType(PolicyType.SYSTEM_CONTROLLED) - .withScope("obbjwhlwy"), - new PolicySummary().withName("nqzocrdzg") - .withValue("euntgxdncaqtti") - .withPolicyType(PolicyType.SYSTEM_CONTROLLED) - .withScope("fuvnyttzgixgyri"), - new PolicySummary().withName("gm") - .withValue("ehlq") - .withPolicyType(PolicyType.USER_CONTROLLED) - .withScope("flkn"))); - model = BinaryData.fromObject(model).toObject(BillingProfilePolicyProperties.class); - Assertions.assertEquals(EnrollmentAuthLevelState.ORGANIZATIONAL_ACCOUNT_ONLY, - model.enterpriseAgreementPolicies().authenticationType()); - Assertions.assertEquals(EnrollmentAccountOwnerViewCharges.NOT_ALLOWED, - model.enterpriseAgreementPolicies().accountOwnerViewCharges()); - Assertions.assertEquals(EnrollmentDepartmentAdminViewCharges.ALLOWED, - model.enterpriseAgreementPolicies().departmentAdminViewCharges()); - Assertions.assertEquals(InvoiceSectionLabelManagementPolicy.OTHER, model.invoiceSectionLabelManagement()); - Assertions.assertEquals(MarketplacePurchasesPolicy.ALL_ALLOWED, model.marketplacePurchases()); - Assertions.assertEquals(ReservationPurchasesPolicy.NOT_ALLOWED, model.reservationPurchases()); - Assertions.assertEquals(SavingsPlanPurchasesPolicy.NOT_ALLOWED, model.savingsPlanPurchases()); - Assertions.assertEquals(ViewChargesPolicy.OTHER, model.viewCharges()); - Assertions.assertEquals("xdqaolfylnkkb", model.policies().get(0).name()); - Assertions.assertEquals("jvlywl", model.policies().get(0).value()); - Assertions.assertEquals(PolicyType.SYSTEM_CONTROLLED, model.policies().get(0).policyType()); - Assertions.assertEquals("obbjwhlwy", model.policies().get(0).scope()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfilePropertiesCurrentPaymentTermTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfilePropertiesCurrentPaymentTermTests.java deleted file mode 100644 index 14729f9b786d..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfilePropertiesCurrentPaymentTermTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.BillingProfilePropertiesCurrentPaymentTerm; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class BillingProfilePropertiesCurrentPaymentTermTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingProfilePropertiesCurrentPaymentTerm model = BinaryData.fromString( - "{\"term\":\"rfbjf\",\"startDate\":\"2021-07-05T13:20:17Z\",\"endDate\":\"2021-10-31T01:03:52Z\",\"isDefault\":false}") - .toObject(BillingProfilePropertiesCurrentPaymentTerm.class); - Assertions.assertEquals("rfbjf", model.term()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-05T13:20:17Z"), model.startDate()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-31T01:03:52Z"), model.endDate()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingProfilePropertiesCurrentPaymentTerm model - = new BillingProfilePropertiesCurrentPaymentTerm().withTerm("rfbjf") - .withStartDate(OffsetDateTime.parse("2021-07-05T13:20:17Z")) - .withEndDate(OffsetDateTime.parse("2021-10-31T01:03:52Z")); - model = BinaryData.fromObject(model).toObject(BillingProfilePropertiesCurrentPaymentTerm.class); - Assertions.assertEquals("rfbjf", model.term()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-05T13:20:17Z"), model.startDate()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-31T01:03:52Z"), model.endDate()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfilePropertiesIndirectRelationshipInfoTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfilePropertiesIndirectRelationshipInfoTests.java deleted file mode 100644 index 67ce4ca5c0c4..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingProfilePropertiesIndirectRelationshipInfoTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.BillingProfilePropertiesIndirectRelationshipInfo; -import org.junit.jupiter.api.Assertions; - -public final class BillingProfilePropertiesIndirectRelationshipInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingProfilePropertiesIndirectRelationshipInfo model = BinaryData - .fromString( - "{\"billingAccountName\":\"aln\",\"billingProfileName\":\"xisxyawjoyaqcsl\",\"displayName\":\"pkii\"}") - .toObject(BillingProfilePropertiesIndirectRelationshipInfo.class); - Assertions.assertEquals("aln", model.billingAccountName()); - Assertions.assertEquals("xisxyawjoyaqcsl", model.billingProfileName()); - Assertions.assertEquals("pkii", model.displayName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingProfilePropertiesIndirectRelationshipInfo model - = new BillingProfilePropertiesIndirectRelationshipInfo().withBillingAccountName("aln") - .withBillingProfileName("xisxyawjoyaqcsl") - .withDisplayName("pkii"); - model = BinaryData.fromObject(model).toObject(BillingProfilePropertiesIndirectRelationshipInfo.class); - Assertions.assertEquals("aln", model.billingAccountName()); - Assertions.assertEquals("xisxyawjoyaqcsl", model.billingProfileName()); - Assertions.assertEquals("pkii", model.displayName()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPropertyPropertiesEnrollmentDetailsTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPropertyPropertiesEnrollmentDetailsTests.java deleted file mode 100644 index c30ee4864be1..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingPropertyPropertiesEnrollmentDetailsTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.BillingPropertyPropertiesEnrollmentDetails; -import org.junit.jupiter.api.Assertions; - -public final class BillingPropertyPropertiesEnrollmentDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingPropertyPropertiesEnrollmentDetails model = BinaryData.fromString( - "{\"departmentDisplayName\":\"p\",\"departmentId\":\"ebmnzbtbhjpglk\",\"enrollmentAccountStatus\":\"ohdneuel\",\"enrollmentAccountDisplayName\":\"hsd\",\"enrollmentAccountId\":\"t\"}") - .toObject(BillingPropertyPropertiesEnrollmentDetails.class); - Assertions.assertEquals("p", model.departmentDisplayName()); - Assertions.assertEquals("ebmnzbtbhjpglk", model.departmentId()); - Assertions.assertEquals("ohdneuel", model.enrollmentAccountStatus()); - Assertions.assertEquals("hsd", model.enrollmentAccountDisplayName()); - Assertions.assertEquals("t", model.enrollmentAccountId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingPropertyPropertiesEnrollmentDetails model - = new BillingPropertyPropertiesEnrollmentDetails().withDepartmentDisplayName("p") - .withDepartmentId("ebmnzbtbhjpglk") - .withEnrollmentAccountStatus("ohdneuel") - .withEnrollmentAccountDisplayName("hsd") - .withEnrollmentAccountId("t"); - model = BinaryData.fromObject(model).toObject(BillingPropertyPropertiesEnrollmentDetails.class); - Assertions.assertEquals("p", model.departmentDisplayName()); - Assertions.assertEquals("ebmnzbtbhjpglk", model.departmentId()); - Assertions.assertEquals("ohdneuel", model.enrollmentAccountStatus()); - Assertions.assertEquals("hsd", model.enrollmentAccountDisplayName()); - Assertions.assertEquals("t", model.enrollmentAccountId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestInnerTests.java deleted file mode 100644 index 952c131be1dc..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestInnerTests.java +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.BillingRequestInner; -import com.azure.resourcemanager.billing.models.BillingRequestProperties; -import com.azure.resourcemanager.billing.models.BillingRequestPropertiesCreatedBy; -import com.azure.resourcemanager.billing.models.BillingRequestPropertiesLastUpdatedBy; -import com.azure.resourcemanager.billing.models.BillingRequestPropertiesReviewedBy; -import com.azure.resourcemanager.billing.models.BillingRequestStatus; -import com.azure.resourcemanager.billing.models.BillingRequestType; -import com.azure.resourcemanager.billing.models.Principal; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class BillingRequestInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingRequestInner model = BinaryData.fromString( - "{\"properties\":{\"provisioningState\":\"Failed\",\"additionalInformation\":{\"tuzqogsexne\":\"aabjyvayffimrz\",\"wmewzsyy\":\"fdnw\",\"judpfrxt\":\"euzsoi\"},\"reviewedBy\":{\"tenantId\":\"zvaytdwkqbr\",\"objectId\":\"bpaxhexiilivpdt\",\"upn\":\"r\"},\"reviewalDate\":\"2021-10-30T18:40:51Z\",\"billingAccountId\":\"oaxoruzfgsqu\",\"billingAccountName\":\"xrxxlep\",\"billingAccountDisplayName\":\"amxjezwlw\",\"billingAccountPrimaryBillingTenantId\":\"xuqlcvydypat\",\"billingProfileId\":\"oa\",\"billingProfileName\":\"kniod\",\"billingProfileDisplayName\":\"oebwnujhemms\",\"createdBy\":{\"tenantId\":\"kcrodtjinfw\",\"objectId\":\"fltkacjv\",\"upn\":\"kdlfoa\"},\"creationDate\":\"2020-12-29T16:57:58Z\",\"expirationDate\":\"2021-02-17T13:48:46Z\",\"decisionReason\":\"agaowpulpqblylsy\",\"invoiceSectionId\":\"qjnsjervtia\",\"invoiceSectionName\":\"sdszue\",\"invoiceSectionDisplayName\":\"sbzkf\",\"customerId\":\"eyvpnqicvinvkj\",\"customerName\":\"dxrbuukzcle\",\"customerDisplayName\":\"hmlwpaztzpo\",\"subscriptionId\":\"cckwyfzqwhxxbu\",\"subscriptionName\":\"a\",\"subscriptionDisplayName\":\"feqztppriol\",\"justification\":\"rjaltolmncw\",\"recipients\":[{\"tenantId\":\"wcsdbnwdcfhucq\",\"objectId\":\"fuvglsbjjca\",\"upn\":\"xbvtvudu\"},{\"tenantId\":\"cormr\",\"objectId\":\"qtvcofudflvkgj\",\"upn\":\"gdknnqv\"},{\"tenantId\":\"znqntoru\",\"objectId\":\"gsahmkycgrauw\",\"upn\":\"etaebu\"}],\"requestScope\":\"vdmovsmzlxwabm\",\"billingScope\":\"efkifr\",\"status\":\"Approved\",\"type\":\"ProvisioningAccess\",\"lastUpdatedBy\":{\"tenantId\":\"mqlgk\",\"objectId\":\"tndoaongbjc\",\"upn\":\"ujitcjedftww\"},\"lastUpdatedDate\":\"2021-04-17T00:18:26Z\"},\"tags\":{\"bxarzgszufoxci\":\"jvdcpzfoqouic\",\"haz\":\"opidoamciodh\",\"toego\":\"khnzbonlw\"},\"id\":\"wbw\",\"name\":\"kszzcmrvexztv\",\"type\":\"t\"}") - .toObject(BillingRequestInner.class); - Assertions.assertEquals("jvdcpzfoqouic", model.tags().get("bxarzgszufoxci")); - Assertions.assertEquals("aabjyvayffimrz", model.properties().additionalInformation().get("tuzqogsexne")); - Assertions.assertEquals("zvaytdwkqbr", model.properties().reviewedBy().tenantId()); - Assertions.assertEquals("bpaxhexiilivpdt", model.properties().reviewedBy().objectId()); - Assertions.assertEquals("r", model.properties().reviewedBy().upn()); - Assertions.assertEquals("kcrodtjinfw", model.properties().createdBy().tenantId()); - Assertions.assertEquals("fltkacjv", model.properties().createdBy().objectId()); - Assertions.assertEquals("kdlfoa", model.properties().createdBy().upn()); - Assertions.assertEquals("agaowpulpqblylsy", model.properties().decisionReason()); - Assertions.assertEquals("rjaltolmncw", model.properties().justification()); - Assertions.assertEquals("wcsdbnwdcfhucq", model.properties().recipients().get(0).tenantId()); - Assertions.assertEquals("fuvglsbjjca", model.properties().recipients().get(0).objectId()); - Assertions.assertEquals("xbvtvudu", model.properties().recipients().get(0).upn()); - Assertions.assertEquals("vdmovsmzlxwabm", model.properties().requestScope()); - Assertions.assertEquals(BillingRequestStatus.APPROVED, model.properties().status()); - Assertions.assertEquals(BillingRequestType.PROVISIONING_ACCESS, model.properties().type()); - Assertions.assertEquals("mqlgk", model.properties().lastUpdatedBy().tenantId()); - Assertions.assertEquals("tndoaongbjc", model.properties().lastUpdatedBy().objectId()); - Assertions.assertEquals("ujitcjedftww", model.properties().lastUpdatedBy().upn()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingRequestInner model = new BillingRequestInner() - .withTags(mapOf("bxarzgszufoxci", "jvdcpzfoqouic", "haz", "opidoamciodh", "toego", "khnzbonlw")) - .withProperties(new BillingRequestProperties() - .withAdditionalInformation( - mapOf("tuzqogsexne", "aabjyvayffimrz", "wmewzsyy", "fdnw", "judpfrxt", "euzsoi")) - .withReviewedBy(new BillingRequestPropertiesReviewedBy().withTenantId("zvaytdwkqbr") - .withObjectId("bpaxhexiilivpdt") - .withUpn("r")) - .withCreatedBy(new BillingRequestPropertiesCreatedBy().withTenantId("kcrodtjinfw") - .withObjectId("fltkacjv") - .withUpn("kdlfoa")) - .withDecisionReason("agaowpulpqblylsy") - .withJustification("rjaltolmncw") - .withRecipients(Arrays.asList( - new Principal().withTenantId("wcsdbnwdcfhucq").withObjectId("fuvglsbjjca").withUpn("xbvtvudu"), - new Principal().withTenantId("cormr").withObjectId("qtvcofudflvkgj").withUpn("gdknnqv"), - new Principal().withTenantId("znqntoru").withObjectId("gsahmkycgrauw").withUpn("etaebu"))) - .withRequestScope("vdmovsmzlxwabm") - .withStatus(BillingRequestStatus.APPROVED) - .withType(BillingRequestType.PROVISIONING_ACCESS) - .withLastUpdatedBy(new BillingRequestPropertiesLastUpdatedBy().withTenantId("mqlgk") - .withObjectId("tndoaongbjc") - .withUpn("ujitcjedftww"))); - model = BinaryData.fromObject(model).toObject(BillingRequestInner.class); - Assertions.assertEquals("jvdcpzfoqouic", model.tags().get("bxarzgszufoxci")); - Assertions.assertEquals("aabjyvayffimrz", model.properties().additionalInformation().get("tuzqogsexne")); - Assertions.assertEquals("zvaytdwkqbr", model.properties().reviewedBy().tenantId()); - Assertions.assertEquals("bpaxhexiilivpdt", model.properties().reviewedBy().objectId()); - Assertions.assertEquals("r", model.properties().reviewedBy().upn()); - Assertions.assertEquals("kcrodtjinfw", model.properties().createdBy().tenantId()); - Assertions.assertEquals("fltkacjv", model.properties().createdBy().objectId()); - Assertions.assertEquals("kdlfoa", model.properties().createdBy().upn()); - Assertions.assertEquals("agaowpulpqblylsy", model.properties().decisionReason()); - Assertions.assertEquals("rjaltolmncw", model.properties().justification()); - Assertions.assertEquals("wcsdbnwdcfhucq", model.properties().recipients().get(0).tenantId()); - Assertions.assertEquals("fuvglsbjjca", model.properties().recipients().get(0).objectId()); - Assertions.assertEquals("xbvtvudu", model.properties().recipients().get(0).upn()); - Assertions.assertEquals("vdmovsmzlxwabm", model.properties().requestScope()); - Assertions.assertEquals(BillingRequestStatus.APPROVED, model.properties().status()); - Assertions.assertEquals(BillingRequestType.PROVISIONING_ACCESS, model.properties().type()); - Assertions.assertEquals("mqlgk", model.properties().lastUpdatedBy().tenantId()); - Assertions.assertEquals("tndoaongbjc", model.properties().lastUpdatedBy().objectId()); - Assertions.assertEquals("ujitcjedftww", model.properties().lastUpdatedBy().upn()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestListResultTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestListResultTests.java deleted file mode 100644 index 915e900d5e4c..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestListResultTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.BillingRequestListResult; - -public final class BillingRequestListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingRequestListResult model = BinaryData.fromString( - "{\"nextLink\":\"hqcrailvpnpp\",\"value\":[{\"properties\":{\"provisioningState\":\"Provisioning\",\"additionalInformation\":{\"hgw\":\"hdlxyjrxsagafcn\"},\"reviewedBy\":{\"tenantId\":\"nedgfbc\",\"objectId\":\"cvqvpkeqdcv\",\"upn\":\"hvoodsotbobzd\"},\"reviewalDate\":\"2021-08-05T12:30:09Z\",\"billingAccountId\":\"wvnhdldwmgx\",\"billingAccountName\":\"rslpmutwuoeg\",\"billingAccountDisplayName\":\"khjwn\",\"billingAccountPrimaryBillingTenantId\":\"qsluicp\",\"billingProfileId\":\"gk\",\"billingProfileName\":\"lvmbmpaxmodfvuef\",\"billingProfileDisplayName\":\"sbpfvmwyhr\",\"createdBy\":{\"tenantId\":\"yftaakcpw\",\"objectId\":\"zvqtmnubexkp\",\"upn\":\"smond\"},\"creationDate\":\"2021-04-01T23:21:50Z\",\"expirationDate\":\"2021-03-05T21:01:30Z\",\"decisionReason\":\"ypomgkopkwho\",\"invoiceSectionId\":\"pajqgxysm\",\"invoiceSectionName\":\"mbqfqvmk\",\"invoiceSectionDisplayName\":\"oz\",\"customerId\":\"vhelxprglyatdd\",\"customerName\":\"cbcuejrjxgciqi\",\"customerDisplayName\":\"hos\",\"subscriptionId\":\"dqrhzoymib\",\"subscriptionName\":\"qyib\",\"subscriptionDisplayName\":\"wfluszdt\",\"justification\":\"rkwofyyvoqa\",\"recipients\":[{\"tenantId\":\"xpbtgiwbwo\",\"objectId\":\"washr\",\"upn\":\"tkcnqxwb\"},{\"tenantId\":\"kulpiujwaasi\",\"objectId\":\"i\",\"upn\":\"byuqerpqlp\"},{\"tenantId\":\"cciuqgbdbutau\",\"objectId\":\"btkuwhh\",\"upn\":\"ykojoxafnndlpic\"}],\"requestScope\":\"o\",\"billingScope\":\"kcdyhbpk\",\"status\":\"Approved\",\"type\":\"UpdateBillingPolicy\",\"lastUpdatedBy\":{\"tenantId\":\"novvqfovljxy\",\"objectId\":\"uwsyrsndsytgadg\",\"upn\":\"aeaeneqnzarrw\"},\"lastUpdatedDate\":\"2021-05-21T16:07:38Z\"},\"tags\":{\"e\":\"jfqka\",\"bwwift\":\"iipfpubj\",\"ynfs\":\"hqkvpuvksgplsak\",\"jphuopxodlqi\":\"n\"},\"id\":\"torzih\",\"name\":\"eosjswsr\",\"type\":\"slyzrpzbchckqq\"},{\"properties\":{\"provisioningState\":\"Provisioning\",\"additionalInformation\":{\"rwyhqmibzyhwitsm\":\"ysuiizynkedya\",\"pcdpumnz\":\"pyy\"},\"reviewedBy\":{\"tenantId\":\"z\",\"objectId\":\"abikns\",\"upn\":\"gj\"},\"reviewalDate\":\"2021-10-23T19:23:01Z\",\"billingAccountId\":\"dtlwwrlkd\",\"billingAccountName\":\"ncvokotllxdyhg\",\"billingAccountDisplayName\":\"ocogj\",\"billingAccountPrimaryBillingTenantId\":\"dtbnnha\",\"billingProfileId\":\"ocrkvcikh\",\"billingProfileName\":\"p\",\"billingProfileDisplayName\":\"qgxqquezikyw\",\"createdBy\":{\"tenantId\":\"kallatmel\",\"objectId\":\"ipicc\",\"upn\":\"kzivgvvcnayrh\"},\"creationDate\":\"2021-11-02T04:27:35Z\",\"expirationDate\":\"2021-08-20T13:14:33Z\",\"decisionReason\":\"ueedndrdvs\",\"invoiceSectionId\":\"wq\",\"invoiceSectionName\":\"chea\",\"invoiceSectionDisplayName\":\"fmtdaaygdvwvgp\",\"customerId\":\"hgwxrtfudx\",\"customerName\":\"xg\",\"customerDisplayName\":\"agvrvmnpkuk\",\"subscriptionId\":\"i\",\"subscriptionName\":\"blxgwimf\",\"subscriptionDisplayName\":\"hfjx\",\"justification\":\"szkkfoqre\",\"recipients\":[{\"tenantId\":\"ikf\",\"objectId\":\"wneaiv\",\"upn\":\"czelpcirel\"},{\"tenantId\":\"eae\",\"objectId\":\"abfatkl\",\"upn\":\"xbjhwuaanozjosph\"},{\"tenantId\":\"ulpjr\",\"objectId\":\"ag\",\"upn\":\"vimjwos\"},{\"tenantId\":\"xitc\",\"objectId\":\"fcktqumiekke\",\"upn\":\"ikh\"}],\"requestScope\":\"fjhdg\",\"billingScope\":\"gebdunygaeq\",\"status\":\"Declined\",\"type\":\"UpdateBillingPolicy\",\"lastUpdatedBy\":{\"tenantId\":\"pxllrx\",\"objectId\":\"jmoadsuv\",\"upn\":\"m\"},\"lastUpdatedDate\":\"2021-04-05T03:20:46Z\"},\"tags\":{\"yc\":\"sjqbjhhyxxrw\",\"kgymareqnajxqug\":\"duhpk\",\"ubeddg\":\"hky\"},\"id\":\"ofwq\",\"name\":\"zqalkrmnjijpx\",\"type\":\"cqqudf\"}]}") - .toObject(BillingRequestListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingRequestListResult model = new BillingRequestListResult(); - model = BinaryData.fromObject(model).toObject(BillingRequestListResult.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestPropertiesCreatedByTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestPropertiesCreatedByTests.java deleted file mode 100644 index 9a9ba4b63a6d..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestPropertiesCreatedByTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.BillingRequestPropertiesCreatedBy; -import org.junit.jupiter.api.Assertions; - -public final class BillingRequestPropertiesCreatedByTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingRequestPropertiesCreatedBy model = BinaryData - .fromString("{\"tenantId\":\"cizsjqlhkrribdei\",\"objectId\":\"ipqkghvxndzwm\",\"upn\":\"efajpj\"}") - .toObject(BillingRequestPropertiesCreatedBy.class); - Assertions.assertEquals("cizsjqlhkrribdei", model.tenantId()); - Assertions.assertEquals("ipqkghvxndzwm", model.objectId()); - Assertions.assertEquals("efajpj", model.upn()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingRequestPropertiesCreatedBy model - = new BillingRequestPropertiesCreatedBy().withTenantId("cizsjqlhkrribdei") - .withObjectId("ipqkghvxndzwm") - .withUpn("efajpj"); - model = BinaryData.fromObject(model).toObject(BillingRequestPropertiesCreatedBy.class); - Assertions.assertEquals("cizsjqlhkrribdei", model.tenantId()); - Assertions.assertEquals("ipqkghvxndzwm", model.objectId()); - Assertions.assertEquals("efajpj", model.upn()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestPropertiesLastUpdatedByTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestPropertiesLastUpdatedByTests.java deleted file mode 100644 index e1a61672645a..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestPropertiesLastUpdatedByTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.BillingRequestPropertiesLastUpdatedBy; -import org.junit.jupiter.api.Assertions; - -public final class BillingRequestPropertiesLastUpdatedByTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingRequestPropertiesLastUpdatedBy model - = BinaryData.fromString("{\"tenantId\":\"wkqnyhg\",\"objectId\":\"j\",\"upn\":\"ivfxzsjabibsyst\"}") - .toObject(BillingRequestPropertiesLastUpdatedBy.class); - Assertions.assertEquals("wkqnyhg", model.tenantId()); - Assertions.assertEquals("j", model.objectId()); - Assertions.assertEquals("ivfxzsjabibsyst", model.upn()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingRequestPropertiesLastUpdatedBy model - = new BillingRequestPropertiesLastUpdatedBy().withTenantId("wkqnyhg") - .withObjectId("j") - .withUpn("ivfxzsjabibsyst"); - model = BinaryData.fromObject(model).toObject(BillingRequestPropertiesLastUpdatedBy.class); - Assertions.assertEquals("wkqnyhg", model.tenantId()); - Assertions.assertEquals("j", model.objectId()); - Assertions.assertEquals("ivfxzsjabibsyst", model.upn()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestPropertiesReviewedByTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestPropertiesReviewedByTests.java deleted file mode 100644 index 2cc6bc26fbef..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestPropertiesReviewedByTests.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.BillingRequestPropertiesReviewedBy; -import org.junit.jupiter.api.Assertions; - -public final class BillingRequestPropertiesReviewedByTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingRequestPropertiesReviewedBy model - = BinaryData.fromString("{\"tenantId\":\"odn\",\"objectId\":\"xltjcvnhltiu\",\"upn\":\"xnavvwxq\"}") - .toObject(BillingRequestPropertiesReviewedBy.class); - Assertions.assertEquals("odn", model.tenantId()); - Assertions.assertEquals("xltjcvnhltiu", model.objectId()); - Assertions.assertEquals("xnavvwxq", model.upn()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingRequestPropertiesReviewedBy model = new BillingRequestPropertiesReviewedBy().withTenantId("odn") - .withObjectId("xltjcvnhltiu") - .withUpn("xnavvwxq"); - model = BinaryData.fromObject(model).toObject(BillingRequestPropertiesReviewedBy.class); - Assertions.assertEquals("odn", model.tenantId()); - Assertions.assertEquals("xltjcvnhltiu", model.objectId()); - Assertions.assertEquals("xnavvwxq", model.upn()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestPropertiesTests.java deleted file mode 100644 index 1414eb1c3bef..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestPropertiesTests.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.BillingRequestProperties; -import com.azure.resourcemanager.billing.models.BillingRequestPropertiesCreatedBy; -import com.azure.resourcemanager.billing.models.BillingRequestPropertiesLastUpdatedBy; -import com.azure.resourcemanager.billing.models.BillingRequestPropertiesReviewedBy; -import com.azure.resourcemanager.billing.models.BillingRequestStatus; -import com.azure.resourcemanager.billing.models.BillingRequestType; -import com.azure.resourcemanager.billing.models.Principal; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class BillingRequestPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingRequestProperties model = BinaryData.fromString( - "{\"provisioningState\":\"Creating\",\"additionalInformation\":{\"lmnguxaw\":\"aoyzkoow\"},\"reviewedBy\":{\"tenantId\":\"dsyuuximerqfob\",\"objectId\":\"znkbykutwpfhpagm\",\"upn\":\"skdsnfdsdoakg\"},\"reviewalDate\":\"2021-11-05T14:44:19Z\",\"billingAccountId\":\"kkze\",\"billingAccountName\":\"l\",\"billingAccountDisplayName\":\"wpusdsttwvogv\",\"billingAccountPrimaryBillingTenantId\":\"ejdcngqqmoakuf\",\"billingProfileId\":\"jzrwrdgrtw\",\"billingProfileName\":\"nuuzkopbm\",\"billingProfileDisplayName\":\"rfdwoyu\",\"createdBy\":{\"tenantId\":\"iuiefozbhdmsm\",\"objectId\":\"zqhof\",\"upn\":\"maequiahxicslfa\"},\"creationDate\":\"2021-11-28T10:16:40Z\",\"expirationDate\":\"2021-01-04T13:19:25Z\",\"decisionReason\":\"ylhalnswhcc\",\"invoiceSectionId\":\"hka\",\"invoiceSectionName\":\"witqscywuggwoluh\",\"invoiceSectionDisplayName\":\"bwemhairs\",\"customerId\":\"gzd\",\"customerName\":\"swe\",\"customerDisplayName\":\"qwdxggicc\",\"subscriptionId\":\"xqhuexm\",\"subscriptionName\":\"tlstvlzywem\",\"subscriptionDisplayName\":\"rncsdtclu\",\"justification\":\"ypbsfgytguslfead\",\"recipients\":[{\"tenantId\":\"ukyhejhzis\",\"objectId\":\"fpel\",\"upn\":\"p\"}],\"requestScope\":\"ksrpqv\",\"billingScope\":\"zraehtwd\",\"status\":\"Completed\",\"type\":\"RoleAssignment\",\"lastUpdatedBy\":{\"tenantId\":\"byrcdlbhshfwp\",\"objectId\":\"cstwity\",\"upn\":\"evxccedcp\"},\"lastUpdatedDate\":\"2021-05-27T10:40:38Z\"}") - .toObject(BillingRequestProperties.class); - Assertions.assertEquals("aoyzkoow", model.additionalInformation().get("lmnguxaw")); - Assertions.assertEquals("dsyuuximerqfob", model.reviewedBy().tenantId()); - Assertions.assertEquals("znkbykutwpfhpagm", model.reviewedBy().objectId()); - Assertions.assertEquals("skdsnfdsdoakg", model.reviewedBy().upn()); - Assertions.assertEquals("iuiefozbhdmsm", model.createdBy().tenantId()); - Assertions.assertEquals("zqhof", model.createdBy().objectId()); - Assertions.assertEquals("maequiahxicslfa", model.createdBy().upn()); - Assertions.assertEquals("ylhalnswhcc", model.decisionReason()); - Assertions.assertEquals("ypbsfgytguslfead", model.justification()); - Assertions.assertEquals("ukyhejhzis", model.recipients().get(0).tenantId()); - Assertions.assertEquals("fpel", model.recipients().get(0).objectId()); - Assertions.assertEquals("p", model.recipients().get(0).upn()); - Assertions.assertEquals("ksrpqv", model.requestScope()); - Assertions.assertEquals(BillingRequestStatus.COMPLETED, model.status()); - Assertions.assertEquals(BillingRequestType.ROLE_ASSIGNMENT, model.type()); - Assertions.assertEquals("byrcdlbhshfwp", model.lastUpdatedBy().tenantId()); - Assertions.assertEquals("cstwity", model.lastUpdatedBy().objectId()); - Assertions.assertEquals("evxccedcp", model.lastUpdatedBy().upn()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingRequestProperties model = new BillingRequestProperties() - .withAdditionalInformation(mapOf("lmnguxaw", "aoyzkoow")) - .withReviewedBy(new BillingRequestPropertiesReviewedBy().withTenantId("dsyuuximerqfob") - .withObjectId("znkbykutwpfhpagm") - .withUpn("skdsnfdsdoakg")) - .withCreatedBy(new BillingRequestPropertiesCreatedBy().withTenantId("iuiefozbhdmsm") - .withObjectId("zqhof") - .withUpn("maequiahxicslfa")) - .withDecisionReason("ylhalnswhcc") - .withJustification("ypbsfgytguslfead") - .withRecipients(Arrays.asList(new Principal().withTenantId("ukyhejhzis").withObjectId("fpel").withUpn("p"))) - .withRequestScope("ksrpqv") - .withStatus(BillingRequestStatus.COMPLETED) - .withType(BillingRequestType.ROLE_ASSIGNMENT) - .withLastUpdatedBy(new BillingRequestPropertiesLastUpdatedBy().withTenantId("byrcdlbhshfwp") - .withObjectId("cstwity") - .withUpn("evxccedcp")); - model = BinaryData.fromObject(model).toObject(BillingRequestProperties.class); - Assertions.assertEquals("aoyzkoow", model.additionalInformation().get("lmnguxaw")); - Assertions.assertEquals("dsyuuximerqfob", model.reviewedBy().tenantId()); - Assertions.assertEquals("znkbykutwpfhpagm", model.reviewedBy().objectId()); - Assertions.assertEquals("skdsnfdsdoakg", model.reviewedBy().upn()); - Assertions.assertEquals("iuiefozbhdmsm", model.createdBy().tenantId()); - Assertions.assertEquals("zqhof", model.createdBy().objectId()); - Assertions.assertEquals("maequiahxicslfa", model.createdBy().upn()); - Assertions.assertEquals("ylhalnswhcc", model.decisionReason()); - Assertions.assertEquals("ypbsfgytguslfead", model.justification()); - Assertions.assertEquals("ukyhejhzis", model.recipients().get(0).tenantId()); - Assertions.assertEquals("fpel", model.recipients().get(0).objectId()); - Assertions.assertEquals("p", model.recipients().get(0).upn()); - Assertions.assertEquals("ksrpqv", model.requestScope()); - Assertions.assertEquals(BillingRequestStatus.COMPLETED, model.status()); - Assertions.assertEquals(BillingRequestType.ROLE_ASSIGNMENT, model.type()); - Assertions.assertEquals("byrcdlbhshfwp", model.lastUpdatedBy().tenantId()); - Assertions.assertEquals("cstwity", model.lastUpdatedBy().objectId()); - Assertions.assertEquals("evxccedcp", model.lastUpdatedBy().upn()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsCreateOrUpdateMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsCreateOrUpdateMockTests.java deleted file mode 100644 index ca3fffcc6555..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsCreateOrUpdateMockTests.java +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.fluent.models.BillingRequestInner; -import com.azure.resourcemanager.billing.models.BillingRequest; -import com.azure.resourcemanager.billing.models.BillingRequestProperties; -import com.azure.resourcemanager.billing.models.BillingRequestPropertiesCreatedBy; -import com.azure.resourcemanager.billing.models.BillingRequestPropertiesLastUpdatedBy; -import com.azure.resourcemanager.billing.models.BillingRequestPropertiesReviewedBy; -import com.azure.resourcemanager.billing.models.BillingRequestStatus; -import com.azure.resourcemanager.billing.models.BillingRequestType; -import com.azure.resourcemanager.billing.models.Principal; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRequestsCreateOrUpdateMockTests { - @Test - public void testCreateOrUpdate() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"additionalInformation\":{\"rieikmwlaoklfnis\":\"rajubowuywevt\"},\"reviewedBy\":{\"tenantId\":\"ucb\",\"objectId\":\"re\",\"upn\":\"cnnstjcyy\"},\"reviewalDate\":\"2021-03-04T11:08:51Z\",\"billingAccountId\":\"rx\",\"billingAccountName\":\"cl\",\"billingAccountDisplayName\":\"wwtzqzcloy\",\"billingAccountPrimaryBillingTenantId\":\"u\",\"billingProfileId\":\"idhz\",\"billingProfileName\":\"re\",\"billingProfileDisplayName\":\"zsdtm\",\"createdBy\":{\"tenantId\":\"orj\",\"objectId\":\"bchycha\",\"upn\":\"yrfbqvumkxq\"},\"creationDate\":\"2021-05-27T12:05:16Z\",\"expirationDate\":\"2021-07-12T23:34:42Z\",\"decisionReason\":\"ma\",\"invoiceSectionId\":\"nzlpqmpftxefvu\",\"invoiceSectionName\":\"l\",\"invoiceSectionDisplayName\":\"tuxy\",\"customerId\":\"hfcaeo\",\"customerName\":\"fqd\",\"customerDisplayName\":\"jflobhahqmomf\",\"subscriptionId\":\"o\",\"subscriptionName\":\"fr\",\"subscriptionDisplayName\":\"gbmxldjmz\",\"justification\":\"bjesylslur\",\"recipients\":[{\"tenantId\":\"g\",\"objectId\":\"y\",\"upn\":\"dzuqscag\"},{\"tenantId\":\"voupr\",\"objectId\":\"tqzsslhmgwfnivr\",\"upn\":\"fduiolhgyqvpb\"},{\"tenantId\":\"poqzucfz\",\"objectId\":\"czdquurbo\",\"upn\":\"vhvzielbprnqu\"}],\"requestScope\":\"wzcqygg\",\"billingScope\":\"wsvh\",\"status\":\"Expired\",\"type\":\"UpdateBillingPolicy\",\"lastUpdatedBy\":{\"tenantId\":\"ejto\",\"objectId\":\"r\",\"upn\":\"nreh\"},\"lastUpdatedDate\":\"2021-10-16T13:11:04Z\"},\"tags\":{\"l\":\"fjh\",\"nwqsttewu\":\"tpkvegeattbzkgtz\",\"fjxflpditfno\":\"cysje\",\"yuxlvrhprrv\":\"p\"},\"id\":\"onleqflvtl\",\"name\":\"vbstphuyku\",\"type\":\"i\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRequest response = manager.billingRequests() - .createOrUpdate("uehvvpx", new BillingRequestInner() - .withTags( - mapOf("yrletndqlmf", "le", "evnoqayrehjuqwva", "ggnbbuypwovvvsfl", "enqqzlxnqzu", "xrlzhpziha")) - .withProperties(new BillingRequestProperties() - .withAdditionalInformation(mapOf("dpmtonvhgn", "ojlleu", "apmumm", "tmeplhbpj")) - .withReviewedBy( - new BillingRequestPropertiesReviewedBy().withTenantId("a").withObjectId("c").withUpn("iuaiqpm")) - .withCreatedBy(new BillingRequestPropertiesCreatedBy().withTenantId("lvrqo") - .withObjectId("wsieeailwdq") - .withUpn("fydeotmfxlkd")) - .withDecisionReason("mkuuyiuy") - .withJustification("duetbapf") - .withRecipients( - Arrays.asList(new Principal().withTenantId("xtrlqbpx").withObjectId("zkjp").withUpn("gzxvbczw"), - new Principal().withTenantId("egbthm").withObjectId("i").withUpn("buiggrunozf"))) - .withRequestScope("aljthoivsdwsn") - .withStatus(BillingRequestStatus.DECLINED) - .withType(BillingRequestType.UPDATE_BILLING_POLICY) - .withLastUpdatedBy(new BillingRequestPropertiesLastUpdatedBy().withTenantId("hwahfbw") - .withObjectId("bnnxem") - .withUpn("nuqqkotauratnicp"))), - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("fjh", response.tags().get("l")); - Assertions.assertEquals("rajubowuywevt", response.properties().additionalInformation().get("rieikmwlaoklfnis")); - Assertions.assertEquals("ucb", response.properties().reviewedBy().tenantId()); - Assertions.assertEquals("re", response.properties().reviewedBy().objectId()); - Assertions.assertEquals("cnnstjcyy", response.properties().reviewedBy().upn()); - Assertions.assertEquals("orj", response.properties().createdBy().tenantId()); - Assertions.assertEquals("bchycha", response.properties().createdBy().objectId()); - Assertions.assertEquals("yrfbqvumkxq", response.properties().createdBy().upn()); - Assertions.assertEquals("ma", response.properties().decisionReason()); - Assertions.assertEquals("bjesylslur", response.properties().justification()); - Assertions.assertEquals("g", response.properties().recipients().get(0).tenantId()); - Assertions.assertEquals("y", response.properties().recipients().get(0).objectId()); - Assertions.assertEquals("dzuqscag", response.properties().recipients().get(0).upn()); - Assertions.assertEquals("wzcqygg", response.properties().requestScope()); - Assertions.assertEquals(BillingRequestStatus.EXPIRED, response.properties().status()); - Assertions.assertEquals(BillingRequestType.UPDATE_BILLING_POLICY, response.properties().type()); - Assertions.assertEquals("ejto", response.properties().lastUpdatedBy().tenantId()); - Assertions.assertEquals("r", response.properties().lastUpdatedBy().objectId()); - Assertions.assertEquals("nreh", response.properties().lastUpdatedBy().upn()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsGetWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsGetWithResponseMockTests.java deleted file mode 100644 index 4bec7a5eb161..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsGetWithResponseMockTests.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRequest; -import com.azure.resourcemanager.billing.models.BillingRequestStatus; -import com.azure.resourcemanager.billing.models.BillingRequestType; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRequestsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"additionalInformation\":{\"ixhyoipnfdbgso\":\"x\",\"fkbpjn\":\"cienezfvbenn\"},\"reviewedBy\":{\"tenantId\":\"kwwnthropmdud\",\"objectId\":\"iurztv\",\"upn\":\"jhf\"},\"reviewalDate\":\"2021-05-14T23:12:36Z\",\"billingAccountId\":\"koqyouer\",\"billingAccountName\":\"g\",\"billingAccountDisplayName\":\"uzxk\",\"billingAccountPrimaryBillingTenantId\":\"ehhf\",\"billingProfileId\":\"ldhg\",\"billingProfileName\":\"d\",\"billingProfileDisplayName\":\"zqiyuqhtder\",\"createdBy\":{\"tenantId\":\"oka\",\"objectId\":\"whpjlw\",\"upn\":\"edznmxrfomckewv\"},\"creationDate\":\"2021-11-08T21:39:52Z\",\"expirationDate\":\"2021-02-07T19:43:05Z\",\"decisionReason\":\"xfjjtpdyzout\",\"invoiceSectionId\":\"pt\",\"invoiceSectionName\":\"hgnu\",\"invoiceSectionDisplayName\":\"ezygvad\",\"customerId\":\"aqwvkgjpytpmpvdn\",\"customerName\":\"e\",\"customerDisplayName\":\"ufb\",\"subscriptionId\":\"tbnukkfaxz\",\"subscriptionName\":\"bx\",\"subscriptionDisplayName\":\"jisskob\",\"justification\":\"clflioe\",\"recipients\":[{\"tenantId\":\"essmv\",\"objectId\":\"dpsqeq\",\"upn\":\"dxmdses\"},{\"tenantId\":\"ujbjppp\",\"objectId\":\"lpdib\",\"upn\":\"th\"},{\"tenantId\":\"at\",\"objectId\":\"jrnm\",\"upn\":\"zqpl\"}],\"requestScope\":\"kihonik\",\"billingScope\":\"r\",\"status\":\"Pending\",\"type\":\"RoleAssignment\",\"lastUpdatedBy\":{\"tenantId\":\"z\",\"objectId\":\"pntogkensckh\",\"upn\":\"carmoyfx\"},\"lastUpdatedDate\":\"2021-04-24T09:57:10Z\"},\"tags\":{\"kggapvdgtfpeer\":\"uqdndxlyk\",\"rnrnjrcufmbgacnr\":\"cd\",\"eubkqiqmlf\":\"fdtncmspsanma\",\"skkqjmxptuei\":\"hlq\"},\"id\":\"ugkw\",\"name\":\"rq\",\"type\":\"rpahuuonjkkxuk\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRequest response - = manager.billingRequests().getWithResponse("yyhigqkzjuqw", com.azure.core.util.Context.NONE).getValue(); - - Assertions.assertEquals("uqdndxlyk", response.tags().get("kggapvdgtfpeer")); - Assertions.assertEquals("x", response.properties().additionalInformation().get("ixhyoipnfdbgso")); - Assertions.assertEquals("kwwnthropmdud", response.properties().reviewedBy().tenantId()); - Assertions.assertEquals("iurztv", response.properties().reviewedBy().objectId()); - Assertions.assertEquals("jhf", response.properties().reviewedBy().upn()); - Assertions.assertEquals("oka", response.properties().createdBy().tenantId()); - Assertions.assertEquals("whpjlw", response.properties().createdBy().objectId()); - Assertions.assertEquals("edznmxrfomckewv", response.properties().createdBy().upn()); - Assertions.assertEquals("xfjjtpdyzout", response.properties().decisionReason()); - Assertions.assertEquals("clflioe", response.properties().justification()); - Assertions.assertEquals("essmv", response.properties().recipients().get(0).tenantId()); - Assertions.assertEquals("dpsqeq", response.properties().recipients().get(0).objectId()); - Assertions.assertEquals("dxmdses", response.properties().recipients().get(0).upn()); - Assertions.assertEquals("kihonik", response.properties().requestScope()); - Assertions.assertEquals(BillingRequestStatus.PENDING, response.properties().status()); - Assertions.assertEquals(BillingRequestType.ROLE_ASSIGNMENT, response.properties().type()); - Assertions.assertEquals("z", response.properties().lastUpdatedBy().tenantId()); - Assertions.assertEquals("pntogkensckh", response.properties().lastUpdatedBy().objectId()); - Assertions.assertEquals("carmoyfx", response.properties().lastUpdatedBy().upn()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsListByBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsListByBillingAccountMockTests.java deleted file mode 100644 index e9ffc5d79d76..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsListByBillingAccountMockTests.java +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRequest; -import com.azure.resourcemanager.billing.models.BillingRequestStatus; -import com.azure.resourcemanager.billing.models.BillingRequestType; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRequestsListByBillingAccountMockTests { - @Test - public void testListByBillingAccount() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"provisioningState\":\"PendingBilling\",\"additionalInformation\":{\"wzlweeprn\":\"rqkzawbunmpak\",\"scbduxapgrcqebmv\":\"jzltkaszfjs\"},\"reviewedBy\":{\"tenantId\":\"omlnws\",\"objectId\":\"vdlsflxkqesdfeds\",\"upn\":\"zancoinmp\"},\"reviewalDate\":\"2021-10-09T09:48:12Z\",\"billingAccountId\":\"qidkltvdh\",\"billingAccountName\":\"ufbxweiibnto\",\"billingAccountDisplayName\":\"vfnybydh\",\"billingAccountPrimaryBillingTenantId\":\"haouwudhuaorhjk\",\"billingProfileId\":\"wvumosqircamqprl\",\"billingProfileName\":\"rugejcvjkjy\",\"billingProfileDisplayName\":\"cmtagelajdyo\",\"createdBy\":{\"tenantId\":\"qy\",\"objectId\":\"fmzsizzhravr\",\"upn\":\"kjymgqbgcxh\"},\"creationDate\":\"2021-12-10T21:16:38Z\",\"expirationDate\":\"2021-07-05T02:41:10Z\",\"decisionReason\":\"lermkmerg\",\"invoiceSectionId\":\"kirhn\",\"invoiceSectionName\":\"pkcbkfukdljq\",\"invoiceSectionDisplayName\":\"tsdyds\",\"customerId\":\"pafyalo\",\"customerName\":\"wz\",\"customerDisplayName\":\"znyufpqzs\",\"subscriptionId\":\"fgufyjfdkqiy\",\"subscriptionName\":\"djokgwesym\",\"subscriptionDisplayName\":\"hrqpfzl\",\"justification\":\"j\",\"recipients\":[{\"tenantId\":\"lueaujqbbgsim\",\"objectId\":\"jlw\",\"upn\":\"bpjzobdwbcpraswk\"},{\"tenantId\":\"ydtnaczkfwfatgaw\",\"objectId\":\"nskivdwgt\",\"upn\":\"umecsaaq\"}],\"requestScope\":\"qbdiuycsbskowkr\",\"billingScope\":\"zhrbkhtmqo\",\"status\":\"Cancelled\",\"type\":\"InvoiceAccess\",\"lastUpdatedBy\":{\"tenantId\":\"qgucyhfaimqv\",\"objectId\":\"uozkgyf\",\"upn\":\"oehgfmqmskkixvlz\"},\"lastUpdatedDate\":\"2021-03-18T05:11:45Z\"},\"tags\":{\"vzjyielb\":\"pevasyn\",\"qa\":\"rvvbqvknmpecqxg\",\"nxjkhtupsvyouw\":\"ifubnsnstlpwqp\"},\"id\":\"iyxfwkztsmsfbevy\",\"name\":\"lznfhkqytkztado\",\"type\":\"gfzdgjfcycrsvl\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingRequests() - .listByBillingAccount("jiwifhbksldttoh", "clnaihtg", "iqikvllr", 4846427657923674026L, 2804795501462771609L, - false, "xkoi", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("pevasyn", response.iterator().next().tags().get("vzjyielb")); - Assertions.assertEquals("rqkzawbunmpak", - response.iterator().next().properties().additionalInformation().get("wzlweeprn")); - Assertions.assertEquals("omlnws", response.iterator().next().properties().reviewedBy().tenantId()); - Assertions.assertEquals("vdlsflxkqesdfeds", response.iterator().next().properties().reviewedBy().objectId()); - Assertions.assertEquals("zancoinmp", response.iterator().next().properties().reviewedBy().upn()); - Assertions.assertEquals("qy", response.iterator().next().properties().createdBy().tenantId()); - Assertions.assertEquals("fmzsizzhravr", response.iterator().next().properties().createdBy().objectId()); - Assertions.assertEquals("kjymgqbgcxh", response.iterator().next().properties().createdBy().upn()); - Assertions.assertEquals("lermkmerg", response.iterator().next().properties().decisionReason()); - Assertions.assertEquals("j", response.iterator().next().properties().justification()); - Assertions.assertEquals("lueaujqbbgsim", - response.iterator().next().properties().recipients().get(0).tenantId()); - Assertions.assertEquals("jlw", response.iterator().next().properties().recipients().get(0).objectId()); - Assertions.assertEquals("bpjzobdwbcpraswk", response.iterator().next().properties().recipients().get(0).upn()); - Assertions.assertEquals("qbdiuycsbskowkr", response.iterator().next().properties().requestScope()); - Assertions.assertEquals(BillingRequestStatus.CANCELLED, response.iterator().next().properties().status()); - Assertions.assertEquals(BillingRequestType.INVOICE_ACCESS, response.iterator().next().properties().type()); - Assertions.assertEquals("qgucyhfaimqv", response.iterator().next().properties().lastUpdatedBy().tenantId()); - Assertions.assertEquals("uozkgyf", response.iterator().next().properties().lastUpdatedBy().objectId()); - Assertions.assertEquals("oehgfmqmskkixvlz", response.iterator().next().properties().lastUpdatedBy().upn()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsListByBillingProfileMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsListByBillingProfileMockTests.java deleted file mode 100644 index 39bfc4614f32..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsListByBillingProfileMockTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRequest; -import com.azure.resourcemanager.billing.models.BillingRequestStatus; -import com.azure.resourcemanager.billing.models.BillingRequestType; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRequestsListByBillingProfileMockTests { - @Test - public void testListByBillingProfile() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"provisioningState\":\"ConfirmedBilling\",\"additionalInformation\":{\"kkmvhzfovanyrva\":\"de\",\"ewikfyaqandmym\":\"rtgelg\"},\"reviewedBy\":{\"tenantId\":\"qjumovs\",\"objectId\":\"pbvzopaxmfmvsmcw\",\"upn\":\"faxdtnqifbsa\"},\"reviewalDate\":\"2021-08-29T12:23:35Z\",\"billingAccountId\":\"auesugm\",\"billingAccountName\":\"pcjycb\",\"billingAccountDisplayName\":\"lrgttwfldsiuor\",\"billingAccountPrimaryBillingTenantId\":\"ikcedpk\",\"billingProfileId\":\"iwm\",\"billingProfileName\":\"mqr\",\"billingProfileDisplayName\":\"zqv\",\"createdBy\":{\"tenantId\":\"zyayubtgmbxi\",\"objectId\":\"hragpxmib\",\"upn\":\"nupoyryefqmwovyz\"},\"creationDate\":\"2021-06-17T04:37:23Z\",\"expirationDate\":\"2021-04-11T08:41:17Z\",\"decisionReason\":\"fpbjc\",\"invoiceSectionId\":\"gvyieztkutnjil\",\"invoiceSectionName\":\"kkreh\",\"invoiceSectionDisplayName\":\"tmjoduifvu\",\"customerId\":\"faryrvjlg\",\"customerName\":\"zvj\",\"customerDisplayName\":\"ahoyiyaxqvj\",\"subscriptionId\":\"i\",\"subscriptionName\":\"czkddn\",\"subscriptionDisplayName\":\"vbooqbmdqrxy\",\"justification\":\"ae\",\"recipients\":[{\"tenantId\":\"lw\",\"objectId\":\"dtlri\",\"upn\":\"ooy\"},{\"tenantId\":\"uxdtzcq\",\"objectId\":\"sdudgcoz\",\"upn\":\"meh\"},{\"tenantId\":\"antolamlbijuxkq\",\"objectId\":\"czipvwdtgck\",\"upn\":\"qiqdlratrkwxoau\"}],\"requestScope\":\"suykznhrfgsl\",\"billingScope\":\"hpryjfzihuioa\",\"status\":\"Cancelled\",\"type\":\"ProvisioningAccess\",\"lastUpdatedBy\":{\"tenantId\":\"feyvkbdgdd\",\"objectId\":\"hdccxb\",\"upn\":\"uqutkzwtjww\"},\"lastUpdatedDate\":\"2021-06-11T12:35:16Z\"},\"tags\":{\"deg\":\"ijcxfno\",\"uckcatuqbhpow\":\"dydhqkkkb\",\"tpzdlyseidto\":\"n\",\"d\":\"katprytgrhzbq\"},\"id\":\"aw\",\"name\":\"ptvcs\",\"type\":\"tk\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingRequests() - .listByBillingProfile("mbzayspzvrietv", "phmdzxplgtp", "dvatlzmgschn", "rsbkkzovlzdmnfmf", - 1995531024011368029L, 4913449037971080333L, true, "fuwori", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("ijcxfno", response.iterator().next().tags().get("deg")); - Assertions.assertEquals("de", - response.iterator().next().properties().additionalInformation().get("kkmvhzfovanyrva")); - Assertions.assertEquals("qjumovs", response.iterator().next().properties().reviewedBy().tenantId()); - Assertions.assertEquals("pbvzopaxmfmvsmcw", response.iterator().next().properties().reviewedBy().objectId()); - Assertions.assertEquals("faxdtnqifbsa", response.iterator().next().properties().reviewedBy().upn()); - Assertions.assertEquals("zyayubtgmbxi", response.iterator().next().properties().createdBy().tenantId()); - Assertions.assertEquals("hragpxmib", response.iterator().next().properties().createdBy().objectId()); - Assertions.assertEquals("nupoyryefqmwovyz", response.iterator().next().properties().createdBy().upn()); - Assertions.assertEquals("fpbjc", response.iterator().next().properties().decisionReason()); - Assertions.assertEquals("ae", response.iterator().next().properties().justification()); - Assertions.assertEquals("lw", response.iterator().next().properties().recipients().get(0).tenantId()); - Assertions.assertEquals("dtlri", response.iterator().next().properties().recipients().get(0).objectId()); - Assertions.assertEquals("ooy", response.iterator().next().properties().recipients().get(0).upn()); - Assertions.assertEquals("suykznhrfgsl", response.iterator().next().properties().requestScope()); - Assertions.assertEquals(BillingRequestStatus.CANCELLED, response.iterator().next().properties().status()); - Assertions.assertEquals(BillingRequestType.PROVISIONING_ACCESS, response.iterator().next().properties().type()); - Assertions.assertEquals("feyvkbdgdd", response.iterator().next().properties().lastUpdatedBy().tenantId()); - Assertions.assertEquals("hdccxb", response.iterator().next().properties().lastUpdatedBy().objectId()); - Assertions.assertEquals("uqutkzwtjww", response.iterator().next().properties().lastUpdatedBy().upn()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsListByCustomerMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsListByCustomerMockTests.java deleted file mode 100644 index 1a47f07ea3a2..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsListByCustomerMockTests.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRequest; -import com.azure.resourcemanager.billing.models.BillingRequestStatus; -import com.azure.resourcemanager.billing.models.BillingRequestType; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRequestsListByCustomerMockTests { - @Test - public void testListByCustomer() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"provisioningState\":\"Expired\",\"additionalInformation\":{\"gsevmdm\":\"g\",\"zljdnci\":\"enlrstgf\"},\"reviewedBy\":{\"tenantId\":\"vamyyznmrgcdo\",\"objectId\":\"v\",\"upn\":\"gytoxuwhtt\"},\"reviewalDate\":\"2021-04-20T14:48:23Z\",\"billingAccountId\":\"aqm\",\"billingAccountName\":\"gszplus\",\"billingAccountDisplayName\":\"kpdzzmssgpgv\",\"billingAccountPrimaryBillingTenantId\":\"yejidbdqzsqun\",\"billingProfileId\":\"wztlvvwsnmrkky\",\"billingProfileName\":\"repwpwfkcaux\",\"billingProfileDisplayName\":\"avcpfpdofuckclbt\",\"createdBy\":{\"tenantId\":\"evsolzwilf\",\"objectId\":\"ojfsqebuu\",\"upn\":\"xhfxfjwpdkkt\"},\"creationDate\":\"2021-07-26T07:58:32Z\",\"expirationDate\":\"2021-09-29T01:37:44Z\",\"decisionReason\":\"mbrwg\",\"invoiceSectionId\":\"xljbkhxsd\",\"invoiceSectionName\":\"au\",\"invoiceSectionDisplayName\":\"dmhweqjfyxydgto\",\"customerId\":\"qbvwglgw\",\"customerName\":\"vxakglh\",\"customerDisplayName\":\"esrfgamqiydvx\",\"subscriptionId\":\"d\",\"subscriptionName\":\"hgoqgsoyqyxyj\",\"subscriptionDisplayName\":\"b\",\"justification\":\"bispglqjoxtdah\",\"recipients\":[{\"tenantId\":\"ovt\",\"objectId\":\"ztivfwjl\",\"upn\":\"zekfsrmauklajv\"},{\"tenantId\":\"oczhapejovtk\",\"objectId\":\"nhwhhnoyrzaao\",\"upn\":\"hpm\"},{\"tenantId\":\"nvjeateaxxc\",\"objectId\":\"oxdjxldnaryy\",\"upn\":\"zkdolrndwdbvxvza\"}],\"requestScope\":\"doyqx\",\"billingScope\":\"nkfthmcxqqxmyz\",\"status\":\"Pending\",\"type\":\"ProvisioningAccess\",\"lastUpdatedBy\":{\"tenantId\":\"ohrvmz\",\"objectId\":\"razadivznllaslks\",\"upn\":\"jqjpv\"},\"lastUpdatedDate\":\"2021-01-26T11:56:04Z\"},\"tags\":{\"roigbsfsgsaenwld\":\"jtgzgtaiywbq\",\"jc\":\"mhljqlxspm\",\"hsxrznmgsdaluyc\":\"ryldsxeb\"},\"id\":\"efrbhseuerbg\",\"name\":\"xebjl\",\"type\":\"dcaytujraxd\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingRequests() - .listByCustomer("tzc", "tbqgdirdamm", "zjgcfjfx", "bwjjirmuydgf", "tmdofgeoag", 3523517715336835533L, - 7342845158255434354L, true, "xodwxm", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("jtgzgtaiywbq", response.iterator().next().tags().get("roigbsfsgsaenwld")); - Assertions.assertEquals("g", response.iterator().next().properties().additionalInformation().get("gsevmdm")); - Assertions.assertEquals("vamyyznmrgcdo", response.iterator().next().properties().reviewedBy().tenantId()); - Assertions.assertEquals("v", response.iterator().next().properties().reviewedBy().objectId()); - Assertions.assertEquals("gytoxuwhtt", response.iterator().next().properties().reviewedBy().upn()); - Assertions.assertEquals("evsolzwilf", response.iterator().next().properties().createdBy().tenantId()); - Assertions.assertEquals("ojfsqebuu", response.iterator().next().properties().createdBy().objectId()); - Assertions.assertEquals("xhfxfjwpdkkt", response.iterator().next().properties().createdBy().upn()); - Assertions.assertEquals("mbrwg", response.iterator().next().properties().decisionReason()); - Assertions.assertEquals("bispglqjoxtdah", response.iterator().next().properties().justification()); - Assertions.assertEquals("ovt", response.iterator().next().properties().recipients().get(0).tenantId()); - Assertions.assertEquals("ztivfwjl", response.iterator().next().properties().recipients().get(0).objectId()); - Assertions.assertEquals("zekfsrmauklajv", response.iterator().next().properties().recipients().get(0).upn()); - Assertions.assertEquals("doyqx", response.iterator().next().properties().requestScope()); - Assertions.assertEquals(BillingRequestStatus.PENDING, response.iterator().next().properties().status()); - Assertions.assertEquals(BillingRequestType.PROVISIONING_ACCESS, response.iterator().next().properties().type()); - Assertions.assertEquals("ohrvmz", response.iterator().next().properties().lastUpdatedBy().tenantId()); - Assertions.assertEquals("razadivznllaslks", response.iterator().next().properties().lastUpdatedBy().objectId()); - Assertions.assertEquals("jqjpv", response.iterator().next().properties().lastUpdatedBy().upn()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsListByInvoiceSectionMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsListByInvoiceSectionMockTests.java deleted file mode 100644 index 79c3a99f8902..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsListByInvoiceSectionMockTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRequest; -import com.azure.resourcemanager.billing.models.BillingRequestStatus; -import com.azure.resourcemanager.billing.models.BillingRequestType; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRequestsListByInvoiceSectionMockTests { - @Test - public void testListByInvoiceSection() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"provisioningState\":\"ConfirmedBilling\",\"additionalInformation\":{\"gomvvhxowpcbapn\":\"ehkho\"},\"reviewedBy\":{\"tenantId\":\"aqawbmpspfeylql\",\"objectId\":\"vvujex\",\"upn\":\"glxrkgjnm\"},\"reviewalDate\":\"2021-05-18T06:01:13Z\",\"billingAccountId\":\"lavxjfiuofpiei\",\"billingAccountName\":\"lvs\",\"billingAccountDisplayName\":\"ywjopac\",\"billingAccountPrimaryBillingTenantId\":\"hydv\",\"billingProfileId\":\"mfngpmillxgjsci\",\"billingProfileName\":\"gsoriobij\",\"billingProfileDisplayName\":\"ydyeuy\",\"createdBy\":{\"tenantId\":\"okayrg\",\"objectId\":\"b\",\"upn\":\"opdweoft\"},\"creationDate\":\"2021-11-30T05:17:10Z\",\"expirationDate\":\"2021-07-17T00:13:26Z\",\"decisionReason\":\"gsioc\",\"invoiceSectionId\":\"kmv\",\"invoiceSectionName\":\"nx\",\"invoiceSectionDisplayName\":\"fffhtjnwos\",\"customerId\":\"fjxtvlxxzqfc\",\"customerName\":\"riomxeezwyhj\",\"customerDisplayName\":\"jiqegmxdbs\",\"subscriptionId\":\"cwhpy\",\"subscriptionName\":\"kgdet\",\"subscriptionDisplayName\":\"wcanzbjekwuyckyv\",\"justification\":\"nsm\",\"recipients\":[{\"tenantId\":\"wjbct\",\"objectId\":\"p\",\"upn\":\"jqjtotd\"},{\"tenantId\":\"osc\",\"objectId\":\"hwuusiecktybh\",\"upn\":\"xidhhxomil\"},{\"tenantId\":\"xj\",\"objectId\":\"ugxwjwilmqrslaat\",\"upn\":\"twujjzgx\"}],\"requestScope\":\"qwlxrhg\",\"billingScope\":\"hvtqqykbkk\",\"status\":\"Declined\",\"type\":\"RoleAssignment\",\"lastUpdatedBy\":{\"tenantId\":\"gm\",\"objectId\":\"rvvmvmcofn\",\"upn\":\"lbsnosnqliw\"},\"lastUpdatedDate\":\"2020-12-31T14:56:04Z\"},\"tags\":{\"htgmknazgbj\":\"fetya\"},\"id\":\"rpgiqstt\",\"name\":\"ucrcmmai\",\"type\":\"p\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingRequests() - .listByInvoiceSection("pryj", "gtnse", "ouxly", "s", "vyljurkeposehqq", 7732723891535906574L, - 5776245564488623982L, true, "wjwdsdlzmkxer", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("fetya", response.iterator().next().tags().get("htgmknazgbj")); - Assertions.assertEquals("ehkho", - response.iterator().next().properties().additionalInformation().get("gomvvhxowpcbapn")); - Assertions.assertEquals("aqawbmpspfeylql", response.iterator().next().properties().reviewedBy().tenantId()); - Assertions.assertEquals("vvujex", response.iterator().next().properties().reviewedBy().objectId()); - Assertions.assertEquals("glxrkgjnm", response.iterator().next().properties().reviewedBy().upn()); - Assertions.assertEquals("okayrg", response.iterator().next().properties().createdBy().tenantId()); - Assertions.assertEquals("b", response.iterator().next().properties().createdBy().objectId()); - Assertions.assertEquals("opdweoft", response.iterator().next().properties().createdBy().upn()); - Assertions.assertEquals("gsioc", response.iterator().next().properties().decisionReason()); - Assertions.assertEquals("nsm", response.iterator().next().properties().justification()); - Assertions.assertEquals("wjbct", response.iterator().next().properties().recipients().get(0).tenantId()); - Assertions.assertEquals("p", response.iterator().next().properties().recipients().get(0).objectId()); - Assertions.assertEquals("jqjtotd", response.iterator().next().properties().recipients().get(0).upn()); - Assertions.assertEquals("qwlxrhg", response.iterator().next().properties().requestScope()); - Assertions.assertEquals(BillingRequestStatus.DECLINED, response.iterator().next().properties().status()); - Assertions.assertEquals(BillingRequestType.ROLE_ASSIGNMENT, response.iterator().next().properties().type()); - Assertions.assertEquals("gm", response.iterator().next().properties().lastUpdatedBy().tenantId()); - Assertions.assertEquals("rvvmvmcofn", response.iterator().next().properties().lastUpdatedBy().objectId()); - Assertions.assertEquals("lbsnosnqliw", response.iterator().next().properties().lastUpdatedBy().upn()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsListByUserMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsListByUserMockTests.java deleted file mode 100644 index f845df8c2323..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRequestsListByUserMockTests.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRequest; -import com.azure.resourcemanager.billing.models.BillingRequestStatus; -import com.azure.resourcemanager.billing.models.BillingRequestType; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRequestsListByUserMockTests { - @Test - public void testListByUser() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"provisioningState\":\"ConfirmedBilling\",\"additionalInformation\":{\"pg\":\"ssf\",\"jymjnhjluq\":\"kncjmgvsnvbtqdxf\",\"ub\":\"lbsu\"},\"reviewedBy\":{\"tenantId\":\"kdlhzwhc\",\"objectId\":\"vbosjj\",\"upn\":\"izh\"},\"reviewalDate\":\"2021-03-26T07:56:17Z\",\"billingAccountId\":\"yayt\",\"billingAccountName\":\"ly\",\"billingAccountDisplayName\":\"cgniuarlc\",\"billingAccountPrimaryBillingTenantId\":\"wgsx\",\"billingProfileId\":\"iocwdgujj\",\"billingProfileName\":\"fgrzx\",\"billingProfileDisplayName\":\"rcb\",\"createdBy\":{\"tenantId\":\"fzqsymjwenjcytes\",\"objectId\":\"u\",\"upn\":\"tfodq\"},\"creationDate\":\"2021-08-29T00:28:24Z\",\"expirationDate\":\"2021-12-05T21:31:40Z\",\"decisionReason\":\"zivrtrfzh\",\"invoiceSectionId\":\"zvhj\",\"invoiceSectionName\":\"xdyyrud\",\"invoiceSectionDisplayName\":\"hswtvdkxbqssgfe\",\"customerId\":\"fdxbvwfqjchiv\",\"customerName\":\"ija\",\"customerDisplayName\":\"ndmuvardlmz\",\"subscriptionId\":\"tp\",\"subscriptionName\":\"muhcuhtuzl\",\"subscriptionDisplayName\":\"wyopgarpfctwrapc\",\"justification\":\"ojqyvzes\",\"recipients\":[{\"tenantId\":\"snj\",\"objectId\":\"owa\",\"upn\":\"c\"},{\"tenantId\":\"azab\",\"objectId\":\"dtsewkaupwhlzyc\",\"upn\":\"emgjlm\"},{\"tenantId\":\"dorsirxxhy\",\"objectId\":\"qakofajf\",\"upn\":\"prfvmkinwteyrqsh\"},{\"tenantId\":\"bcejopylbl\",\"objectId\":\"prrw\",\"upn\":\"pimtc\"}],\"requestScope\":\"fx\",\"billingScope\":\"ytzfsl\",\"status\":\"Completed\",\"type\":\"ProvisioningAccess\",\"lastUpdatedBy\":{\"tenantId\":\"mgobliqemc\",\"objectId\":\"iisklbonxx\",\"upn\":\"jxvtrkfkgenjqnnp\"},\"lastUpdatedDate\":\"2021-01-30T09:34:46Z\"},\"tags\":{\"xigfoujjc\":\"n\",\"wny\":\"gdqmrlhnzkwop\",\"wjezbfqployuekdc\":\"nxuprrxy\"},\"id\":\"uftrs\",\"name\":\"jmnsvujnjk\",\"type\":\"volefcj\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingRequests() - .listByUser("ttlnrjdszdb", "ziciqppoqvgpn", 4005256862612098452L, 9051291066973021159L, true, "wjnoxuo", - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("n", response.iterator().next().tags().get("xigfoujjc")); - Assertions.assertEquals("ssf", response.iterator().next().properties().additionalInformation().get("pg")); - Assertions.assertEquals("kdlhzwhc", response.iterator().next().properties().reviewedBy().tenantId()); - Assertions.assertEquals("vbosjj", response.iterator().next().properties().reviewedBy().objectId()); - Assertions.assertEquals("izh", response.iterator().next().properties().reviewedBy().upn()); - Assertions.assertEquals("fzqsymjwenjcytes", response.iterator().next().properties().createdBy().tenantId()); - Assertions.assertEquals("u", response.iterator().next().properties().createdBy().objectId()); - Assertions.assertEquals("tfodq", response.iterator().next().properties().createdBy().upn()); - Assertions.assertEquals("zivrtrfzh", response.iterator().next().properties().decisionReason()); - Assertions.assertEquals("ojqyvzes", response.iterator().next().properties().justification()); - Assertions.assertEquals("snj", response.iterator().next().properties().recipients().get(0).tenantId()); - Assertions.assertEquals("owa", response.iterator().next().properties().recipients().get(0).objectId()); - Assertions.assertEquals("c", response.iterator().next().properties().recipients().get(0).upn()); - Assertions.assertEquals("fx", response.iterator().next().properties().requestScope()); - Assertions.assertEquals(BillingRequestStatus.COMPLETED, response.iterator().next().properties().status()); - Assertions.assertEquals(BillingRequestType.PROVISIONING_ACCESS, response.iterator().next().properties().type()); - Assertions.assertEquals("mgobliqemc", response.iterator().next().properties().lastUpdatedBy().tenantId()); - Assertions.assertEquals("iisklbonxx", response.iterator().next().properties().lastUpdatedBy().objectId()); - Assertions.assertEquals("jxvtrkfkgenjqnnp", response.iterator().next().properties().lastUpdatedBy().upn()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentInnerTests.java deleted file mode 100644 index e4e0532d1b96..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentInnerTests.java +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.BillingRoleAssignmentInner; -import com.azure.resourcemanager.billing.models.BillingRoleAssignmentProperties; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class BillingRoleAssignmentInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingRoleAssignmentInner model = BinaryData.fromString( - "{\"properties\":{\"provisioningState\":\"New\",\"createdOn\":\"2021-04-01T03:56:35Z\",\"createdByPrincipalTenantId\":\"kvpbjxbkzbz\",\"createdByPrincipalId\":\"vncjabudurgk\",\"createdByPrincipalPuid\":\"mokzhjjklf\",\"createdByUserEmailAddress\":\"mouwqlgzrfzeey\",\"modifiedOn\":\"2021-05-25T08:30:43Z\",\"modifiedByPrincipalPuid\":\"ikayuhqlbjbsybb\",\"modifiedByUserEmailAddress\":\"r\",\"modifiedByPrincipalId\":\"ldgmfpgvmpip\",\"modifiedByPrincipalTenantId\":\"ltha\",\"principalPuid\":\"x\",\"principalId\":\"mwutwbdsre\",\"principalTenantId\":\"drhneuyow\",\"roleDefinitionId\":\"kdw\",\"scope\":\"i\",\"userAuthenticationType\":\"bi\",\"userEmailAddress\":\"gpikpzimejza\",\"principalTenantName\":\"fzxiavrmb\",\"principalDisplayName\":\"nokixrjqcirgz\",\"principalType\":\"DirectoryRole\",\"billingRequestId\":\"azszrnwoiindfpw\",\"billingAccountId\":\"ylwbtlhflsjcdhsz\",\"billingAccountDisplayName\":\"vfbgofeljagrqmqh\",\"billingProfileId\":\"vriiio\",\"billingProfileDisplayName\":\"al\",\"invoiceSectionId\":\"fk\",\"invoiceSectionDisplayName\":\"vsexsowuelu\",\"customerId\":\"hahhxvrhmzkwpj\",\"customerDisplayName\":\"wspughftqsxhqx\"},\"tags\":{\"fzdm\":\"ukndxdigrjgu\",\"otzi\":\"yqtfihwh\",\"phoszqz\":\"gamv\"},\"id\":\"phqamvdkfwynwcvt\",\"name\":\"vkay\",\"type\":\"mtnvyq\"}") - .toObject(BillingRoleAssignmentInner.class); - Assertions.assertEquals("ukndxdigrjgu", model.tags().get("fzdm")); - Assertions.assertEquals("x", model.properties().principalPuid()); - Assertions.assertEquals("mwutwbdsre", model.properties().principalId()); - Assertions.assertEquals("drhneuyow", model.properties().principalTenantId()); - Assertions.assertEquals("kdw", model.properties().roleDefinitionId()); - Assertions.assertEquals("i", model.properties().scope()); - Assertions.assertEquals("bi", model.properties().userAuthenticationType()); - Assertions.assertEquals("gpikpzimejza", model.properties().userEmailAddress()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingRoleAssignmentInner model = new BillingRoleAssignmentInner() - .withTags(mapOf("fzdm", "ukndxdigrjgu", "otzi", "yqtfihwh", "phoszqz", "gamv")) - .withProperties(new BillingRoleAssignmentProperties().withPrincipalPuid("x") - .withPrincipalId("mwutwbdsre") - .withPrincipalTenantId("drhneuyow") - .withRoleDefinitionId("kdw") - .withScope("i") - .withUserAuthenticationType("bi") - .withUserEmailAddress("gpikpzimejza")); - model = BinaryData.fromObject(model).toObject(BillingRoleAssignmentInner.class); - Assertions.assertEquals("ukndxdigrjgu", model.tags().get("fzdm")); - Assertions.assertEquals("x", model.properties().principalPuid()); - Assertions.assertEquals("mwutwbdsre", model.properties().principalId()); - Assertions.assertEquals("drhneuyow", model.properties().principalTenantId()); - Assertions.assertEquals("kdw", model.properties().roleDefinitionId()); - Assertions.assertEquals("i", model.properties().scope()); - Assertions.assertEquals("bi", model.properties().userAuthenticationType()); - Assertions.assertEquals("gpikpzimejza", model.properties().userEmailAddress()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentListResultInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentListResultInnerTests.java deleted file mode 100644 index fc0d96601889..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentListResultInnerTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.BillingRoleAssignmentListResultInner; - -public final class BillingRoleAssignmentListResultInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingRoleAssignmentListResultInner model = BinaryData.fromString( - "{\"nextLink\":\"kw\",\"value\":[{\"properties\":{\"provisioningState\":\"PendingBilling\",\"createdOn\":\"2021-10-11T20:34:37Z\",\"createdByPrincipalTenantId\":\"rh\",\"createdByPrincipalId\":\"nai\",\"createdByPrincipalPuid\":\"xccbdreaxhcex\",\"createdByUserEmailAddress\":\"rvqahqkghtpwi\",\"modifiedOn\":\"2021-03-19T04:26:57Z\",\"modifiedByPrincipalPuid\":\"jsvfycxzbfvoowv\",\"modifiedByUserEmailAddress\":\"mtg\",\"modifiedByPrincipalId\":\"ppyostronzmyhgf\",\"modifiedByPrincipalTenantId\":\"nsxkmcwaekrrjr\",\"principalPuid\":\"fxtsgum\",\"principalId\":\"glikkxwslolb\",\"principalTenantId\":\"vuzlm\",\"roleDefinitionId\":\"felfktg\",\"scope\":\"crpw\",\"userAuthenticationType\":\"eznoig\",\"userEmailAddress\":\"njwmwkpnbsazejj\",\"principalTenantName\":\"kagfhsxtt\",\"principalDisplayName\":\"gzxnfaazpxdtnk\",\"principalType\":\"Everyone\",\"billingRequestId\":\"j\",\"billingAccountId\":\"wuenvr\",\"billingAccountDisplayName\":\"yo\",\"billingProfileId\":\"ibreb\",\"billingProfileDisplayName\":\"aysjkixqtnqttez\",\"invoiceSectionId\":\"fffiak\",\"invoiceSectionDisplayName\":\"pqqmted\",\"customerId\":\"mmji\",\"customerDisplayName\":\"eozphv\"},\"tags\":{\"ncyg\":\"y\",\"vipmdscwxqupevzh\":\"p\",\"jujbypelmcuvhixb\":\"stotxh\",\"ttpkiwkkbnujrywv\":\"xyfwnylrcool\"},\"id\":\"lbfpncurd\",\"name\":\"iwii\",\"type\":\"htywubxcbihwq\"},{\"properties\":{\"provisioningState\":\"Pending\",\"createdOn\":\"2021-10-01T05:31:27Z\",\"createdByPrincipalTenantId\":\"jchrdgoihxumw\",\"createdByPrincipalId\":\"ond\",\"createdByPrincipalPuid\":\"luudfdlwggytsb\",\"createdByUserEmailAddress\":\"ovvtgseinqfiu\",\"modifiedOn\":\"2021-09-17T22:17:43Z\",\"modifiedByPrincipalPuid\":\"npirgnepttw\",\"modifiedByUserEmailAddress\":\"sniffc\",\"modifiedByPrincipalId\":\"qnrojlpijnkrxfrd\",\"modifiedByPrincipalTenantId\":\"c\",\"principalPuid\":\"tizzronasxif\",\"principalId\":\"zq\",\"principalTenantId\":\"hftwesgog\",\"roleDefinitionId\":\"zhonnxkrlgnyhmo\",\"scope\":\"xkk\",\"userAuthenticationType\":\"h\",\"userEmailAddress\":\"gh\",\"principalTenantName\":\"bdhqxvcxgf\",\"principalDisplayName\":\"dsofbshrns\",\"principalType\":\"User\",\"billingRequestId\":\"wdvzyy\",\"billingAccountId\":\"cnunvjsr\",\"billingAccountDisplayName\":\"f\",\"billingProfileId\":\"nopqgikyzirtx\",\"billingProfileDisplayName\":\"uxzejntpsew\",\"invoiceSectionId\":\"oi\",\"invoiceSectionDisplayName\":\"ukry\",\"customerId\":\"tqmieox\",\"customerDisplayName\":\"ggufhyaomtb\"},\"tags\":{\"pjbi\":\"avgrvkffovjz\",\"yo\":\"gjmfxumvfcl\"},\"id\":\"xnbkfezzxscyhwzd\",\"name\":\"irujbz\",\"type\":\"omvzzbtd\"},{\"properties\":{\"provisioningState\":\"PendingBilling\",\"createdOn\":\"2021-05-17T04:02:41Z\",\"createdByPrincipalTenantId\":\"ujviylwdshfs\",\"createdByPrincipalId\":\"rbgyefry\",\"createdByPrincipalPuid\":\"gaojf\",\"createdByUserEmailAddress\":\"nc\",\"modifiedOn\":\"2021-04-29T14:25:51Z\",\"modifiedByPrincipalPuid\":\"fhir\",\"modifiedByUserEmailAddress\":\"ymoxoftpipiwyczu\",\"modifiedByPrincipalId\":\"a\",\"modifiedByPrincipalTenantId\":\"qjlihhyuspska\",\"principalPuid\":\"vlmfwdgzxulucv\",\"principalId\":\"mrsreuzvxurisjnh\",\"principalTenantId\":\"txifqj\",\"roleDefinitionId\":\"gxmrhublwp\",\"scope\":\"sutrgjup\",\"userAuthenticationType\":\"utpwoqhihejqgw\",\"userEmailAddress\":\"nfqn\",\"principalTenantName\":\"ypsxjvfoim\",\"principalDisplayName\":\"slirciz\",\"principalType\":\"DirectoryRole\",\"billingRequestId\":\"dfcea\",\"billingAccountId\":\"lhvygdyftu\",\"billingAccountDisplayName\":\"twnawjslbiwkojgc\",\"billingProfileId\":\"tsf\",\"billingProfileDisplayName\":\"nbaeqphchqn\",\"invoiceSectionId\":\"rpxeh\",\"invoiceSectionDisplayName\":\"rykqgaifmvikl\",\"customerId\":\"dvk\",\"customerDisplayName\":\"ejd\"},\"tags\":{\"volvtn\":\"cvdsrhnj\"},\"id\":\"qfzgemjdftul\",\"name\":\"ltducea\",\"type\":\"tmczuomejwcwwqi\"}]}") - .toObject(BillingRoleAssignmentListResultInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingRoleAssignmentListResultInner model = new BillingRoleAssignmentListResultInner(); - model = BinaryData.fromObject(model).toObject(BillingRoleAssignmentListResultInner.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentPropertiesTests.java deleted file mode 100644 index 1a2c2dbe15e9..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentPropertiesTests.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.BillingRoleAssignmentProperties; -import org.junit.jupiter.api.Assertions; - -public final class BillingRoleAssignmentPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingRoleAssignmentProperties model = BinaryData.fromString( - "{\"provisioningState\":\"Expired\",\"createdOn\":\"2021-01-15T03:57:36Z\",\"createdByPrincipalTenantId\":\"pcnp\",\"createdByPrincipalId\":\"cjaesgvvs\",\"createdByPrincipalPuid\":\"yajguqfhwygzlv\",\"createdByUserEmailAddress\":\"kfxu\",\"modifiedOn\":\"2021-10-16T01:46:34Z\",\"modifiedByPrincipalPuid\":\"wzrmuh\",\"modifiedByUserEmailAddress\":\"fcqdpsq\",\"modifiedByPrincipalId\":\"vpsvuoymgcce\",\"modifiedByPrincipalTenantId\":\"ezrypql\",\"principalPuid\":\"eokerqwkyhkobopg\",\"principalId\":\"dkow\",\"principalTenantId\":\"bqpc\",\"roleDefinitionId\":\"fkbw\",\"scope\":\"snjvcdwxlpqekftn\",\"userAuthenticationType\":\"tjsyin\",\"userEmailAddress\":\"fq\",\"principalTenantName\":\"mtdh\",\"principalDisplayName\":\"dvypgikdgsz\",\"principalType\":\"DirectoryRole\",\"billingRequestId\":\"irryuzhlh\",\"billingAccountId\":\"oqrvqqaatjin\",\"billingAccountDisplayName\":\"goupmfiibfg\",\"billingProfileId\":\"ioolvrwxkvtkkgll\",\"billingProfileDisplayName\":\"jygvjayvbl\",\"invoiceSectionId\":\"vkzuhbxvvyhgso\",\"invoiceSectionDisplayName\":\"yrqufegxuvwz\",\"customerId\":\"nhlmctlpdng\",\"customerDisplayName\":\"vgbmhr\"}") - .toObject(BillingRoleAssignmentProperties.class); - Assertions.assertEquals("eokerqwkyhkobopg", model.principalPuid()); - Assertions.assertEquals("dkow", model.principalId()); - Assertions.assertEquals("bqpc", model.principalTenantId()); - Assertions.assertEquals("fkbw", model.roleDefinitionId()); - Assertions.assertEquals("snjvcdwxlpqekftn", model.scope()); - Assertions.assertEquals("tjsyin", model.userAuthenticationType()); - Assertions.assertEquals("fq", model.userEmailAddress()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingRoleAssignmentProperties model - = new BillingRoleAssignmentProperties().withPrincipalPuid("eokerqwkyhkobopg") - .withPrincipalId("dkow") - .withPrincipalTenantId("bqpc") - .withRoleDefinitionId("fkbw") - .withScope("snjvcdwxlpqekftn") - .withUserAuthenticationType("tjsyin") - .withUserEmailAddress("fq"); - model = BinaryData.fromObject(model).toObject(BillingRoleAssignmentProperties.class); - Assertions.assertEquals("eokerqwkyhkobopg", model.principalPuid()); - Assertions.assertEquals("dkow", model.principalId()); - Assertions.assertEquals("bqpc", model.principalTenantId()); - Assertions.assertEquals("fkbw", model.roleDefinitionId()); - Assertions.assertEquals("snjvcdwxlpqekftn", model.scope()); - Assertions.assertEquals("tjsyin", model.userAuthenticationType()); - Assertions.assertEquals("fq", model.userEmailAddress()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateByBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateByBillingAccountMockTests.java deleted file mode 100644 index 48b51fd6ab9f..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateByBillingAccountMockTests.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleAssignment; -import com.azure.resourcemanager.billing.models.BillingRoleAssignmentProperties; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsCreateByBillingAccountMockTests { - @Test - public void testCreateByBillingAccount() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"createdOn\":\"2021-09-16T21:20:45Z\",\"createdByPrincipalTenantId\":\"qe\",\"createdByPrincipalId\":\"jncpmyht\",\"createdByPrincipalPuid\":\"dmvghcmi\",\"createdByUserEmailAddress\":\"lwkfef\",\"modifiedOn\":\"2021-11-27T19:17:58Z\",\"modifiedByPrincipalPuid\":\"rtalqee\",\"modifiedByUserEmailAddress\":\"dfyimooaezk\",\"modifiedByPrincipalId\":\"ms\",\"modifiedByPrincipalTenantId\":\"ih\",\"principalPuid\":\"wbywaazba\",\"principalId\":\"ekfz\",\"principalTenantId\":\"n\",\"roleDefinitionId\":\"bfb\",\"scope\":\"ow\",\"userAuthenticationType\":\"ljdkxhmewyaolc\",\"userEmailAddress\":\"x\",\"principalTenantName\":\"d\",\"principalDisplayName\":\"yytbpkrpkhq\",\"principalType\":\"None\",\"billingRequestId\":\"enefnoafpcnrx\",\"billingAccountId\":\"rxowvhufcmuajwb\",\"billingAccountDisplayName\":\"p\",\"billingProfileId\":\"ozfrfawtnnsv\",\"billingProfileDisplayName\":\"ajynihtibu\",\"invoiceSectionId\":\"zq\",\"invoiceSectionDisplayName\":\"luctblf\",\"customerId\":\"bgcgyohrcmeqlj\",\"customerDisplayName\":\"umhycxonebld\"},\"tags\":{\"uvohufzdtsrp\":\"mdfjwcngkwxjsj\",\"ylgmgbh\":\"uvgzacrzhns\"},\"id\":\"czouan\",\"name\":\"fulvcxgl\",\"type\":\"oqwb\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRoleAssignment response = manager.billingRoleAssignments() - .createByBillingAccount("lfymtrts", - new BillingRoleAssignmentProperties().withPrincipalPuid("zspfyvslaz") - .withPrincipalId("plxg") - .withPrincipalTenantId("um") - .withRoleDefinitionId("ty") - .withScope("ldrznlaxo") - .withUserAuthenticationType("th") - .withUserEmailAddress("xfugfzizyxd"), - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("mdfjwcngkwxjsj", response.tags().get("uvohufzdtsrp")); - Assertions.assertEquals("wbywaazba", response.properties().principalPuid()); - Assertions.assertEquals("ekfz", response.properties().principalId()); - Assertions.assertEquals("n", response.properties().principalTenantId()); - Assertions.assertEquals("bfb", response.properties().roleDefinitionId()); - Assertions.assertEquals("ow", response.properties().scope()); - Assertions.assertEquals("ljdkxhmewyaolc", response.properties().userAuthenticationType()); - Assertions.assertEquals("x", response.properties().userEmailAddress()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateByBillingProfileMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateByBillingProfileMockTests.java deleted file mode 100644 index ad5e40f110fc..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateByBillingProfileMockTests.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleAssignment; -import com.azure.resourcemanager.billing.models.BillingRoleAssignmentProperties; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsCreateByBillingProfileMockTests { - @Test - public void testCreateByBillingProfile() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"createdOn\":\"2021-10-21T13:21:18Z\",\"createdByPrincipalTenantId\":\"nr\",\"createdByPrincipalId\":\"nxoirxy\",\"createdByPrincipalPuid\":\"miploisj\",\"createdByUserEmailAddress\":\"so\",\"modifiedOn\":\"2021-03-31T19:36:53Z\",\"modifiedByPrincipalPuid\":\"twg\",\"modifiedByUserEmailAddress\":\"yohpsapzupzwwytb\",\"modifiedByPrincipalId\":\"zghximkgfmx\",\"modifiedByPrincipalTenantId\":\"kjnpyriwntot\",\"principalPuid\":\"mmqmtsjkyj\",\"principalId\":\"xwdonbexftedau\",\"principalTenantId\":\"eeggzgrn\",\"roleDefinitionId\":\"tlfozuumrtgjqgac\",\"scope\":\"tnsyxzxjm\",\"userAuthenticationType\":\"nb\",\"userEmailAddress\":\"azofm\",\"principalTenantName\":\"vtemaspmanydscdk\",\"principalDisplayName\":\"dpwjcbhaahntof\",\"principalType\":\"DirectoryRole\",\"billingRequestId\":\"pfixoskkzd\",\"billingAccountId\":\"vsujybsrwz\",\"billingAccountDisplayName\":\"rgt\",\"billingProfileId\":\"hmfppinmgi\",\"billingProfileDisplayName\":\"smkw\",\"invoiceSectionId\":\"gfragjhxerxlobkd\",\"invoiceSectionDisplayName\":\"qhvmmniiqy\",\"customerId\":\"lhjnskbggicnqwl\",\"customerDisplayName\":\"m\"},\"tags\":{\"gvxrktjcjigc\":\"lxkrk\"},\"id\":\"sp\",\"name\":\"nbqx\",\"type\":\"sevchefpg\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRoleAssignment response = manager.billingRoleAssignments() - .createByBillingProfile("p", "dluday", - new BillingRoleAssignmentProperties().withPrincipalPuid("jolpyoklkvuz") - .withPrincipalId("dvhml") - .withPrincipalTenantId("oi") - .withRoleDefinitionId("owxxbh") - .withScope("syio") - .withUserAuthenticationType("mqwtqszzgy") - .withUserEmailAddress("ika"), - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("lxkrk", response.tags().get("gvxrktjcjigc")); - Assertions.assertEquals("mmqmtsjkyj", response.properties().principalPuid()); - Assertions.assertEquals("xwdonbexftedau", response.properties().principalId()); - Assertions.assertEquals("eeggzgrn", response.properties().principalTenantId()); - Assertions.assertEquals("tlfozuumrtgjqgac", response.properties().roleDefinitionId()); - Assertions.assertEquals("tnsyxzxjm", response.properties().scope()); - Assertions.assertEquals("nb", response.properties().userAuthenticationType()); - Assertions.assertEquals("azofm", response.properties().userEmailAddress()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateByCustomerMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateByCustomerMockTests.java deleted file mode 100644 index 331f3234e80f..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateByCustomerMockTests.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleAssignment; -import com.azure.resourcemanager.billing.models.BillingRoleAssignmentProperties; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsCreateByCustomerMockTests { - @Test - public void testCreateByCustomer() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"createdOn\":\"2021-10-28T12:30:51Z\",\"createdByPrincipalTenantId\":\"tveqmg\",\"createdByPrincipalId\":\"swzeyxry\",\"createdByPrincipalPuid\":\"r\",\"createdByUserEmailAddress\":\"p\",\"modifiedOn\":\"2021-01-09T06:28:57Z\",\"modifiedByPrincipalPuid\":\"lvs\",\"modifiedByUserEmailAddress\":\"asgtl\",\"modifiedByPrincipalId\":\"qpoilos\",\"modifiedByPrincipalTenantId\":\"emcezevftm\",\"principalPuid\":\"l\",\"principalId\":\"kjyghztms\",\"principalTenantId\":\"wtpcflcezswwvw\",\"roleDefinitionId\":\"f\",\"scope\":\"jtvbfp\",\"userAuthenticationType\":\"ruptsyqcjnq\",\"userEmailAddress\":\"xd\",\"principalTenantName\":\"umxquk\",\"principalDisplayName\":\"diohclqddn\",\"principalType\":\"Unknown\",\"billingRequestId\":\"e\",\"billingAccountId\":\"eddp\",\"billingAccountDisplayName\":\"zcwyjsmk\",\"billingProfileId\":\"ld\",\"billingProfileDisplayName\":\"bnwvpaq\",\"invoiceSectionId\":\"xf\",\"invoiceSectionDisplayName\":\"igcfddofxnf\",\"customerId\":\"jyyrqaedw\",\"customerDisplayName\":\"ocytjgoeayokrw\"},\"tags\":{\"czvothmkh\":\"hwpadhedbfob\",\"scmyhrhjvszf\":\"aozvbwfcnjhbpoel\",\"ojoevzzufytdx\":\"bokndwpppq\",\"krbuoggtdltlcuha\":\"lynzlyvap\"},\"id\":\"ijvaylze\",\"name\":\"hlpsftqkrvmhv\",\"type\":\"vvcpwtqsuspn\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRoleAssignment response = manager.billingRoleAssignments() - .createByCustomer("dxfhhht", "st", "qtdn", - new BillingRoleAssignmentProperties().withPrincipalPuid("uevqmvyumgmm") - .withPrincipalId("bsnznwgsqufm") - .withPrincipalTenantId("cyoseqcazisvbrqg") - .withRoleDefinitionId("yj") - .withScope("awepkwonrzpgh") - .withUserAuthenticationType("dtbgblxbuib") - .withUserEmailAddress("jztaf"), - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("hwpadhedbfob", response.tags().get("czvothmkh")); - Assertions.assertEquals("l", response.properties().principalPuid()); - Assertions.assertEquals("kjyghztms", response.properties().principalId()); - Assertions.assertEquals("wtpcflcezswwvw", response.properties().principalTenantId()); - Assertions.assertEquals("f", response.properties().roleDefinitionId()); - Assertions.assertEquals("jtvbfp", response.properties().scope()); - Assertions.assertEquals("ruptsyqcjnq", response.properties().userAuthenticationType()); - Assertions.assertEquals("xd", response.properties().userEmailAddress()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateByInvoiceSectionMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateByInvoiceSectionMockTests.java deleted file mode 100644 index 4caf924d5fc0..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateByInvoiceSectionMockTests.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleAssignment; -import com.azure.resourcemanager.billing.models.BillingRoleAssignmentProperties; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsCreateByInvoiceSectionMockTests { - @Test - public void testCreateByInvoiceSection() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"createdOn\":\"2020-12-21T05:21:05Z\",\"createdByPrincipalTenantId\":\"lmcvrjaznotdofq\",\"createdByPrincipalId\":\"bq\",\"createdByPrincipalPuid\":\"qkpsbqsb\",\"createdByUserEmailAddress\":\"itaftazgcxsvqlc\",\"modifiedOn\":\"2021-10-31T19:05:22Z\",\"modifiedByPrincipalPuid\":\"lamxowbgc\",\"modifiedByUserEmailAddress\":\"yutehlkarvtipquk\",\"modifiedByPrincipalId\":\"iknsgo\",\"modifiedByPrincipalTenantId\":\"nswhpcek\",\"principalPuid\":\"vmfnnbbxn\",\"principalId\":\"fkk\",\"principalTenantId\":\"eetxtpwcv\",\"roleDefinitionId\":\"i\",\"scope\":\"sunjzijaciwmm\",\"userAuthenticationType\":\"tqdonbzzs\",\"userEmailAddress\":\"zyviiwsu\",\"principalTenantName\":\"zhw\",\"principalDisplayName\":\"uifkzqqhb\",\"principalType\":\"Group\",\"billingRequestId\":\"ilm\",\"billingAccountId\":\"beoiip\",\"billingAccountDisplayName\":\"ngvyvuoik\",\"billingProfileId\":\"psxntugfwi\",\"billingProfileDisplayName\":\"nry\",\"invoiceSectionId\":\"ocfmvswxvjeleif\",\"invoiceSectionDisplayName\":\"d\",\"customerId\":\"wwulkrybpaevy\",\"customerDisplayName\":\"yjecrqkwakkch\"},\"tags\":{\"dyblpe\":\"ulborcxuibsdq\",\"m\":\"t\",\"lerufollcshju\":\"pgweoqhbjqlqf\",\"xvjeazrah\":\"ihbymjjvtpne\"},\"id\":\"hbimyiie\",\"name\":\"a\",\"type\":\"cthtpq\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRoleAssignment response = manager.billingRoleAssignments() - .createByInvoiceSection("pkyvnhiysdho", "kslhr", "qki", - new BillingRoleAssignmentProperties().withPrincipalPuid("oawh") - .withPrincipalId("smbcsloygsab") - .withPrincipalTenantId("d") - .withRoleDefinitionId("e") - .withScope("nsdunrkzvzua") - .withUserAuthenticationType("hgzuyxtrvf") - .withUserEmailAddress("qs"), - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("ulborcxuibsdq", response.tags().get("dyblpe")); - Assertions.assertEquals("vmfnnbbxn", response.properties().principalPuid()); - Assertions.assertEquals("fkk", response.properties().principalId()); - Assertions.assertEquals("eetxtpwcv", response.properties().principalTenantId()); - Assertions.assertEquals("i", response.properties().roleDefinitionId()); - Assertions.assertEquals("sunjzijaciwmm", response.properties().scope()); - Assertions.assertEquals("tqdonbzzs", response.properties().userAuthenticationType()); - Assertions.assertEquals("zyviiwsu", response.properties().userEmailAddress()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateOrUpdateByBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateOrUpdateByBillingAccountMockTests.java deleted file mode 100644 index 914f302f6789..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateOrUpdateByBillingAccountMockTests.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.fluent.models.BillingRoleAssignmentInner; -import com.azure.resourcemanager.billing.models.BillingRoleAssignment; -import com.azure.resourcemanager.billing.models.BillingRoleAssignmentProperties; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsCreateOrUpdateByBillingAccountMockTests { - @Test - public void testCreateOrUpdateByBillingAccount() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"createdOn\":\"2021-03-15T12:37:31Z\",\"createdByPrincipalTenantId\":\"ehmdqvaolidxd\",\"createdByPrincipalId\":\"fvkjcimbrsvxph\",\"createdByPrincipalPuid\":\"nhptjlrkdcy\",\"createdByUserEmailAddress\":\"i\",\"modifiedOn\":\"2021-02-04T05:42:16Z\",\"modifiedByPrincipalPuid\":\"tdtftmizuzjd\",\"modifiedByUserEmailAddress\":\"gyzcslazprkq\",\"modifiedByPrincipalId\":\"imxpggktteagb\",\"modifiedByPrincipalTenantId\":\"cnqpjuytvudeylp\",\"principalPuid\":\"bkisb\",\"principalId\":\"fmxgl\",\"principalTenantId\":\"dj\",\"roleDefinitionId\":\"au\",\"scope\":\"shzn\",\"userAuthenticationType\":\"ttuhaaax\",\"userEmailAddress\":\"c\",\"principalTenantName\":\"mdkqtxfrm\",\"principalDisplayName\":\"cxstowageh\",\"principalType\":\"Unknown\",\"billingRequestId\":\"wesrtjaqgb\",\"billingAccountId\":\"kncypmte\",\"billingAccountDisplayName\":\"psaneyvaerpi\",\"billingProfileId\":\"nhrfbrj\",\"billingProfileDisplayName\":\"jwqdmr\",\"invoiceSectionId\":\"nilppqcai\",\"invoiceSectionDisplayName\":\"zwfwlrfdjwlzseod\",\"customerId\":\"fdrslzymqx\",\"customerDisplayName\":\"rwycu\"},\"tags\":{\"zebjrahg\":\"jwgetfigwneqjxz\",\"gxzss\":\"stubw\",\"hfmdoiiyobq\":\"xliqmsck\"},\"id\":\"ja\",\"name\":\"wrsofxcacrm\",\"type\":\"jf\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRoleAssignment response = manager.billingRoleAssignments() - .createOrUpdateByBillingAccount("orxsqtzngxbsale", "guxcmmhip", new BillingRoleAssignmentInner() - .withTags( - mapOf("sbtwskkfkuyikmx", "ffhvqii", "bqtrefeclflxc", "hqsxjbjkewrig", "cvdefxonztpcjpt", "ffzw")) - .withProperties(new BillingRoleAssignmentProperties().withPrincipalPuid("dmohheuyu") - .withPrincipalId("xmyevyigdeipnfi") - .withPrincipalTenantId("jwlii") - .withRoleDefinitionId("cndjzwhajo") - .withScope("pqokhdyncra") - .withUserAuthenticationType("sewbempfapmqnm") - .withUserEmailAddress("yksygih")), - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("jwgetfigwneqjxz", response.tags().get("zebjrahg")); - Assertions.assertEquals("bkisb", response.properties().principalPuid()); - Assertions.assertEquals("fmxgl", response.properties().principalId()); - Assertions.assertEquals("dj", response.properties().principalTenantId()); - Assertions.assertEquals("au", response.properties().roleDefinitionId()); - Assertions.assertEquals("shzn", response.properties().scope()); - Assertions.assertEquals("ttuhaaax", response.properties().userAuthenticationType()); - Assertions.assertEquals("c", response.properties().userEmailAddress()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateOrUpdateByDepartmentMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateOrUpdateByDepartmentMockTests.java deleted file mode 100644 index 6347a33e4b80..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateOrUpdateByDepartmentMockTests.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.fluent.models.BillingRoleAssignmentInner; -import com.azure.resourcemanager.billing.models.BillingRoleAssignment; -import com.azure.resourcemanager.billing.models.BillingRoleAssignmentProperties; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsCreateOrUpdateByDepartmentMockTests { - @Test - public void testCreateOrUpdateByDepartment() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"createdOn\":\"2021-04-25T21:42:28Z\",\"createdByPrincipalTenantId\":\"vf\",\"createdByPrincipalId\":\"hbjhmvpjxsd\",\"createdByPrincipalPuid\":\"eignybffqc\",\"createdByUserEmailAddress\":\"ynepkt\",\"modifiedOn\":\"2020-12-29T15:00:50Z\",\"modifiedByPrincipalPuid\":\"vconysebjijfhp\",\"modifiedByUserEmailAddress\":\"ikou\",\"modifiedByPrincipalId\":\"falo\",\"modifiedByPrincipalTenantId\":\"skk\",\"principalPuid\":\"orsyni\",\"principalId\":\"nbydlgfaph\",\"principalTenantId\":\"ubwt\",\"roleDefinitionId\":\"ay\",\"scope\":\"tvjfqreeoxvqj\",\"userAuthenticationType\":\"nblihs\",\"userEmailAddress\":\"fbmdivixzhpjgq\",\"principalTenantName\":\"iaoaweacfxa\",\"principalDisplayName\":\"uhruetcnxri\",\"principalType\":\"DirectoryRole\",\"billingRequestId\":\"ckh\",\"billingAccountId\":\"drrjsu\",\"billingAccountDisplayName\":\"owo\",\"billingProfileId\":\"xrxmyokohlsfjfo\",\"billingProfileDisplayName\":\"jpz\",\"invoiceSectionId\":\"ahuvkqxqkvadmjh\",\"invoiceSectionDisplayName\":\"udjmaaj\",\"customerId\":\"ebhsermclyqw\",\"customerDisplayName\":\"hyqkaaptbssvkbcb\"},\"tags\":{\"plxzbnsshvqnpszb\":\"ybloccu\",\"peyxdyuxurxr\":\"uybutcdzjfjt\"},\"id\":\"qmmijgpq\",\"name\":\"k\",\"type\":\"naeikczscymqf\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRoleAssignment response = manager.billingRoleAssignments() - .createOrUpdateByDepartment("yfp", "ms", "auemqomxoa", - new BillingRoleAssignmentInner().withTags(mapOf("fibpkwmamrlfi", "imvrr", "d", "judd")) - .withProperties(new BillingRoleAssignmentProperties().withPrincipalPuid("vbpbl") - .withPrincipalId("wsexheeocnqou") - .withPrincipalTenantId("epvlryszfhd") - .withRoleDefinitionId("yfhxohzbzhhav") - .withScope("uxnvkdslcof") - .withUserAuthenticationType("tfuehouisak") - .withUserEmailAddress("jfddxqfussub")), - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("ybloccu", response.tags().get("plxzbnsshvqnpszb")); - Assertions.assertEquals("orsyni", response.properties().principalPuid()); - Assertions.assertEquals("nbydlgfaph", response.properties().principalId()); - Assertions.assertEquals("ubwt", response.properties().principalTenantId()); - Assertions.assertEquals("ay", response.properties().roleDefinitionId()); - Assertions.assertEquals("tvjfqreeoxvqj", response.properties().scope()); - Assertions.assertEquals("nblihs", response.properties().userAuthenticationType()); - Assertions.assertEquals("fbmdivixzhpjgq", response.properties().userEmailAddress()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateOrUpdateByEnrollmentAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateOrUpdateByEnrollmentAccountMockTests.java deleted file mode 100644 index 2d00ac656a65..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsCreateOrUpdateByEnrollmentAccountMockTests.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.fluent.models.BillingRoleAssignmentInner; -import com.azure.resourcemanager.billing.models.BillingRoleAssignment; -import com.azure.resourcemanager.billing.models.BillingRoleAssignmentProperties; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsCreateOrUpdateByEnrollmentAccountMockTests { - @Test - public void testCreateOrUpdateByEnrollmentAccount() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"createdOn\":\"2021-07-29T13:22:49Z\",\"createdByPrincipalTenantId\":\"i\",\"createdByPrincipalId\":\"jsb\",\"createdByPrincipalPuid\":\"mseesacuicnvqiqs\",\"createdByUserEmailAddress\":\"vmrfaptndrmmn\",\"modifiedOn\":\"2021-07-05T09:48:43Z\",\"modifiedByPrincipalPuid\":\"mxrqkekcdaviieb\",\"modifiedByUserEmailAddress\":\"rfzav\",\"modifiedByPrincipalId\":\"mc\",\"modifiedByPrincipalTenantId\":\"siuc\",\"principalPuid\":\"lbrzgk\",\"principalId\":\"rwpqbstweobptsc\",\"principalTenantId\":\"ykk\",\"roleDefinitionId\":\"elayynoyjyfls\",\"scope\":\"bnlyoifgdfzj\",\"userAuthenticationType\":\"hykcvoevcwf\",\"userEmailAddress\":\"tkxxlwwo\",\"principalTenantName\":\"gbsdz\",\"principalDisplayName\":\"cvypjhubd\",\"principalType\":\"Unknown\",\"billingRequestId\":\"xehujcqgzwv\",\"billingAccountId\":\"iuaoibmjklqrljd\",\"billingAccountDisplayName\":\"kylaxrjiqoqovqhg\",\"billingProfileId\":\"gxuwudgcyqru\",\"billingProfileDisplayName\":\"mryddnqivahfcq\",\"invoiceSectionId\":\"jzebp\",\"invoiceSectionDisplayName\":\"ciyoypoedk\",\"customerId\":\"w\",\"customerDisplayName\":\"bpybqeigxuyxsxte\"},\"tags\":{\"hcgnaqsrmrfqder\":\"hznfff\",\"wyqznbbyzp\":\"rgsdcobpmgq\",\"oiq\":\"szfutgpbygbnbc\",\"lwzhxzuxerx\":\"tzpvqew\"},\"id\":\"wl\",\"name\":\"kqsqvvdkfp\",\"type\":\"jdajdqxymxxyfrd\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRoleAssignment response = manager.billingRoleAssignments() - .createOrUpdateByEnrollmentAccount("abebckc", "srsixwn", "pjcxbjgfm", - new BillingRoleAssignmentInner().withTags(mapOf("veugpx", "f", "pup", "ee")) - .withProperties(new BillingRoleAssignmentProperties().withPrincipalPuid("iapypimr") - .withPrincipalId("rqw") - .withPrincipalTenantId("zesstuiny") - .withRoleDefinitionId("kmlf") - .withScope("jzcxxvzjoy") - .withUserAuthenticationType("gahxuerrdaktnyt") - .withUserEmailAddress("cerfcvcpvf")), - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("hznfff", response.tags().get("hcgnaqsrmrfqder")); - Assertions.assertEquals("lbrzgk", response.properties().principalPuid()); - Assertions.assertEquals("rwpqbstweobptsc", response.properties().principalId()); - Assertions.assertEquals("ykk", response.properties().principalTenantId()); - Assertions.assertEquals("elayynoyjyfls", response.properties().roleDefinitionId()); - Assertions.assertEquals("bnlyoifgdfzj", response.properties().scope()); - Assertions.assertEquals("hykcvoevcwf", response.properties().userAuthenticationType()); - Assertions.assertEquals("tkxxlwwo", response.properties().userEmailAddress()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByBillingAccountWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByBillingAccountWithResponseMockTests.java deleted file mode 100644 index 3015f634d9d1..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByBillingAccountWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsDeleteByBillingAccountWithResponseMockTests { - @Test - public void testDeleteByBillingAccountWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.billingRoleAssignments() - .deleteByBillingAccountWithResponse("qkycj", "geipqxxs", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByBillingProfileWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByBillingProfileWithResponseMockTests.java deleted file mode 100644 index 472ed1abd289..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByBillingProfileWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsDeleteByBillingProfileWithResponseMockTests { - @Test - public void testDeleteByBillingProfileWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.billingRoleAssignments() - .deleteByBillingProfileWithResponse("se", "kdb", "otfbjampqoclann", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByCustomerWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByCustomerWithResponseMockTests.java deleted file mode 100644 index bb43dd0a1d2e..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByCustomerWithResponseMockTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsDeleteByCustomerWithResponseMockTests { - @Test - public void testDeleteByCustomerWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.billingRoleAssignments() - .deleteByCustomerWithResponse("edyybruholaemwcg", "mmrimaabsq", "lonbzaowcahdkmb", "smihrijezbfsjwfc", - com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByDepartmentWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByDepartmentWithResponseMockTests.java deleted file mode 100644 index 67ffdcbf6e09..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByDepartmentWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsDeleteByDepartmentWithResponseMockTests { - @Test - public void testDeleteByDepartmentWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.billingRoleAssignments() - .deleteByDepartmentWithResponse("ti", "qbzbwbgwzh", "hfljeyodpiovn", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByEnrollmentAccountWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByEnrollmentAccountWithResponseMockTests.java deleted file mode 100644 index 3f5c853d3454..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByEnrollmentAccountWithResponseMockTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsDeleteByEnrollmentAccountWithResponseMockTests { - @Test - public void testDeleteByEnrollmentAccountWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.billingRoleAssignments() - .deleteByEnrollmentAccountWithResponse("qdjlgkuir", "xeuwiiircvnfg", "dviw", - com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByInvoiceSectionWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByInvoiceSectionWithResponseMockTests.java deleted file mode 100644 index 7105f8a7dbc9..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsDeleteByInvoiceSectionWithResponseMockTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsDeleteByInvoiceSectionWithResponseMockTests { - @Test - public void testDeleteByInvoiceSectionWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.billingRoleAssignments() - .deleteByInvoiceSectionWithResponse("xepbntqq", "w", "fgsqxile", "ejse", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByBillingAccountWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByBillingAccountWithResponseMockTests.java deleted file mode 100644 index 0bd695d373cb..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByBillingAccountWithResponseMockTests.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleAssignment; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsGetByBillingAccountWithResponseMockTests { - @Test - public void testGetByBillingAccountWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Provisioning\",\"createdOn\":\"2021-12-01T07:00:27Z\",\"createdByPrincipalTenantId\":\"qzhpvhxpbad\",\"createdByPrincipalId\":\"eullgfyog\",\"createdByPrincipalPuid\":\"scjpvqe\",\"createdByUserEmailAddress\":\"xkomwdzpzlhcue\",\"modifiedOn\":\"2021-06-20T13:08:31Z\",\"modifiedByPrincipalPuid\":\"wwvmbjec\",\"modifiedByUserEmailAddress\":\"lbghnkfrwxohly\",\"modifiedByPrincipalId\":\"njzpchiypbfhmi\",\"modifiedByPrincipalTenantId\":\"ktqoze\",\"principalPuid\":\"rsrj\",\"principalId\":\"kbrauxboufq\",\"principalTenantId\":\"qbjxgjwsrerukbuu\",\"roleDefinitionId\":\"ri\",\"scope\":\"kwkjxlaace\",\"userAuthenticationType\":\"kq\",\"userEmailAddress\":\"ssybzbe\",\"principalTenantName\":\"bnrommkiqhypwtm\",\"principalDisplayName\":\"jjy\",\"principalType\":\"None\",\"billingRequestId\":\"zql\",\"billingAccountId\":\"agwiijc\",\"billingAccountDisplayName\":\"iywhxpsb\",\"billingProfileId\":\"ialezaydpu\",\"billingProfileDisplayName\":\"degefxlieggoto\",\"invoiceSectionId\":\"hssfnwh\",\"invoiceSectionDisplayName\":\"ah\",\"customerId\":\"ckn\",\"customerDisplayName\":\"kcu\"},\"tags\":{\"dvhzfkdn\":\"dgwuzron\",\"k\":\"ysodcikgx\",\"w\":\"zfzdjekeb\"},\"id\":\"zsjwyfixirgcj\",\"name\":\"aiwu\",\"type\":\"pjkakrxifqnf\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRoleAssignment response = manager.billingRoleAssignments() - .getByBillingAccountWithResponse("yafwtyd", "mma", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("dgwuzron", response.tags().get("dvhzfkdn")); - Assertions.assertEquals("rsrj", response.properties().principalPuid()); - Assertions.assertEquals("kbrauxboufq", response.properties().principalId()); - Assertions.assertEquals("qbjxgjwsrerukbuu", response.properties().principalTenantId()); - Assertions.assertEquals("ri", response.properties().roleDefinitionId()); - Assertions.assertEquals("kwkjxlaace", response.properties().scope()); - Assertions.assertEquals("kq", response.properties().userAuthenticationType()); - Assertions.assertEquals("ssybzbe", response.properties().userEmailAddress()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByBillingProfileWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByBillingProfileWithResponseMockTests.java deleted file mode 100644 index 9fb456b8ab18..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByBillingProfileWithResponseMockTests.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleAssignment; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsGetByBillingProfileWithResponseMockTests { - @Test - public void testGetByBillingProfileWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Provisioning\",\"createdOn\":\"2021-05-04T09:19:28Z\",\"createdByPrincipalTenantId\":\"ulwkq\",\"createdByPrincipalId\":\"ruook\",\"createdByPrincipalPuid\":\"flsgaoj\",\"createdByUserEmailAddress\":\"qpqsdoctpzpuj\",\"modifiedOn\":\"2021-07-20T23:33:47Z\",\"modifiedByPrincipalPuid\":\"cdsgxceluji\",\"modifiedByUserEmailAddress\":\"lluunxh\",\"modifiedByPrincipalId\":\"lfxzfwuge\",\"modifiedByPrincipalTenantId\":\"cknecexkgr\",\"principalPuid\":\"psjdmng\",\"principalId\":\"tqpdzfyxcnwawoxc\",\"principalTenantId\":\"bejqfbifopfjx\",\"roleDefinitionId\":\"wdrpa\",\"scope\":\"jkrfmbwotfcuuugt\",\"userAuthenticationType\":\"gp\",\"userEmailAddress\":\"yiawohfmhnnz\",\"principalTenantName\":\"cjjkmqenh\",\"principalDisplayName\":\"dzrpvsgl\",\"principalType\":\"Unknown\",\"billingRequestId\":\"slvivqsu\",\"billingAccountId\":\"ten\",\"billingAccountDisplayName\":\"pijpkhc\",\"billingProfileId\":\"aqxukuicjufte\",\"billingProfileDisplayName\":\"oo\",\"invoiceSectionId\":\"duewfhvpxjhxzu\",\"invoiceSectionDisplayName\":\"jzabbwz\",\"customerId\":\"zuaixcdckixspsa\",\"customerDisplayName\":\"avkmvyxzerejrkpz\"},\"tags\":{\"yoptaei\":\"etjx\",\"rrabovrwwxywp\":\"whlbecgihzbpem\"},\"id\":\"spboxhifp\",\"name\":\"skpeswyhhmifjua\",\"type\":\"xwwvcmmpeg\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRoleAssignment response = manager.billingRoleAssignments() - .getByBillingProfileWithResponse("xynlsuqb", "zstrktgvpatrg", "jktfinf", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("etjx", response.tags().get("yoptaei")); - Assertions.assertEquals("psjdmng", response.properties().principalPuid()); - Assertions.assertEquals("tqpdzfyxcnwawoxc", response.properties().principalId()); - Assertions.assertEquals("bejqfbifopfjx", response.properties().principalTenantId()); - Assertions.assertEquals("wdrpa", response.properties().roleDefinitionId()); - Assertions.assertEquals("jkrfmbwotfcuuugt", response.properties().scope()); - Assertions.assertEquals("gp", response.properties().userAuthenticationType()); - Assertions.assertEquals("yiawohfmhnnz", response.properties().userEmailAddress()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByCustomerWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByCustomerWithResponseMockTests.java deleted file mode 100644 index 55a25bee139d..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByCustomerWithResponseMockTests.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleAssignment; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsGetByCustomerWithResponseMockTests { - @Test - public void testGetByCustomerWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"ConfirmedBilling\",\"createdOn\":\"2021-07-12T03:04:11Z\",\"createdByPrincipalTenantId\":\"xclfrs\",\"createdByPrincipalId\":\"rnmuvwvpuofddtbf\",\"createdByPrincipalPuid\":\"kjcnginxdvmaoyq\",\"createdByUserEmailAddress\":\"vg\",\"modifiedOn\":\"2021-10-18T12:05:05Z\",\"modifiedByPrincipalPuid\":\"xynofxlttxoqxtd\",\"modifiedByUserEmailAddress\":\"ujsjirkrpskcj\",\"modifiedByPrincipalId\":\"mofbnivd\",\"modifiedByPrincipalTenantId\":\"kykpaxnls\",\"principalPuid\":\"nyscaccpt\",\"principalId\":\"et\",\"principalTenantId\":\"gxxiceecv\",\"roleDefinitionId\":\"wyuveoxmp\",\"scope\":\"wahdrdvhaztkxbi\",\"userAuthenticationType\":\"fgxmbr\",\"userEmailAddress\":\"mw\",\"principalTenantName\":\"iosiqsy\",\"principalDisplayName\":\"f\",\"principalType\":\"Group\",\"billingRequestId\":\"rtxtfdag\",\"billingAccountId\":\"rcokzzertkounz\",\"billingAccountDisplayName\":\"ywhubymfpopik\",\"billingProfileId\":\"b\",\"billingProfileDisplayName\":\"nfywtkq\",\"invoiceSectionId\":\"sdlkhcz\",\"invoiceSectionDisplayName\":\"pmgfjculojhhylx\",\"customerId\":\"vfiyymot\",\"customerDisplayName\":\"bybwjmtftcvelnir\"},\"tags\":{\"vswmehfxrtt\":\"qnstpaqpibjg\",\"ectcxsfmbzdx\":\"bmsennqfabqcama\",\"yufxuzmsvzyq\":\"synbkdn\",\"xaravwwuasnjeglh\":\"brnxhjtlxfikj\"},\"id\":\"xbozpcjcnwjz\",\"name\":\"qblxrnwvds\",\"type\":\"oq\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRoleAssignment response = manager.billingRoleAssignments() - .getByCustomerWithResponse("glkvbgukbsv", "wyo", "ygnbknhjgclxaxwc", "faspsdzkucszghd", - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("qnstpaqpibjg", response.tags().get("vswmehfxrtt")); - Assertions.assertEquals("nyscaccpt", response.properties().principalPuid()); - Assertions.assertEquals("et", response.properties().principalId()); - Assertions.assertEquals("gxxiceecv", response.properties().principalTenantId()); - Assertions.assertEquals("wyuveoxmp", response.properties().roleDefinitionId()); - Assertions.assertEquals("wahdrdvhaztkxbi", response.properties().scope()); - Assertions.assertEquals("fgxmbr", response.properties().userAuthenticationType()); - Assertions.assertEquals("mw", response.properties().userEmailAddress()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByDepartmentWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByDepartmentWithResponseMockTests.java deleted file mode 100644 index 85c387a8f8b8..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByDepartmentWithResponseMockTests.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleAssignment; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsGetByDepartmentWithResponseMockTests { - @Test - public void testGetByDepartmentWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Expired\",\"createdOn\":\"2021-07-04T05:29:57Z\",\"createdByPrincipalTenantId\":\"mznupbmtbsetkods\",\"createdByPrincipalId\":\"hedaakghcrzmm\",\"createdByPrincipalPuid\":\"yvdhdgdiwmlg\",\"createdByUserEmailAddress\":\"mfetqjisjmo\",\"modifiedOn\":\"2021-02-12T08:40:13Z\",\"modifiedByPrincipalPuid\":\"q\",\"modifiedByUserEmailAddress\":\"akhgkr\",\"modifiedByPrincipalId\":\"yycvytvje\",\"modifiedByPrincipalTenantId\":\"awfus\",\"principalPuid\":\"fzxk\",\"principalId\":\"bdy\",\"principalTenantId\":\"bimhjbozvo\",\"roleDefinitionId\":\"rtcl\",\"scope\":\"bjcyuzly\",\"userAuthenticationType\":\"scibv\",\"userEmailAddress\":\"kvck\",\"principalTenantName\":\"fnwqhawvc\",\"principalDisplayName\":\"iulby\",\"principalType\":\"ServicePrincipal\",\"billingRequestId\":\"zrycw\",\"billingAccountId\":\"gumwhmxpu\",\"billingAccountDisplayName\":\"nsastl\",\"billingProfileId\":\"mgomicttrvlv\",\"billingProfileDisplayName\":\"mxokxxamqecjrzvl\",\"invoiceSectionId\":\"vqxdemklphx\",\"invoiceSectionDisplayName\":\"wlojkbgnfbrzj\",\"customerId\":\"sunhaevlah\",\"customerDisplayName\":\"zywywuah\"},\"tags\":{\"rfgimomggewdqbxe\":\"rewcnnaaxqjfda\",\"sfx\":\"fyznvussuqksl\",\"wpmohnrtlikffyd\":\"yzqbye\",\"fwvzdteqjm\":\"tkqrfbgyn\"},\"id\":\"xuhgkaxnypri\",\"name\":\"yo\",\"type\":\"xjxbsowrrlcck\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRoleAssignment response = manager.billingRoleAssignments() - .getByDepartmentWithResponse("hr", "yakzuafapwxsvd", "atjiobnirgoextqd", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("rewcnnaaxqjfda", response.tags().get("rfgimomggewdqbxe")); - Assertions.assertEquals("fzxk", response.properties().principalPuid()); - Assertions.assertEquals("bdy", response.properties().principalId()); - Assertions.assertEquals("bimhjbozvo", response.properties().principalTenantId()); - Assertions.assertEquals("rtcl", response.properties().roleDefinitionId()); - Assertions.assertEquals("bjcyuzly", response.properties().scope()); - Assertions.assertEquals("scibv", response.properties().userAuthenticationType()); - Assertions.assertEquals("kvck", response.properties().userEmailAddress()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByEnrollmentAccountWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByEnrollmentAccountWithResponseMockTests.java deleted file mode 100644 index 9c42f70efc90..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByEnrollmentAccountWithResponseMockTests.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleAssignment; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsGetByEnrollmentAccountWithResponseMockTests { - @Test - public void testGetByEnrollmentAccountWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"New\",\"createdOn\":\"2021-03-12T22:35:02Z\",\"createdByPrincipalTenantId\":\"q\",\"createdByPrincipalId\":\"pvevtarphklql\",\"createdByPrincipalPuid\":\"q\",\"createdByUserEmailAddress\":\"n\",\"modifiedOn\":\"2021-11-07T09:09:08Z\",\"modifiedByPrincipalPuid\":\"nofgijydgsebju\",\"modifiedByUserEmailAddress\":\"tevaebzm\",\"modifiedByPrincipalId\":\"whrjkejvaedogzo\",\"modifiedByPrincipalTenantId\":\"xbxxgjogcphivfhr\",\"principalPuid\":\"enfdvdoea\",\"principalId\":\"wusrjzhdt\",\"principalTenantId\":\"yfezfsmyljdzy\",\"roleDefinitionId\":\"r\",\"scope\":\"mwtqil\",\"userAuthenticationType\":\"nnkynkstd\",\"userEmailAddress\":\"whjfp\",\"principalTenantName\":\"xaqjyihjcwwvaos\",\"principalDisplayName\":\"favh\",\"principalType\":\"Everyone\",\"billingRequestId\":\"pwweifdyfaoex\",\"billingAccountId\":\"uwnrd\",\"billingAccountDisplayName\":\"zlaihsujtg\",\"billingProfileId\":\"bszam\",\"billingProfileDisplayName\":\"xejpd\",\"invoiceSectionId\":\"iqwzutiyelrn\",\"invoiceSectionDisplayName\":\"jt\",\"customerId\":\"qsznsyovqm\",\"customerDisplayName\":\"udptoqwrnfc\"},\"tags\":{\"gejjxum\":\"hlokmxwawfubk\",\"uktdrsjtmnkxjouw\":\"wynjmoozm\",\"cfhep\":\"zcfdtstiaxtyrnu\"},\"id\":\"qbcmlroiomme\",\"name\":\"soq\",\"type\":\"blcyeqdobobaq\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRoleAssignment response = manager.billingRoleAssignments() - .getByEnrollmentAccountWithResponse("ohktxagfujdbqjny", "xbvxgx", "q", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("hlokmxwawfubk", response.tags().get("gejjxum")); - Assertions.assertEquals("enfdvdoea", response.properties().principalPuid()); - Assertions.assertEquals("wusrjzhdt", response.properties().principalId()); - Assertions.assertEquals("yfezfsmyljdzy", response.properties().principalTenantId()); - Assertions.assertEquals("r", response.properties().roleDefinitionId()); - Assertions.assertEquals("mwtqil", response.properties().scope()); - Assertions.assertEquals("nnkynkstd", response.properties().userAuthenticationType()); - Assertions.assertEquals("whjfp", response.properties().userEmailAddress()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByInvoiceSectionWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByInvoiceSectionWithResponseMockTests.java deleted file mode 100644 index f30d66ea0732..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsGetByInvoiceSectionWithResponseMockTests.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleAssignment; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsGetByInvoiceSectionWithResponseMockTests { - @Test - public void testGetByInvoiceSectionWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"createdOn\":\"2021-06-30T10:36:26Z\",\"createdByPrincipalTenantId\":\"cdkucpxpyafrwrg\",\"createdByPrincipalId\":\"ogeuvmk\",\"createdByPrincipalPuid\":\"pnr\",\"createdByUserEmailAddress\":\"semlzofrsnq\",\"modifiedOn\":\"2021-06-28T21:12:23Z\",\"modifiedByPrincipalPuid\":\"et\",\"modifiedByUserEmailAddress\":\"utikelpmwgrpu\",\"modifiedByPrincipalId\":\"udhvos\",\"modifiedByPrincipalTenantId\":\"zscueza\",\"principalPuid\":\"vdfwgqjhewcffrx\",\"principalId\":\"ezkhzp\",\"principalTenantId\":\"qissen\",\"roleDefinitionId\":\"rrusyzaivnps\",\"scope\":\"pckplujyduonb\",\"userAuthenticationType\":\"wsaoplvvmn\",\"userEmailAddress\":\"xjarsbb\",\"principalTenantName\":\"dwokqx\",\"principalDisplayName\":\"lxqk\",\"principalType\":\"ServicePrincipal\",\"billingRequestId\":\"vzvcgrds\",\"billingAccountId\":\"esfkqqxuhv\",\"billingAccountDisplayName\":\"lbrouszxac\",\"billingProfileId\":\"uk\",\"billingProfileDisplayName\":\"goojjfuk\",\"invoiceSectionId\":\"bc\",\"invoiceSectionDisplayName\":\"nhgbtzvxxvsbc\",\"customerId\":\"fkrfnkcni\",\"customerDisplayName\":\"swxmfurqm\"},\"tags\":{\"qsvnkxm\":\"wpntumotah\"},\"id\":\"zuae\",\"name\":\"rlhxgcqmyrhkv\",\"type\":\"zzmiemqyft\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRoleAssignment response = manager.billingRoleAssignments() - .getByInvoiceSectionWithResponse("rznequqyntt", "knhajksbsyogjm", "jhgcydijnmcvjb", "sfcriqxzix", - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("wpntumotah", response.tags().get("qsvnkxm")); - Assertions.assertEquals("vdfwgqjhewcffrx", response.properties().principalPuid()); - Assertions.assertEquals("ezkhzp", response.properties().principalId()); - Assertions.assertEquals("qissen", response.properties().principalTenantId()); - Assertions.assertEquals("rrusyzaivnps", response.properties().roleDefinitionId()); - Assertions.assertEquals("pckplujyduonb", response.properties().scope()); - Assertions.assertEquals("wsaoplvvmn", response.properties().userAuthenticationType()); - Assertions.assertEquals("xjarsbb", response.properties().userEmailAddress()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByBillingAccountMockTests.java deleted file mode 100644 index 31ba008b8809..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByBillingAccountMockTests.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleAssignment; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsListByBillingAccountMockTests { - @Test - public void testListByBillingAccount() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"provisioningState\":\"Creating\",\"createdOn\":\"2021-04-05T18:53:39Z\",\"createdByPrincipalTenantId\":\"irjvqxvwkiocxo\",\"createdByPrincipalId\":\"jwbu\",\"createdByPrincipalPuid\":\"qflm\",\"createdByUserEmailAddress\":\"rlqxbctatez\",\"modifiedOn\":\"2021-12-08T02:06:08Z\",\"modifiedByPrincipalPuid\":\"bcqqnlsjxcs\",\"modifiedByUserEmailAddress\":\"it\",\"modifiedByPrincipalId\":\"mra\",\"modifiedByPrincipalTenantId\":\"jido\",\"principalPuid\":\"vltcvmahpuwku\",\"principalId\":\"bnhi\",\"principalTenantId\":\"hyzhrcqdfwbifn\",\"roleDefinitionId\":\"hlsforsimtf\",\"scope\":\"mmynbrpelpfi\",\"userAuthenticationType\":\"ezgxmpeszam\",\"userEmailAddress\":\"ler\",\"principalTenantName\":\"nfu\",\"principalDisplayName\":\"czktllxswt\",\"principalType\":\"Unknown\",\"billingRequestId\":\"mirmnrijefmrt\",\"billingAccountId\":\"c\",\"billingAccountDisplayName\":\"dspthg\",\"billingProfileId\":\"mwtbl\",\"billingProfileDisplayName\":\"kok\",\"invoiceSectionId\":\"i\",\"invoiceSectionDisplayName\":\"iefwlnm\",\"customerId\":\"ffcnuestbsliejdn\",\"customerDisplayName\":\"otelikji\"},\"tags\":{\"dwbymuqlngncrd\":\"hhxtzx\"},\"id\":\"ctysecpekhx\",\"name\":\"byh\",\"type\":\"tzcvimmwckoz\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingRoleAssignments() - .listByBillingAccount("r", "uydldp", 8679544889546246428L, 9007721601109399576L, - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("hhxtzx", response.iterator().next().tags().get("dwbymuqlngncrd")); - Assertions.assertEquals("vltcvmahpuwku", response.iterator().next().properties().principalPuid()); - Assertions.assertEquals("bnhi", response.iterator().next().properties().principalId()); - Assertions.assertEquals("hyzhrcqdfwbifn", response.iterator().next().properties().principalTenantId()); - Assertions.assertEquals("hlsforsimtf", response.iterator().next().properties().roleDefinitionId()); - Assertions.assertEquals("mmynbrpelpfi", response.iterator().next().properties().scope()); - Assertions.assertEquals("ezgxmpeszam", response.iterator().next().properties().userAuthenticationType()); - Assertions.assertEquals("ler", response.iterator().next().properties().userEmailAddress()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByBillingProfileMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByBillingProfileMockTests.java deleted file mode 100644 index 01e369b93b88..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByBillingProfileMockTests.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleAssignment; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsListByBillingProfileMockTests { - @Test - public void testListByBillingProfile() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"provisioningState\":\"Pending\",\"createdOn\":\"2021-03-06T10:08:22Z\",\"createdByPrincipalTenantId\":\"zmsimehtcu\",\"createdByPrincipalId\":\"dhtqqhyhnimxtns\",\"createdByPrincipalPuid\":\"isnomwnwnghoj\",\"createdByUserEmailAddress\":\"keyymicjixxfs\",\"modifiedOn\":\"2021-03-05T05:50:59Z\",\"modifiedByPrincipalPuid\":\"tnuguefxxij\",\"modifiedByUserEmailAddress\":\"bdveywetkrhl\",\"modifiedByPrincipalId\":\"mcnwep\",\"modifiedByPrincipalTenantId\":\"sv\",\"principalPuid\":\"vaqdljnpetl\",\"principalId\":\"rdetawevxehuekdx\",\"principalTenantId\":\"zvdov\",\"roleDefinitionId\":\"rblerlprdaqcc\",\"scope\":\"cbnygd\",\"userAuthenticationType\":\"cxwbp\",\"userEmailAddress\":\"ykdigqzlrznda\",\"principalTenantName\":\"nidmjqmvytg\",\"principalDisplayName\":\"qlarhqt\",\"principalType\":\"User\",\"billingRequestId\":\"zekdzdzffzj\",\"billingAccountId\":\"tsmpchgg\",\"billingAccountDisplayName\":\"elgfyatigfgfrr\",\"billingProfileId\":\"knczgorywnvojtvm\",\"billingProfileDisplayName\":\"vdlhqvbkar\",\"invoiceSectionId\":\"yhssrlvkpkpkocm\",\"invoiceSectionDisplayName\":\"cebxx\",\"customerId\":\"yicyvspeslhwy\",\"customerDisplayName\":\"gvrccpu\"},\"tags\":{\"dtpfcudva\":\"hgajkrdy\"},\"id\":\"b\",\"name\":\"bqvenqnxhgkor\",\"type\":\"wzejpecwzvcm\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingRoleAssignments() - .listByBillingProfile("y", "qvcml", "exbzbqufpnezsjza", 1012603329347113753L, 4335455446774849823L, - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("hgajkrdy", response.iterator().next().tags().get("dtpfcudva")); - Assertions.assertEquals("vaqdljnpetl", response.iterator().next().properties().principalPuid()); - Assertions.assertEquals("rdetawevxehuekdx", response.iterator().next().properties().principalId()); - Assertions.assertEquals("zvdov", response.iterator().next().properties().principalTenantId()); - Assertions.assertEquals("rblerlprdaqcc", response.iterator().next().properties().roleDefinitionId()); - Assertions.assertEquals("cbnygd", response.iterator().next().properties().scope()); - Assertions.assertEquals("cxwbp", response.iterator().next().properties().userAuthenticationType()); - Assertions.assertEquals("ykdigqzlrznda", response.iterator().next().properties().userEmailAddress()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByCustomerMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByCustomerMockTests.java deleted file mode 100644 index 7d8ccf434912..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByCustomerMockTests.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleAssignment; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsListByCustomerMockTests { - @Test - public void testListByCustomer() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\",\"createdOn\":\"2021-03-17T00:06:29Z\",\"createdByPrincipalTenantId\":\"to\",\"createdByPrincipalId\":\"nzdaiovr\",\"createdByPrincipalPuid\":\"rpqphkvyyzad\",\"createdByUserEmailAddress\":\"xylaypdtyzvelffo\",\"modifiedOn\":\"2021-01-25T02:53:32Z\",\"modifiedByPrincipalPuid\":\"wh\",\"modifiedByUserEmailAddress\":\"f\",\"modifiedByPrincipalId\":\"psshr\",\"modifiedByPrincipalTenantId\":\"kcclpctuo\",\"principalPuid\":\"scxjfsgmosp\",\"principalId\":\"bnxsqc\",\"principalTenantId\":\"scuyfqlamfbqhsuj\",\"roleDefinitionId\":\"afuzpnxqpwnik\",\"scope\":\"cajgrbr\",\"userAuthenticationType\":\"svgoocq\",\"userEmailAddress\":\"zmz\",\"principalTenantName\":\"cxitmhxxrqi\",\"principalDisplayName\":\"zfvwjdthkvpyeyoa\",\"principalType\":\"ServicePrincipal\",\"billingRequestId\":\"p\",\"billingAccountId\":\"updkjrzfwkyl\",\"billingAccountDisplayName\":\"bdx\",\"billingProfileId\":\"qdcclcv\",\"billingProfileDisplayName\":\"rupaylcvwbzmf\",\"invoiceSectionId\":\"ry\",\"invoiceSectionDisplayName\":\"jxlpiy\",\"customerId\":\"npfydrfb\",\"customerDisplayName\":\"nyxbyxmk\"},\"tags\":{\"aullfsty\":\"ync\",\"mhmqmiw\":\"gjqpulmwq\",\"fjnbxwbmwd\":\"zfvvzucqfg\",\"xhgdeke\":\"kinh\"},\"id\":\"ouyvew\",\"name\":\"pzrdwc\",\"type\":\"ldohgca\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingRoleAssignments() - .listByCustomer("zawwsdsorgf", "jxsawooau", "fh", "fqkmwz", 142986019754159266L, 4671413918355639020L, - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("ync", response.iterator().next().tags().get("aullfsty")); - Assertions.assertEquals("scxjfsgmosp", response.iterator().next().properties().principalPuid()); - Assertions.assertEquals("bnxsqc", response.iterator().next().properties().principalId()); - Assertions.assertEquals("scuyfqlamfbqhsuj", response.iterator().next().properties().principalTenantId()); - Assertions.assertEquals("afuzpnxqpwnik", response.iterator().next().properties().roleDefinitionId()); - Assertions.assertEquals("cajgrbr", response.iterator().next().properties().scope()); - Assertions.assertEquals("svgoocq", response.iterator().next().properties().userAuthenticationType()); - Assertions.assertEquals("zmz", response.iterator().next().properties().userEmailAddress()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByDepartmentMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByDepartmentMockTests.java deleted file mode 100644 index b8c3bbc16952..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByDepartmentMockTests.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleAssignment; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsListByDepartmentMockTests { - @Test - public void testListByDepartment() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"provisioningState\":\"New\",\"createdOn\":\"2021-07-12T19:07:49Z\",\"createdByPrincipalTenantId\":\"kezvpe\",\"createdByPrincipalId\":\"nfzqnzbflbqmh\",\"createdByPrincipalPuid\":\"yxxvwedhagqbbse\",\"createdByUserEmailAddress\":\"ayuflmsyz\",\"modifiedOn\":\"2021-03-17T10:33:43Z\",\"modifiedByPrincipalPuid\":\"olr\",\"modifiedByUserEmailAddress\":\"sb\",\"modifiedByPrincipalId\":\"phzkymu\",\"modifiedByPrincipalTenantId\":\"jivtb\",\"principalPuid\":\"zbdjrdfeujywdal\",\"principalId\":\"deqngc\",\"principalTenantId\":\"dz\",\"roleDefinitionId\":\"nloou\",\"scope\":\"ozmdahyclxr\",\"userAuthenticationType\":\"doebldpoiaffj\",\"userEmailAddress\":\"tnhrevimxmaxcj\",\"principalTenantName\":\"itygvdwds\",\"principalDisplayName\":\"tb\",\"principalType\":\"None\",\"billingRequestId\":\"ozbzchnqekwan\",\"billingAccountId\":\"purlcydjhtkj\",\"billingAccountDisplayName\":\"rwiyndurdonkgobx\",\"billingProfileId\":\"rdolenrswkn\",\"billingProfileDisplayName\":\"rgnmzaofroefqck\",\"invoiceSectionId\":\"vyrejyoy\",\"invoiceSectionDisplayName\":\"qftusdwmnrtvvbuc\",\"customerId\":\"rovomep\",\"customerDisplayName\":\"sicvwqzocsf\"},\"tags\":{\"ywdibugvnrgalvw\":\"nnmsg\",\"brbknuubxcwoj\":\"hry\",\"py\":\"upqdv\"},\"id\":\"vffifujgtdo\",\"name\":\"lxmwefcbybpchrtc\",\"type\":\"wjcujyznvyr\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.billingRoleAssignments().listByDepartment("xgwpq", "y", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("nnmsg", response.iterator().next().tags().get("ywdibugvnrgalvw")); - Assertions.assertEquals("zbdjrdfeujywdal", response.iterator().next().properties().principalPuid()); - Assertions.assertEquals("deqngc", response.iterator().next().properties().principalId()); - Assertions.assertEquals("dz", response.iterator().next().properties().principalTenantId()); - Assertions.assertEquals("nloou", response.iterator().next().properties().roleDefinitionId()); - Assertions.assertEquals("ozmdahyclxr", response.iterator().next().properties().scope()); - Assertions.assertEquals("doebldpoiaffj", response.iterator().next().properties().userAuthenticationType()); - Assertions.assertEquals("tnhrevimxmaxcj", response.iterator().next().properties().userEmailAddress()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByEnrollmentAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByEnrollmentAccountMockTests.java deleted file mode 100644 index d517b96d1616..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByEnrollmentAccountMockTests.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleAssignment; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsListByEnrollmentAccountMockTests { - @Test - public void testListByEnrollmentAccount() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\",\"createdOn\":\"2021-06-16T08:03:27Z\",\"createdByPrincipalTenantId\":\"xf\",\"createdByPrincipalId\":\"p\",\"createdByPrincipalPuid\":\"qclmd\",\"createdByUserEmailAddress\":\"fxxepzpxzxlcqzfx\",\"modifiedOn\":\"2021-06-24T08:55:26Z\",\"modifiedByPrincipalPuid\":\"qmcjbsmkirpqnipu\",\"modifiedByUserEmailAddress\":\"hkcomeobw\",\"modifiedByPrincipalId\":\"uzltenlb\",\"modifiedByPrincipalTenantId\":\"lmxoz\",\"principalPuid\":\"ndoduom\",\"principalId\":\"jbrixymckikkqy\",\"principalTenantId\":\"rhwis\",\"roleDefinitionId\":\"yfmrzcqfevnkyak\",\"scope\":\"tehognsddjk\",\"userAuthenticationType\":\"edesuazogfcnx\",\"userEmailAddress\":\"g\",\"principalTenantName\":\"mtcq\",\"principalDisplayName\":\"y\",\"principalType\":\"Group\",\"billingRequestId\":\"xypav\",\"billingAccountId\":\"jczgohv\",\"billingAccountDisplayName\":\"uw\",\"billingProfileId\":\"hmxczbyfkocgmzd\",\"billingProfileDisplayName\":\"snlwscrngtw\",\"invoiceSectionId\":\"rolwv\",\"invoiceSectionDisplayName\":\"ksdksutacuctih\",\"customerId\":\"ish\",\"customerDisplayName\":\"jhxvpmqququx\"},\"tags\":{\"rxlexoweorocr\":\"n\",\"gbq\":\"icgym\"},\"id\":\"yrvhtv\",\"name\":\"jvwmrgcnz\",\"type\":\"rpl\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingRoleAssignments() - .listByEnrollmentAccount("idcetfvgwfwsldi", "wouppvyddq", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("n", response.iterator().next().tags().get("rxlexoweorocr")); - Assertions.assertEquals("ndoduom", response.iterator().next().properties().principalPuid()); - Assertions.assertEquals("jbrixymckikkqy", response.iterator().next().properties().principalId()); - Assertions.assertEquals("rhwis", response.iterator().next().properties().principalTenantId()); - Assertions.assertEquals("yfmrzcqfevnkyak", response.iterator().next().properties().roleDefinitionId()); - Assertions.assertEquals("tehognsddjk", response.iterator().next().properties().scope()); - Assertions.assertEquals("edesuazogfcnx", response.iterator().next().properties().userAuthenticationType()); - Assertions.assertEquals("g", response.iterator().next().properties().userEmailAddress()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByInvoiceSectionMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByInvoiceSectionMockTests.java deleted file mode 100644 index 0eda0d95bbb0..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsListByInvoiceSectionMockTests.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleAssignment; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsListByInvoiceSectionMockTests { - @Test - public void testListByInvoiceSection() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"provisioningState\":\"Creating\",\"createdOn\":\"2021-10-08T14:45:45Z\",\"createdByPrincipalTenantId\":\"wrhulemmqmbwp\",\"createdByPrincipalId\":\"irxbkitzmnhit\",\"createdByPrincipalPuid\":\"jucltjlxsg\",\"createdByUserEmailAddress\":\"megdzd\",\"modifiedOn\":\"2021-07-22T09:25:46Z\",\"modifiedByPrincipalPuid\":\"u\",\"modifiedByUserEmailAddress\":\"f\",\"modifiedByPrincipalId\":\"zufldifnivlutg\",\"modifiedByPrincipalTenantId\":\"aacxauhvc\",\"principalPuid\":\"xhklsqxt\",\"principalId\":\"yygktsrjyxxoxwf\",\"principalTenantId\":\"kvecnxfx\",\"roleDefinitionId\":\"hsowbebsnbwutl\",\"scope\":\"wm\",\"userAuthenticationType\":\"mustih\",\"userEmailAddress\":\"rafjajvkyxmm\",\"principalTenantName\":\"zvogtde\",\"principalDisplayName\":\"ennmkvaeuwqd\",\"principalType\":\"Unknown\",\"billingRequestId\":\"lbmyphfxnrp\",\"billingAccountId\":\"ewokyqsfkxf\",\"billingAccountDisplayName\":\"wbihqbtodjfyxbvk\",\"billingProfileId\":\"zdmvdd\",\"billingProfileDisplayName\":\"cr\",\"invoiceSectionId\":\"yoz\",\"invoiceSectionDisplayName\":\"awnjdvvlrhoc\",\"customerId\":\"kvx\",\"customerDisplayName\":\"dqzbvbpsuvqhx\"},\"tags\":{\"rklpiigfuzk\":\"fgdkwbk\",\"jclzjwaqdzqydewu\":\"utui\"},\"id\":\"yllzzz\",\"name\":\"vtzqw\",\"type\":\"zochwbekmuyn\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingRoleAssignments() - .listByInvoiceSection("pqoswgfqv", "mghpakbqyh", "sornfbmeqagkn", "jm", 9197157484428670183L, - 486684540008920384L, com.azure.core.util.Context.NONE); - - Assertions.assertEquals("fgdkwbk", response.iterator().next().tags().get("rklpiigfuzk")); - Assertions.assertEquals("xhklsqxt", response.iterator().next().properties().principalPuid()); - Assertions.assertEquals("yygktsrjyxxoxwf", response.iterator().next().properties().principalId()); - Assertions.assertEquals("kvecnxfx", response.iterator().next().properties().principalTenantId()); - Assertions.assertEquals("hsowbebsnbwutl", response.iterator().next().properties().roleDefinitionId()); - Assertions.assertEquals("wm", response.iterator().next().properties().scope()); - Assertions.assertEquals("mustih", response.iterator().next().properties().userAuthenticationType()); - Assertions.assertEquals("rafjajvkyxmm", response.iterator().next().properties().userEmailAddress()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsResolveByBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsResolveByBillingAccountMockTests.java deleted file mode 100644 index 2e7f73e54319..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsResolveByBillingAccountMockTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleAssignmentListResult; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsResolveByBillingAccountMockTests { - @Test - public void testResolveByBillingAccount() throws Exception { - String responseStr - = "{\"nextLink\":\"qyzycgcm\",\"value\":[{\"properties\":{\"provisioningState\":\"Pending\",\"createdOn\":\"2021-11-12T00:01:25Z\",\"createdByPrincipalTenantId\":\"osxzm\",\"createdByPrincipalId\":\"lybqfufkekzfkic\",\"createdByPrincipalPuid\":\"sevm\",\"createdByUserEmailAddress\":\"gg\",\"modifiedOn\":\"2021-08-29T05:36:13Z\",\"modifiedByPrincipalPuid\":\"yjokvlwvbjs\",\"modifiedByUserEmailAddress\":\"xsv\",\"modifiedByPrincipalId\":\"pabwbpzgfgqpudhg\",\"modifiedByPrincipalTenantId\":\"ieabbfpxxavlo\",\"principalPuid\":\"kgsnuhwyxjsfm\",\"principalId\":\"c\",\"principalTenantId\":\"nbeosk\",\"roleDefinitionId\":\"mqqerwqxpj\",\"scope\":\"emdfkh\",\"userAuthenticationType\":\"uo\",\"userEmailAddress\":\"xzmhyte\",\"principalTenantName\":\"kjgeecwtfma\",\"principalDisplayName\":\"bmnhtwofx\",\"principalType\":\"Group\",\"billingRequestId\":\"vyqnslbqrmlq\",\"billingAccountId\":\"ekhjgq\",\"billingAccountDisplayName\":\"ugwespscvsmsp\",\"billingProfileId\":\"uwozfvz\",\"billingProfileDisplayName\":\"upcvq\",\"invoiceSectionId\":\"cvwioq\",\"invoiceSectionDisplayName\":\"m\",\"customerId\":\"mlmpnvqxuyi\",\"customerDisplayName\":\"z\"},\"tags\":{\"xo\":\"qseypdlmajpu\",\"mzgccy\":\"f\",\"neeyrxparxtz\":\"buvmsiehedmmv\",\"digeb\":\"yqw\"},\"id\":\"plzdssiwwve\",\"name\":\"ozbjk\",\"type\":\"qpizdnuehxw\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRoleAssignmentListResult response = manager.billingRoleAssignments() - .resolveByBillingAccount("xfmbzqu", false, "tqmh", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsResolveByBillingProfileMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsResolveByBillingProfileMockTests.java deleted file mode 100644 index 2a3270420b9d..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsResolveByBillingProfileMockTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleAssignmentListResult; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsResolveByBillingProfileMockTests { - @Test - public void testResolveByBillingProfile() throws Exception { - String responseStr - = "{\"nextLink\":\"cpskgrhnyts\",\"value\":[{\"properties\":{\"provisioningState\":\"PendingBilling\",\"createdOn\":\"2021-10-27T14:21:10Z\",\"createdByPrincipalTenantId\":\"ghxhkyqzjsdkpvn\",\"createdByPrincipalId\":\"zwpf\",\"createdByPrincipalPuid\":\"sfybntmvehohf\",\"createdByUserEmailAddress\":\"uvbgtzqzqweuy\",\"modifiedOn\":\"2021-06-24T08:43:46Z\",\"modifiedByPrincipalPuid\":\"airvhpqsv\",\"modifiedByUserEmailAddress\":\"eoge\",\"modifiedByPrincipalId\":\"rcn\",\"modifiedByPrincipalTenantId\":\"vncprfc\",\"principalPuid\":\"vjnkoiz\",\"principalId\":\"sqbibaa\",\"principalTenantId\":\"icovj\",\"roleDefinitionId\":\"mvwrmjxyvuodnx\",\"scope\":\"bassqfyylwpp\",\"userAuthenticationType\":\"gkbzbloas\",\"userEmailAddress\":\"xhqvovdpmht\",\"principalTenantName\":\"vsqjs\",\"principalDisplayName\":\"jnqtaqg\",\"principalType\":\"Unknown\",\"billingRequestId\":\"kceincnrec\",\"billingAccountId\":\"iywevsfg\",\"billingAccountDisplayName\":\"mnszdosmjsqsvzvm\",\"billingProfileId\":\"cwghndaevhgsulw\",\"billingProfileDisplayName\":\"seufig\",\"invoiceSectionId\":\"jjuzk\",\"invoiceSectionDisplayName\":\"mciwu\",\"customerId\":\"zekypyovljlbzd\",\"customerDisplayName\":\"ybpaxhpzysovsnw\"},\"tags\":{\"ag\":\"nzgesfhs\",\"zpbyfyvynpmggq\":\"ahn\"},\"id\":\"g\",\"name\":\"nvqbugihcdvfoiz\",\"type\":\"r\"},{\"properties\":{\"provisioningState\":\"PendingBilling\",\"createdOn\":\"2021-01-12T15:23:43Z\",\"createdByPrincipalTenantId\":\"axz\",\"createdByPrincipalId\":\"qwvdepp\",\"createdByPrincipalPuid\":\"aphifkfrpm\",\"createdByUserEmailAddress\":\"ubpebrm\",\"modifiedOn\":\"2021-10-07T01:34:45Z\",\"modifiedByPrincipalPuid\":\"p\",\"modifiedByUserEmailAddress\":\"tbttpkimskhnkkh\",\"modifiedByPrincipalId\":\"krsmhrcmely\",\"modifiedByPrincipalTenantId\":\"gokuthrvybnz\",\"principalPuid\":\"vmshfuzzlapyi\",\"principalId\":\"vzcgulaebxia\",\"principalTenantId\":\"suptessjlwjt\",\"roleDefinitionId\":\"tpvb\",\"scope\":\"kx\",\"userAuthenticationType\":\"qaygas\",\"userEmailAddress\":\"vc\",\"principalTenantName\":\"pvlcjbvyez\",\"principalDisplayName\":\"jkqonbw\",\"principalType\":\"Everyone\",\"billingRequestId\":\"yozvrcwfpucw\",\"billingAccountId\":\"cgq\",\"billingAccountDisplayName\":\"gzjvbxqcbgoa\",\"billingProfileId\":\"tuuciagvkd\",\"billingProfileDisplayName\":\"uduklbjoafmj\",\"invoiceSectionId\":\"xul\",\"invoiceSectionDisplayName\":\"epkna\",\"customerId\":\"eiancsqoac\",\"customerDisplayName\":\"qdgsapleqfgkxen\"},\"tags\":{\"qcwggchxvl\":\"glvyakeszsuuvul\"},\"id\":\"fbrvecicaovphirl\",\"name\":\"bipiunn\",\"type\":\"pkwzzzkueruwcj\"},{\"properties\":{\"provisioningState\":\"Failed\",\"createdOn\":\"2021-05-31T11:47:01Z\",\"createdByPrincipalTenantId\":\"a\",\"createdByPrincipalId\":\"ttwyk\",\"createdByPrincipalPuid\":\"vbwofxxdplre\",\"createdByUserEmailAddress\":\"kvgahcbtu\",\"modifiedOn\":\"2021-01-29T10:37:45Z\",\"modifiedByPrincipalPuid\":\"xrhrfjenraz\",\"modifiedByUserEmailAddress\":\"fiktlhqa\",\"modifiedByPrincipalId\":\"tostjixyzsecig\",\"modifiedByPrincipalTenantId\":\"dwjtacfvvtd\",\"principalPuid\":\"bpzfomcsaugbrh\",\"principalId\":\"wltkfysuntethklx\",\"principalTenantId\":\"cvasyyh\",\"roleDefinitionId\":\"qokjbmsrk\",\"scope\":\"yxxhwrlqom\",\"userAuthenticationType\":\"syilpzzbrwnrzoz\",\"userEmailAddress\":\"agysokl\",\"principalTenantName\":\"ksybvrrbnhylsb\",\"principalDisplayName\":\"jcydyllmxvp\",\"principalType\":\"User\",\"billingRequestId\":\"syqagqllcbrvai\",\"billingAccountId\":\"lkyhtrrqwfyybpt\",\"billingAccountDisplayName\":\"jrnogykugdl\",\"billingProfileId\":\"sav\",\"billingProfileDisplayName\":\"hk\",\"invoiceSectionId\":\"geuufkb\",\"invoiceSectionDisplayName\":\"fbxjblajybdnb\",\"customerId\":\"sbtoisazdjmo\",\"customerDisplayName\":\"vpz\"},\"tags\":{\"wtmszcfyzq\":\"ywxuymlfjym\",\"re\":\"e\"},\"id\":\"urd\",\"name\":\"agknxmaovrg\",\"type\":\"hlnzffew\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRoleAssignmentListResult response = manager.billingRoleAssignments() - .resolveByBillingProfile("pgve", "robujnjgybuxm", false, "igidulln", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsResolveByCustomerMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsResolveByCustomerMockTests.java deleted file mode 100644 index 983903a7d105..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsResolveByCustomerMockTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleAssignmentListResult; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsResolveByCustomerMockTests { - @Test - public void testResolveByCustomer() throws Exception { - String responseStr - = "{\"nextLink\":\"tkhfhfs\",\"value\":[{\"properties\":{\"provisioningState\":\"PendingBilling\",\"createdOn\":\"2021-10-10T02:40:33Z\",\"createdByPrincipalTenantId\":\"nmizhv\",\"createdByPrincipalId\":\"hqqwcubl\",\"createdByPrincipalPuid\":\"hk\",\"createdByUserEmailAddress\":\"obzgott\",\"modifiedOn\":\"2021-11-15T00:58:38Z\",\"modifiedByPrincipalPuid\":\"dz\",\"modifiedByUserEmailAddress\":\"h\",\"modifiedByPrincipalId\":\"tbtdvu\",\"modifiedByPrincipalTenantId\":\"vvraabeurdeewlsu\",\"principalPuid\":\"cbwkdwjyj\",\"principalId\":\"nioroofmft\",\"principalTenantId\":\"pmcreihu\",\"roleDefinitionId\":\"trnighm\",\"scope\":\"uwqxungrobgw\",\"userAuthenticationType\":\"sxjwdy\",\"userEmailAddress\":\"xmvzjow\",\"principalTenantName\":\"geerclbl\",\"principalDisplayName\":\"hpwachyeu\",\"principalType\":\"DirectoryRole\",\"billingRequestId\":\"vwryvd\",\"billingAccountId\":\"kiikgpruccwmecbt\",\"billingAccountDisplayName\":\"ytrtexegwmrq\",\"billingProfileId\":\"wi\",\"billingProfileDisplayName\":\"vycfjncindi\",\"invoiceSectionId\":\"q\",\"invoiceSectionDisplayName\":\"jwjuriarsb\",\"customerId\":\"lanhzcknjxizba\",\"customerDisplayName\":\"ygzkztxfexwacyy\"},\"tags\":{\"p\":\"x\",\"b\":\"ndzkfevuiiui\"},\"id\":\"cjy\",\"name\":\"qdcizeqqfopvnopm\",\"type\":\"tdsfh\"},{\"properties\":{\"provisioningState\":\"PendingBilling\",\"createdOn\":\"2021-02-10T02:34:42Z\",\"createdByPrincipalTenantId\":\"zyfbkmvldzmxojz\",\"createdByPrincipalId\":\"ma\",\"createdByPrincipalPuid\":\"bqk\",\"createdByUserEmailAddress\":\"yejthgeecb\",\"modifiedOn\":\"2021-02-06T20:29:42Z\",\"modifiedByPrincipalPuid\":\"wlckihbamyqs\",\"modifiedByUserEmailAddress\":\"knp\",\"modifiedByPrincipalId\":\"zjwdizcr\",\"modifiedByPrincipalTenantId\":\"x\",\"principalPuid\":\"j\",\"principalId\":\"c\",\"principalTenantId\":\"xgkrswksykkbxk\",\"roleDefinitionId\":\"xbbwlmnwz\",\"scope\":\"nvuqddlggbqaolgz\",\"userAuthenticationType\":\"akdlkvggc\",\"userEmailAddress\":\"nsffetp\",\"principalTenantName\":\"ixwewzlscgsmep\",\"principalDisplayName\":\"vxgv\",\"principalType\":\"DirectoryRole\",\"billingRequestId\":\"thhx\",\"billingAccountId\":\"ev\",\"billingAccountDisplayName\":\"deepfhgan\",\"billingProfileId\":\"wxqhpjhubo\",\"billingProfileDisplayName\":\"vzgaybvr\",\"invoiceSectionId\":\"og\",\"invoiceSectionDisplayName\":\"gxnwfmzvztau\",\"customerId\":\"pamqxfcssanybz\",\"customerDisplayName\":\"hvdfe\"},\"tags\":{\"hookju\":\"jsvcdhlyw\"},\"id\":\"xezriw\",\"name\":\"oewapcqksaaapxjh\",\"type\":\"itibenwsdf\"},{\"properties\":{\"provisioningState\":\"New\",\"createdOn\":\"2021-07-02T01:30:12Z\",\"createdByPrincipalTenantId\":\"frcqkl\",\"createdByPrincipalId\":\"vzp\",\"createdByPrincipalPuid\":\"eszyaqgomlbmfgge\",\"createdByUserEmailAddress\":\"fekcjjlwkye\",\"modifiedOn\":\"2021-05-31T22:28:45Z\",\"modifiedByPrincipalPuid\":\"utpulnr\",\"modifiedByUserEmailAddress\":\"qufmcihpinowrer\",\"modifiedByPrincipalId\":\"xptch\",\"modifiedByPrincipalTenantId\":\"yqqidqimlgbbfjm\",\"principalPuid\":\"jvxlhmpmh\",\"principalId\":\"t\",\"principalTenantId\":\"phqeofy\",\"roleDefinitionId\":\"lsn\",\"scope\":\"wmcm\",\"userAuthenticationType\":\"ixuanccqvjfdgfq\",\"userEmailAddress\":\"quxpjhcfaara\",\"principalTenantName\":\"iovmufzgugrblwal\",\"principalDisplayName\":\"ssnqe\",\"principalType\":\"Unknown\",\"billingRequestId\":\"bptgcsmanxxrwq\",\"billingAccountId\":\"dqe\",\"billingAccountDisplayName\":\"tamqwzmnobf\",\"billingProfileId\":\"wpsibxovuqoq\",\"billingProfileDisplayName\":\"kblndy\",\"invoiceSectionId\":\"wgycvtqnzjc\",\"invoiceSectionDisplayName\":\"qzhembtbw\",\"customerId\":\"lbadp\",\"customerDisplayName\":\"jdleajvmvvlooubs\"},\"tags\":{\"omlupfaz\":\"pjeopskgoc\",\"dhuslgdwz\":\"sj\"},\"id\":\"dqyxajclgr\",\"name\":\"avqcwy\",\"type\":\"oqzkmqcwwsjnki\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRoleAssignmentListResult response = manager.billingRoleAssignments() - .resolveByCustomer("mzy", "ffetevrnt", "k", true, "acycsyo", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsResolveByInvoiceSectionMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsResolveByInvoiceSectionMockTests.java deleted file mode 100644 index 4d4ce5944c44..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleAssignmentsResolveByInvoiceSectionMockTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleAssignmentListResult; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleAssignmentsResolveByInvoiceSectionMockTests { - @Test - public void testResolveByInvoiceSection() throws Exception { - String responseStr - = "{\"nextLink\":\"xpmhzghhhk\",\"value\":[{\"properties\":{\"provisioningState\":\"New\",\"createdOn\":\"2021-04-04T03:21:50Z\",\"createdByPrincipalTenantId\":\"zvhn\",\"createdByPrincipalId\":\"pmxnht\",\"createdByPrincipalPuid\":\"stqlfxolrwv\",\"createdByUserEmailAddress\":\"gxyfjsweq\",\"modifiedOn\":\"2021-03-11T09:47:37Z\",\"modifiedByPrincipalPuid\":\"yyopoaytwwgw\",\"modifiedByUserEmailAddress\":\"b\",\"modifiedByPrincipalId\":\"bvufrkwjiemimdtn\",\"modifiedByPrincipalTenantId\":\"wew\",\"principalPuid\":\"kreeeddd\",\"principalId\":\"tfquu\",\"principalTenantId\":\"clhsiigeeuw\",\"roleDefinitionId\":\"rn\",\"scope\":\"xfedqnetdqw\",\"userAuthenticationType\":\"xoqgvbzpggpw\",\"userEmailAddress\":\"y\",\"principalTenantName\":\"qajejirvavrvkgp\",\"principalDisplayName\":\"plbjuvlnhxnr\",\"principalType\":\"User\",\"billingRequestId\":\"na\",\"billingAccountId\":\"esbxnepqmjmoplu\",\"billingAccountDisplayName\":\"ykkfhsovadkrm\",\"billingProfileId\":\"mwqpdkesjqbzkqm\",\"billingProfileDisplayName\":\"poriwbwggijtspzj\",\"invoiceSectionId\":\"rhikwsbzrhdug\",\"invoiceSectionDisplayName\":\"htrgz\",\"customerId\":\"unjf\",\"customerDisplayName\":\"jhiycbauseqnczk\"},\"tags\":{\"gzunkfnyskwwunqh\":\"vtuwyjsqwzszosz\",\"ojmslhip\":\"za\",\"vchyluqalpcufj\":\"ukvbljpxpr\",\"tiztqds\":\"f\"},\"id\":\"h\",\"name\":\"hs\",\"type\":\"axxsritr\"},{\"properties\":{\"provisioningState\":\"Expired\",\"createdOn\":\"2020-12-25T06:15:34Z\",\"createdByPrincipalTenantId\":\"yyefmxwoqotiiqb\",\"createdByPrincipalId\":\"asrvrmtist\",\"createdByPrincipalPuid\":\"kjhorlxkpy\",\"createdByUserEmailAddress\":\"ennycntr\",\"modifiedOn\":\"2021-02-28T07:36:33Z\",\"modifiedByPrincipalPuid\":\"tdmbqjtsuhq\",\"modifiedByUserEmailAddress\":\"oxtdyqavfx\",\"modifiedByPrincipalId\":\"mzxsyaksinpaa\",\"modifiedByPrincipalTenantId\":\"hwbghvwtgp\",\"principalPuid\":\"chcgsfz\",\"principalId\":\"jkiysqbjsdj\",\"principalTenantId\":\"xeysgwkcffe\",\"roleDefinitionId\":\"znzcbivoveomkhfe\",\"scope\":\"ooplfpohim\",\"userAuthenticationType\":\"kycjpeebznbz\",\"userEmailAddress\":\"sulou\",\"principalTenantName\":\"pbmxooqoh\",\"principalDisplayName\":\"ncdmwkh\",\"principalType\":\"None\",\"billingRequestId\":\"sl\",\"billingAccountId\":\"dzauiunyev\",\"billingAccountDisplayName\":\"zdsytciks\",\"billingProfileId\":\"camwuynfxkcgs\",\"billingProfileDisplayName\":\"mvhadrpbatvy\",\"invoiceSectionId\":\"ljqkqwsyjtvjkowg\",\"invoiceSectionDisplayName\":\"awwdmbypnkteiidl\",\"customerId\":\"vwbclp\",\"customerDisplayName\":\"eganihk\"},\"tags\":{\"kyjulskwwn\":\"er\"},\"id\":\"qlq\",\"name\":\"pwxtvc\",\"type\":\"bav\"},{\"properties\":{\"provisioningState\":\"Expired\",\"createdOn\":\"2021-11-21T17:33:30Z\",\"createdByPrincipalTenantId\":\"genlrjcsmwevguyf\",\"createdByPrincipalId\":\"xelrjk\",\"createdByPrincipalPuid\":\"cdetowwezhy\",\"createdByUserEmailAddress\":\"di\",\"modifiedOn\":\"2021-11-28T21:52:31Z\",\"modifiedByPrincipalPuid\":\"lqacsfqbi\",\"modifiedByUserEmailAddress\":\"ybcelfjnxodnjy\",\"modifiedByPrincipalId\":\"faxs\",\"modifiedByPrincipalTenantId\":\"vuelumodpegqxso\",\"principalPuid\":\"hazrqoxz\",\"principalId\":\"lbeqvh\",\"principalTenantId\":\"b\",\"roleDefinitionId\":\"pwxslaj\",\"scope\":\"fzga\",\"userAuthenticationType\":\"hawkmibuydwi\",\"userEmailAddress\":\"nicupdyt\",\"principalTenantName\":\"miuvjplosebmhhtu\",\"principalDisplayName\":\"txynoflqobfixngx\",\"principalType\":\"User\",\"billingRequestId\":\"exhnkingi\",\"billingAccountId\":\"dolrpgup\",\"billingAccountDisplayName\":\"lbsm\",\"billingProfileId\":\"a\",\"billingProfileDisplayName\":\"ncuyjeykcnhppl\",\"invoiceSectionId\":\"cfzxjziu\",\"invoiceSectionDisplayName\":\"rlnewnuwkkfzzetl\",\"customerId\":\"dyxzlvwywjvr\",\"customerDisplayName\":\"qpwwlzpddarc\"},\"tags\":{\"knmstbdoprwkamp\":\"whslxebaja\",\"rcycmwhuzymhl\":\"hwpbldzniu\",\"knlvk\":\"ih\"},\"id\":\"bzk\",\"name\":\"paiildcpudkhqu\",\"type\":\"syjo\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRoleAssignmentListResult response = manager.billingRoleAssignments() - .resolveByInvoiceSection("fzdos", "zkdiuvflgzhcw", "gwahcrxo", false, "rutvnpccxz", - com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionInnerTests.java deleted file mode 100644 index 937c750e8a7a..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionInnerTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.BillingRoleDefinitionInner; -import com.azure.resourcemanager.billing.models.BillingRoleDefinitionProperties; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class BillingRoleDefinitionInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingRoleDefinitionInner model = BinaryData.fromString( - "{\"properties\":{\"description\":\"ssxmojms\",\"permissions\":[{\"actions\":[\"rvkwc\",\"zqljyxgtczh\",\"ydbsd\",\"hmkxmaehvbb\"],\"notActions\":[\"iplt\",\"n\"]},{\"actions\":[\"axkgx\"],\"notActions\":[\"ckpyklyhplu\"]}],\"roleName\":\"dpvruud\"},\"tags\":{\"eclze\":\"ibthostgktstvd\"},\"id\":\"bcvhzlhpl\",\"name\":\"dqkdlwwqfbu\",\"type\":\"lkxt\"}") - .toObject(BillingRoleDefinitionInner.class); - Assertions.assertEquals("ibthostgktstvd", model.tags().get("eclze")); - Assertions.assertEquals("dpvruud", model.properties().roleName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingRoleDefinitionInner model = new BillingRoleDefinitionInner().withTags(mapOf("eclze", "ibthostgktstvd")) - .withProperties(new BillingRoleDefinitionProperties().withRoleName("dpvruud")); - model = BinaryData.fromObject(model).toObject(BillingRoleDefinitionInner.class); - Assertions.assertEquals("ibthostgktstvd", model.tags().get("eclze")); - Assertions.assertEquals("dpvruud", model.properties().roleName()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionListResultTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionListResultTests.java deleted file mode 100644 index dcfe3607dc60..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionListResultTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.BillingRoleDefinitionListResult; - -public final class BillingRoleDefinitionListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingRoleDefinitionListResult model = BinaryData.fromString( - "{\"nextLink\":\"rwm\",\"value\":[{\"properties\":{\"description\":\"klvxwmyg\",\"permissions\":[{\"actions\":[\"qchiszep\",\"nb\",\"crxgibb\"],\"notActions\":[\"confozauors\",\"kokwbqplhlvnu\",\"epzl\"]},{\"actions\":[\"wzsoldweyuqdunv\"],\"notActions\":[\"rwrbi\",\"rk\",\"alywjhhgdn\"]},{\"actions\":[\"sivfomilo\"],\"notActions\":[\"dufiq\",\"dieuzaofj\"]},{\"actions\":[\"cyyysfgdot\"],\"notActions\":[\"iipuipwoqonm\",\"cje\"]}],\"roleName\":\"nizshqvcim\"},\"tags\":{\"ccwr\":\"fgmblrrilbywdxsm\",\"dvoqyt\":\"fscjfnynszquji\",\"hjoxo\":\"byowbblgyavutp\"},\"id\":\"msksbp\",\"name\":\"mlqoljx\",\"type\":\"cgxxlxs\"},{\"properties\":{\"description\":\"cvizqzdwlvw\",\"permissions\":[{\"actions\":[\"fgfb\",\"jub\",\"yhgk\"],\"notActions\":[\"nsgowzfttst\"]},{\"actions\":[\"lahb\",\"actxtgzukxitm\"],\"notActions\":[\"gqqqxh\"]}],\"roleName\":\"n\"},\"tags\":{\"okqdzfvaz\":\"cpjuisa\",\"ajlkatnw\":\"vjlfrqtt\",\"kqqfk\":\"yiopi\",\"dmligovibrxk\":\"vscx\"},\"id\":\"loazuruocbgoo\",\"name\":\"bteoybf\",\"type\":\"jxakv\"},{\"properties\":{\"description\":\"slordilmyww\",\"permissions\":[{\"actions\":[\"nye\",\"abgyvudt\"],\"notActions\":[\"wbcihxuuwh\",\"j\",\"xccybvpa\"]},{\"actions\":[\"kudzpxgwj\",\"lma\"],\"notActions\":[\"cyohpfkyrkdbd\",\"iogsjkmnwq\",\"nobaiyhddviacegf\"]},{\"actions\":[\"tfpmvmemfnczdw\",\"vbalxlllc\",\"podbzevwrdnh\"],\"notActions\":[\"uvsj\",\"swsmys\",\"uluqypfc\"]}],\"roleName\":\"lerchpq\"},\"tags\":{\"sspuunnoxyhkx\":\"pjbabwidfc\"},\"id\":\"ddrihpf\",\"name\":\"oqcaaewdaomdj\",\"type\":\"l\"},{\"properties\":{\"description\":\"xkzb\",\"permissions\":[{\"actions\":[\"ivsiy\",\"zkdnc\",\"dxonbzoggculap\"],\"notActions\":[\"rpgogtqxep\"]},{\"actions\":[\"b\"],\"notActions\":[\"jlyjtlvofq\",\"hvfcibyfmow\",\"xrkjpvdw\",\"fzwiivwzjbhyz\"]}],\"roleName\":\"xjrk\"},\"tags\":{\"pa\":\"trnegvmnvuqeqvld\",\"kdmflvestmjlx\":\"tjb\"},\"id\":\"ilozapeewchpxlk\",\"name\":\"wk\",\"type\":\"ziycslevufuztck\"}]}") - .toObject(BillingRoleDefinitionListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingRoleDefinitionListResult model = new BillingRoleDefinitionListResult(); - model = BinaryData.fromObject(model).toObject(BillingRoleDefinitionListResult.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionPropertiesTests.java deleted file mode 100644 index a3af1a194a0e..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionPropertiesTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.BillingRoleDefinitionProperties; -import org.junit.jupiter.api.Assertions; - -public final class BillingRoleDefinitionPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingRoleDefinitionProperties model = BinaryData.fromString( - "{\"description\":\"jfsmlmbtxhwgfwsr\",\"permissions\":[{\"actions\":[\"ezbrhubskh\",\"dyg\",\"ookk\"],\"notActions\":[\"jb\",\"leorfmluiqtqz\",\"avyvnqqyba\"]},{\"actions\":[\"uayjkqa\",\"qgzsles\",\"cbhernntiewdj\",\"vbquwr\"],\"notActions\":[\"wagohbuffk\",\"rqemvvhmxt\",\"rjfut\",\"coebjvewzcj\"]},{\"actions\":[\"wcpmguaadraufac\"],\"notActions\":[\"hzovaj\",\"ziuxxpshnee\",\"ulfgslqu\",\"kwdlenrdsutujba\"]}],\"roleName\":\"pjuohminyfl\"}") - .toObject(BillingRoleDefinitionProperties.class); - Assertions.assertEquals("pjuohminyfl", model.roleName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingRoleDefinitionProperties model = new BillingRoleDefinitionProperties().withRoleName("pjuohminyfl"); - model = BinaryData.fromObject(model).toObject(BillingRoleDefinitionProperties.class); - Assertions.assertEquals("pjuohminyfl", model.roleName()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByBillingAccountWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByBillingAccountWithResponseMockTests.java deleted file mode 100644 index bf173320c907..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByBillingAccountWithResponseMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleDefinition; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleDefinitionsGetByBillingAccountWithResponseMockTests { - @Test - public void testGetByBillingAccountWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"description\":\"rmsdbvqxgfyg\",\"permissions\":[{\"actions\":[\"dpbceh\",\"bdpsesboynpyt\",\"orrvk\"],\"notActions\":[\"ctanetinqxdhnpj\",\"ezjigh\"]},{\"actions\":[\"l\",\"pmrzwvwetqf\"],\"notActions\":[\"vfhuqhngqqx\",\"bsotoc\"]},{\"actions\":[\"ttujydeatwxp\",\"bx\",\"dhxbboceksramqc\",\"l\"],\"notActions\":[\"n\",\"vvkswurxdq\",\"vhauimnntfkqp\",\"qcnbnwivlqcwyzh\"]},{\"actions\":[\"kzstzpzecdlc\",\"irtahtu\",\"cimtcaumviud\"],\"notActions\":[\"jqrmlujmtunl\",\"fwuzebfq\",\"mpjbh\"]}],\"roleName\":\"yenfspetxeu\"},\"tags\":{\"evzp\":\"hdlckdoxocjc\",\"gvrlhfxmrh\":\"reortwwyj\"},\"id\":\"nhbcjy\",\"name\":\"kdywkszavuafane\",\"type\":\"ictptplk\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRoleDefinition response = manager.billingRoleDefinitions() - .getByBillingAccountWithResponse("etqhdbitqsby", "jsgomrih", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("hdlckdoxocjc", response.tags().get("evzp")); - Assertions.assertEquals("yenfspetxeu", response.properties().roleName()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByBillingProfileWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByBillingProfileWithResponseMockTests.java deleted file mode 100644 index 99a7ac9f6300..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByBillingProfileWithResponseMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleDefinition; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleDefinitionsGetByBillingProfileWithResponseMockTests { - @Test - public void testGetByBillingProfileWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"description\":\"mslub\",\"permissions\":[{\"actions\":[\"uysjhvrr\",\"lfswarmybwmro\"],\"notActions\":[\"ysyqnipehfwwcb\",\"nxiajuvj\",\"cfjisosfzlnraxn\",\"yzguaxfhvjixg\"]},{\"actions\":[\"dqwsjmihuvrqp\"],\"notActions\":[\"oi\"]},{\"actions\":[\"k\"],\"notActions\":[\"ydprpensbmzjri\"]}],\"roleName\":\"uk\"},\"tags\":{\"xwjoqfzwand\":\"hbfexmizz\"},\"id\":\"duwd\",\"name\":\"olxtqmric\",\"type\":\"s\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRoleDefinition response = manager.billingRoleDefinitions() - .getByBillingProfileWithResponse("tssjd", "wbnklgerx", "ctsawvxcimpthjrm", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("hbfexmizz", response.tags().get("xwjoqfzwand")); - Assertions.assertEquals("uk", response.properties().roleName()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByCustomerWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByCustomerWithResponseMockTests.java deleted file mode 100644 index 58b05573a341..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByCustomerWithResponseMockTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleDefinition; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleDefinitionsGetByCustomerWithResponseMockTests { - @Test - public void testGetByCustomerWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"description\":\"atktwjrppifeyrq\",\"permissions\":[{\"actions\":[\"dcizhvksb\",\"jklwjp\"],\"notActions\":[\"ncw\",\"smpyeyzolbfnfly\"]},{\"actions\":[\"uduiqoom\"],\"notActions\":[\"kqwopws\",\"liyznghuqzgp\"]},{\"actions\":[\"kfv\"],\"notActions\":[\"gavtfy\",\"sedfmzu\",\"ryxpi\"]}],\"roleName\":\"vapeakfdmc\"},\"tags\":{\"doqkanqtr\":\"iklxkyo\"},\"id\":\"cwhqyrgqmndkrw\",\"name\":\"murh\",\"type\":\"ifqeqfsr\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRoleDefinition response = manager.billingRoleDefinitions() - .getByCustomerWithResponse("xdifbwblijhp", "ukxgoyxontbwdq", "xr", "suqrrldxfuaef", - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("iklxkyo", response.tags().get("doqkanqtr")); - Assertions.assertEquals("vapeakfdmc", response.properties().roleName()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByDepartmentWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByDepartmentWithResponseMockTests.java deleted file mode 100644 index 449845fbd754..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByDepartmentWithResponseMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleDefinition; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleDefinitionsGetByDepartmentWithResponseMockTests { - @Test - public void testGetByDepartmentWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"description\":\"fopxpryxnsbubw\",\"permissions\":[{\"actions\":[\"u\",\"wluxahtqmmkdhwqc\"],\"notActions\":[\"ba\",\"mfpk\",\"phujeucosvk\",\"eergvypaxpjpy\"]},{\"actions\":[\"gnue\",\"zfpffbuqxknvmcgm\"],\"notActions\":[\"yojfchicpare\",\"zoksgqhb\"]},{\"actions\":[\"uxilozb\",\"kcr\",\"l\"],\"notActions\":[\"jw\",\"kbptsfl\",\"tumbmwgft\"]},{\"actions\":[\"gmuxu\",\"iagskoikuqir\",\"skxpaowkgvnlfue\",\"x\"],\"notActions\":[\"brlrjugcfebpi\",\"ce\",\"bvr\"]}],\"roleName\":\"lldfknbdzw\"},\"tags\":{\"yiqjz\":\"x\",\"yxfwfctq\":\"wrduxntpfxxgja\",\"melupjckiehd\":\"eyfbkqynlzx\",\"xxxffgmcuanszee\":\"vfoy\"},\"id\":\"gcgcsapvbcq\",\"name\":\"fusekijhminenkb\",\"type\":\"vpyr\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRoleDefinition response = manager.billingRoleDefinitions() - .getByDepartmentWithResponse("dtlxc", "tjhbcycgq", "kcsihxvta", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("x", response.tags().get("yiqjz")); - Assertions.assertEquals("lldfknbdzw", response.properties().roleName()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByEnrollmentAccountWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByEnrollmentAccountWithResponseMockTests.java deleted file mode 100644 index c9e81209b939..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByEnrollmentAccountWithResponseMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleDefinition; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleDefinitionsGetByEnrollmentAccountWithResponseMockTests { - @Test - public void testGetByEnrollmentAccountWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"description\":\"uqzgbjwvrudmp\",\"permissions\":[{\"actions\":[\"ioleajabesgyzwp\",\"bjkscecmbaajdfwr\"],\"notActions\":[\"lvzkfekde\",\"bpjqtllb\"]}],\"roleName\":\"jjpduibsrrrq\"},\"tags\":{\"rvshhovtuercpzh\":\"qrypy\",\"yb\":\"wc\",\"nwczsraz\":\"dzycxhaoegjzgplj\",\"uapasizzfmugykw\":\"bybicqhxhj\"},\"id\":\"cuotenndzgthdzit\",\"name\":\"zffpherwj\",\"type\":\"vswtwonadezm\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRoleDefinition response = manager.billingRoleDefinitions() - .getByEnrollmentAccountWithResponse("aprjxcon", "ick", "kithueoc", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("qrypy", response.tags().get("rvshhovtuercpzh")); - Assertions.assertEquals("jjpduibsrrrq", response.properties().roleName()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByInvoiceSectionWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByInvoiceSectionWithResponseMockTests.java deleted file mode 100644 index 25d7346856d4..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsGetByInvoiceSectionWithResponseMockTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleDefinition; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleDefinitionsGetByInvoiceSectionWithResponseMockTests { - @Test - public void testGetByInvoiceSectionWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"description\":\"uyyaescjxna\",\"permissions\":[{\"actions\":[\"bkx\",\"tbfkihainzkef\",\"zl\",\"vcozcgoeozli\"],\"notActions\":[\"nunzuysajvvq\",\"honyonelivgtibt\",\"qjqjcajgofytkhhk\",\"mrvkxeojtdyulglh\"]},{\"actions\":[\"ru\",\"lfqfxspxgogypbzt\"],\"notActions\":[\"xjnskvc\",\"vuzimbwttmhlvryc\",\"xrnwukfajnp\"]},{\"actions\":[\"jggkwdepem\",\"iayfiqiidxco\"],\"notActions\":[\"udyhgtrttcuayiqy\",\"nkmm\",\"zifb\",\"gqexowq\"]}],\"roleName\":\"rtgqrqkk\"},\"tags\":{\"gobot\":\"gkuobpwain\",\"zyvextchslro\":\"xiewhpnyjtuq\"},\"id\":\"owuwhd\",\"name\":\"rifiozttcbiichg\",\"type\":\"udsozodwjcfqoy\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingRoleDefinition response = manager.billingRoleDefinitions() - .getByInvoiceSectionWithResponse("mprklatwiuujxsuj", "rwgxeegxbnjnczep", "pc", "mgbf", - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("gkuobpwain", response.tags().get("gobot")); - Assertions.assertEquals("rtgqrqkk", response.properties().roleName()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByBillingAccountMockTests.java deleted file mode 100644 index a81b1ae34fc0..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByBillingAccountMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleDefinition; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleDefinitionsListByBillingAccountMockTests { - @Test - public void testListByBillingAccount() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"description\":\"wdqzuhfgt\",\"permissions\":[{\"actions\":[\"fjdccjnyuvb\",\"cuhjc\",\"jt\",\"kntomnlz\"],\"notActions\":[\"db\",\"zsbzrrxeyvidcowl\"]},{\"actions\":[\"dct\",\"xavejo\",\"zvwkryzgavplndm\",\"fiekkiskyyy\"],\"notActions\":[\"nfff\"]}],\"roleName\":\"shdawjlmlc\"},\"tags\":{\"yqyjnufzvl\":\"bjiutfofhoajjyl\",\"girrpwnqtvuxeuj\":\"quyhbceev\"},\"id\":\"ssijuaxxfd\",\"name\":\"ypkcpwsrqnn\",\"type\":\"ju\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.billingRoleDefinitions().listByBillingAccount("ssjbzv", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("bjiutfofhoajjyl", response.iterator().next().tags().get("yqyjnufzvl")); - Assertions.assertEquals("shdawjlmlc", response.iterator().next().properties().roleName()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByBillingProfileMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByBillingProfileMockTests.java deleted file mode 100644 index 9c13c7629f92..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByBillingProfileMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleDefinition; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleDefinitionsListByBillingProfileMockTests { - @Test - public void testListByBillingProfile() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"description\":\"chvvoyiogbntnwz\",\"permissions\":[{\"actions\":[\"owxcsmxtl\",\"a\",\"pnvcebsp\",\"iryomhkdwuwedupb\"],\"notActions\":[\"kwh\"]},{\"actions\":[\"qwhaefefvvkxdbnm\"],\"notActions\":[\"qycdz\"]},{\"actions\":[\"uesdyvfx\",\"z\"],\"notActions\":[\"fupktw\"]},{\"actions\":[\"segivytabvbbk\"],\"notActions\":[\"wgsltutbuve\"]}],\"roleName\":\"wuuqbmenxcqsxwc\"},\"tags\":{\"kbnjrevmptede\":\"crude\",\"thshnfiyg\":\"e\",\"glaqlmi\":\"gpkkhpj\",\"pxi\":\"nmtrd\"},\"id\":\"gecpvfpnr\",\"name\":\"i\",\"type\":\"voxloeohyfi\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingRoleDefinitions() - .listByBillingProfile("lzbki", "mjfgoxedrmra", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("crude", response.iterator().next().tags().get("kbnjrevmptede")); - Assertions.assertEquals("wuuqbmenxcqsxwc", response.iterator().next().properties().roleName()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByCustomerMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByCustomerMockTests.java deleted file mode 100644 index 23289eae6f27..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByCustomerMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleDefinition; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleDefinitionsListByCustomerMockTests { - @Test - public void testListByCustomer() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"description\":\"nijhwcbrds\",\"permissions\":[{\"actions\":[\"pkbvzpkodngvnq\",\"jgsbtwgnld\"],\"notActions\":[\"zlhvbqycz\"]}],\"roleName\":\"rirpi\"},\"tags\":{\"ucqsdgbxcwtvmij\":\"cqoqkq\",\"aih\":\"cpkkjlamyvwprj\"},\"id\":\"nlbhxjppcbqetfz\",\"name\":\"ppvolzayjw\",\"type\":\"unj\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingRoleDefinitions() - .listByCustomer("ack", "tlwgebylp", "jeldaqwju", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("cqoqkq", response.iterator().next().tags().get("ucqsdgbxcwtvmij")); - Assertions.assertEquals("rirpi", response.iterator().next().properties().roleName()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByDepartmentMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByDepartmentMockTests.java deleted file mode 100644 index f4000d7bde30..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByDepartmentMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleDefinition; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleDefinitionsListByDepartmentMockTests { - @Test - public void testListByDepartment() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"description\":\"npbsotmynklnm\",\"permissions\":[{\"actions\":[\"vrkkfcwxizkstxne\",\"keipxutc\",\"vriuvnfazxtvs\",\"yyaeiivj\"],\"notActions\":[\"tjwrvewojo\",\"fxqetxtdqiuspgu\",\"l\"]},{\"actions\":[\"jijzqjhljsazm\",\"sisfqqhcmec\",\"gsbfeiirpnjy\",\"llfkchhgs\"],\"notActions\":[\"zcajlwmqc\",\"cabaam\"]},{\"actions\":[\"dhpmkxdujkxpuqzd\",\"oqywsuarpzhryh\",\"zx\",\"zdsyxb\"],\"notActions\":[\"lbuaz\"]},{\"actions\":[\"u\"],\"notActions\":[\"vkdf\",\"jsk\"]}],\"roleName\":\"rb\"},\"tags\":{\"tv\":\"pi\"},\"id\":\"i\",\"name\":\"dqbvx\",\"type\":\"tolpwbopvhcbt\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingRoleDefinitions() - .listByDepartment("vorlfqmljewyn", "fvvcwvurkmjufa", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("pi", response.iterator().next().tags().get("tv")); - Assertions.assertEquals("rb", response.iterator().next().properties().roleName()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByEnrollmentAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByEnrollmentAccountMockTests.java deleted file mode 100644 index 8eaaea81274c..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByEnrollmentAccountMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleDefinition; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleDefinitionsListByEnrollmentAccountMockTests { - @Test - public void testListByEnrollmentAccount() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"description\":\"rotpyabensjflw\",\"permissions\":[{\"actions\":[\"qtmvi\",\"gcvsimalbm\",\"icxgosnx\"],\"notActions\":[\"tcdf\"]},{\"actions\":[\"aox\",\"hmvjcnnlsb\",\"ucqxhpaqoqb\"],\"notActions\":[\"oyso\",\"ovlznklel\",\"kqdl\",\"qhntqrykkxa\"]},{\"actions\":[\"uptiicgvpzgyxcc\",\"pxiema\"],\"notActions\":[\"tjekxsnnb\",\"ysgkt\",\"mocnqbbl\",\"tbofzghfuifw\"]},{\"actions\":[\"ynohocqxug\",\"xugdcrrfb\",\"lv\",\"mhurosdjlzbdmddg\"],\"notActions\":[\"uyaorservpv\",\"sorsbegcl\",\"ex\"]}],\"roleName\":\"fjqzyhzydyvtuq\"},\"tags\":{\"igtvjxsocsvjekej\":\"lunssky\"},\"id\":\"xzjdcwuzsc\",\"name\":\"fyixe\",\"type\":\"masjnfgngxa\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingRoleDefinitions() - .listByEnrollmentAccount("xvfybxmmr", "nuvqkrrsguog", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("lunssky", response.iterator().next().tags().get("igtvjxsocsvjekej")); - Assertions.assertEquals("fjqzyhzydyvtuq", response.iterator().next().properties().roleName()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByInvoiceSectionMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByInvoiceSectionMockTests.java deleted file mode 100644 index f8db4563ebd5..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingRoleDefinitionsListByInvoiceSectionMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingRoleDefinition; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingRoleDefinitionsListByInvoiceSectionMockTests { - @Test - public void testListByInvoiceSection() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"description\":\"qadfgesv\",\"permissions\":[{\"actions\":[\"bri\",\"madjrsbga\",\"ljqovqmxqsxo\"],\"notActions\":[\"nkiu\",\"kgltsxooiobhieb\"]}],\"roleName\":\"u\"},\"tags\":{\"rgh\":\"srvqzgaqsosrnjlv\",\"nhqkgebzqz\":\"huoxrqhjninpesw\"},\"id\":\"sviujojzd\",\"name\":\"m\",\"type\":\"naosxsxoxvimd\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingRoleDefinitions() - .listByInvoiceSection("ryqycymzrlcfgdwz", "uzfdh", "adnyciwzki", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("srvqzgaqsosrnjlv", response.iterator().next().tags().get("rgh")); - Assertions.assertEquals("u", response.iterator().next().properties().roleName()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionAliasInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionAliasInnerTests.java deleted file mode 100644 index 17254b852734..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionAliasInnerTests.java +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.BillingSubscriptionAliasInner; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.Beneficiary; -import com.azure.resourcemanager.billing.models.SystemOverrides; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class BillingSubscriptionAliasInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingSubscriptionAliasInner model = BinaryData.fromString( - "{\"properties\":{\"billingSubscriptionId\":\"itgueiookjbs\",\"autoRenew\":\"On\",\"beneficiaryTenantId\":\"dt\",\"beneficiary\":{\"tenantId\":\"lq\",\"objectId\":\"slmot\"},\"billingFrequency\":\"bnfxofvc\",\"billingProfileId\":\"gdirazf\",\"billingPolicies\":{\"jtmvc\":\"jwabmd\",\"kyqltqsrogt\":\"pexcmjurbuhh\",\"ysidfvclgl\":\"wkffdjkt\",\"uijtkbu\":\"n\"},\"billingProfileDisplayName\":\"ogsf\",\"billingProfileName\":\"ayiansharujtji\",\"consumptionCostCenter\":\"fzyjqt\",\"customerId\":\"wkpqhjpenuygbq\",\"customerDisplayName\":\"qekewvnqvcd\",\"customerName\":\"uaucmf\",\"displayName\":\"wnlaxpu\",\"enrollmentAccountId\":\"qikczvvita\",\"enrollmentAccountDisplayName\":\"xmfcsserxhtv\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-08-20T21:03:29Z\",\"subscriptionEnrollmentAccountStatus\":\"Inactive\"},\"invoiceSectionId\":\"tsjgqrsx\",\"invoiceSectionDisplayName\":\"ruuuybnch\",\"invoiceSectionName\":\"zizoyuely\",\"lastMonthCharges\":{\"currency\":\"dnb\",\"value\":69.42177},\"monthToDateCharges\":{\"currency\":\"agfl\",\"value\":10.99121},\"nextBillingCycleDetails\":{\"billingFrequency\":\"rwahzjmucftbyr\"},\"offerId\":\"rohkpigqfusu\",\"productCategory\":\"zmkw\",\"productType\":\"snoxaxmqeqa\",\"productTypeId\":\"hjnhgwydyynfsvk\",\"purchaseDate\":\"2020-12-23T07:31:38Z\",\"quantity\":4003660705799176769,\"reseller\":{\"resellerId\":\"arfdlpukhpyrnei\",\"description\":\"cpeogkhnmgbrou\"},\"renewalTermDetails\":{\"billingFrequency\":\"bhfhpfpazjzoy\",\"productId\":\"xhpdulontacnpqwt\",\"productTypeId\":\"tuevrh\",\"skuId\":\"jyoogwxh\",\"termDuration\":\"duugwbsre\",\"quantity\":2143153475020717086,\"termEndDate\":\"2021-09-27T14:55:54Z\"},\"skuId\":\"arenlvhhtklnvnaf\",\"skuDescription\":\"kyfede\",\"systemOverrides\":{\"cancellation\":\"NotAllowed\",\"cancellationAllowedEndDate\":\"2021-06-23T11:56:40Z\"},\"resourceUri\":\"qxypokkhminq\",\"termDuration\":\"mczngn\",\"termStartDate\":\"2021-04-29T07:37:31Z\",\"termEndDate\":\"2021-05-11T16:57:57Z\",\"provisioningTenantId\":\"unin\",\"status\":\"Suspended\",\"operationStatus\":\"None\",\"provisioningState\":\"Failed\",\"subscriptionId\":\"dtvqe\",\"suspensionReasons\":[\"ct\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-01-26T21:13:49Z\",\"reason\":\"Cancelled\"},{\"effectiveDate\":\"2021-09-23T09:20Z\",\"reason\":\"PolicyViolation\"},{\"effectiveDate\":\"2021-07-14T00:50:04Z\",\"reason\":\"Cancelled\"},{\"effectiveDate\":\"2021-05-03T13:15:01Z\",\"reason\":\"None\"}]},\"tags\":{\"ytprwnwvroev\":\"pxbannovvoxc\",\"rrrouuxvnsa\":\"tlyo\",\"lobdxna\":\"bcrymodizrx\",\"op\":\"pmkmlmvevfx\"},\"id\":\"bzxliohrdddtfgxq\",\"name\":\"awpcbbnzqcykn\",\"type\":\"p\"}") - .toObject(BillingSubscriptionAliasInner.class); - Assertions.assertEquals("pxbannovvoxc", model.tags().get("ytprwnwvroev")); - Assertions.assertEquals(AutoRenew.ON, model.autoRenew()); - Assertions.assertEquals("dt", model.beneficiaryTenantId()); - Assertions.assertEquals("lq", model.beneficiary().tenantId()); - Assertions.assertEquals("slmot", model.beneficiary().objectId()); - Assertions.assertEquals("bnfxofvc", model.billingFrequency()); - Assertions.assertEquals("gdirazf", model.billingProfileId()); - Assertions.assertEquals("fzyjqt", model.consumptionCostCenter()); - Assertions.assertEquals("wkpqhjpenuygbq", model.customerId()); - Assertions.assertEquals("wnlaxpu", model.displayName()); - Assertions.assertEquals("tsjgqrsx", model.invoiceSectionId()); - Assertions.assertEquals("hjnhgwydyynfsvk", model.productTypeId()); - Assertions.assertEquals(4003660705799176769L, model.quantity()); - Assertions.assertEquals("arenlvhhtklnvnaf", model.skuId()); - Assertions.assertEquals("mczngn", model.termDuration()); - Assertions.assertEquals("unin", model.provisioningTenantId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingSubscriptionAliasInner model = new BillingSubscriptionAliasInner() - .withTags(mapOf("ytprwnwvroev", "pxbannovvoxc", "rrrouuxvnsa", "tlyo", "lobdxna", "bcrymodizrx", "op", - "pmkmlmvevfx")) - .withAutoRenew(AutoRenew.ON) - .withBeneficiaryTenantId("dt") - .withBeneficiary(new Beneficiary().withTenantId("lq").withObjectId("slmot")) - .withBillingFrequency("bnfxofvc") - .withBillingProfileId("gdirazf") - .withConsumptionCostCenter("fzyjqt") - .withCustomerId("wkpqhjpenuygbq") - .withDisplayName("wnlaxpu") - .withInvoiceSectionId("tsjgqrsx") - .withProductTypeId("hjnhgwydyynfsvk") - .withQuantity(4003660705799176769L) - .withSkuId("arenlvhhtklnvnaf") - .withSystemOverrides(new SystemOverrides()) - .withTermDuration("mczngn") - .withProvisioningTenantId("unin"); - model = BinaryData.fromObject(model).toObject(BillingSubscriptionAliasInner.class); - Assertions.assertEquals("pxbannovvoxc", model.tags().get("ytprwnwvroev")); - Assertions.assertEquals(AutoRenew.ON, model.autoRenew()); - Assertions.assertEquals("dt", model.beneficiaryTenantId()); - Assertions.assertEquals("lq", model.beneficiary().tenantId()); - Assertions.assertEquals("slmot", model.beneficiary().objectId()); - Assertions.assertEquals("bnfxofvc", model.billingFrequency()); - Assertions.assertEquals("gdirazf", model.billingProfileId()); - Assertions.assertEquals("fzyjqt", model.consumptionCostCenter()); - Assertions.assertEquals("wkpqhjpenuygbq", model.customerId()); - Assertions.assertEquals("wnlaxpu", model.displayName()); - Assertions.assertEquals("tsjgqrsx", model.invoiceSectionId()); - Assertions.assertEquals("hjnhgwydyynfsvk", model.productTypeId()); - Assertions.assertEquals(4003660705799176769L, model.quantity()); - Assertions.assertEquals("arenlvhhtklnvnaf", model.skuId()); - Assertions.assertEquals("mczngn", model.termDuration()); - Assertions.assertEquals("unin", model.provisioningTenantId()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionAliasListResultTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionAliasListResultTests.java deleted file mode 100644 index 932a41222d86..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionAliasListResultTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.BillingSubscriptionAliasListResult; - -public final class BillingSubscriptionAliasListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingSubscriptionAliasListResult model = BinaryData.fromString( - "{\"nextLink\":\"tmvag\",\"value\":[{\"properties\":{\"billingSubscriptionId\":\"lvhukoveofi\",\"autoRenew\":\"Off\",\"beneficiaryTenantId\":\"f\",\"beneficiary\":{\"tenantId\":\"mvl\",\"objectId\":\"z\"},\"billingFrequency\":\"blkujrllfojuidjp\",\"billingProfileId\":\"yjucejikzoeo\",\"billingPolicies\":{\"kl\":\"zejet\",\"zkdbqzolx\":\"tikyj\",\"pcrrk\":\"zvhqjwtrhtgvg\"},\"billingProfileDisplayName\":\"awjmjsmw\",\"billingProfileName\":\"kcdxfzzzw\",\"consumptionCostCenter\":\"afitlhguynuchlg\",\"customerId\":\"txd\",\"customerDisplayName\":\"mozusgzvlnsnnjz\",\"customerName\":\"afolpymwamxqzrag\",\"displayName\":\"dphtv\",\"enrollmentAccountId\":\"lajv\",\"enrollmentAccountDisplayName\":\"jchcsrlzknmzla\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-05-03T02:08:16Z\",\"subscriptionEnrollmentAccountStatus\":\"Transferring\"},\"invoiceSectionId\":\"nphcnzqtpjhmqrh\",\"invoiceSectionDisplayName\":\"hlaiwd\",\"invoiceSectionName\":\"smlzzhzdtxetlgy\",\"lastMonthCharges\":{\"currency\":\"qvlnnpxybafiqgea\",\"value\":17.60094},\"monthToDateCharges\":{\"currency\":\"ekglklb\",\"value\":85.27072},\"nextBillingCycleDetails\":{\"billingFrequency\":\"wcwvmzeg\"},\"offerId\":\"nfhjirwgdnqzbr\",\"productCategory\":\"spzhzmtksjc\",\"productType\":\"digsxcdgl\",\"productTypeId\":\"lkeuac\",\"purchaseDate\":\"2021-10-16T02:04:21Z\",\"quantity\":3217232205937864406,\"reseller\":{\"resellerId\":\"tswfpfmdgycxnms\",\"description\":\"hqjjys\"},\"renewalTermDetails\":{\"billingFrequency\":\"lpshhkvpedwqslsr\",\"productId\":\"pq\",\"productTypeId\":\"wskondcbrwimuvqe\",\"skuId\":\"so\",\"termDuration\":\"rrleaesinuqt\",\"quantity\":3885521112521015664,\"termEndDate\":\"2021-01-31T13:57:23Z\"},\"skuId\":\"ihehcecybmr\",\"skuDescription\":\"rjb\",\"systemOverrides\":{\"cancellation\":\"Allowed\",\"cancellationAllowedEndDate\":\"2021-07-05T16:46:55Z\"},\"resourceUri\":\"yk\",\"termDuration\":\"e\",\"termStartDate\":\"2021-08-14T13:18:26Z\",\"termEndDate\":\"2021-09-11T02:43:54Z\",\"provisioningTenantId\":\"wjksghudgzhxo\",\"status\":\"Warned\",\"operationStatus\":\"Other\",\"provisioningState\":\"ConfirmedBilling\",\"subscriptionId\":\"jkxibda\",\"suspensionReasons\":[\"kmdyomkxfbvfbh\",\"y\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-05-09T03:01:33Z\",\"reason\":\"Other\"},{\"effectiveDate\":\"2020-12-29T06:15:11Z\",\"reason\":\"PastDue\"},{\"effectiveDate\":\"2021-02-13T20:03Z\",\"reason\":\"SuspiciousActivity\"},{\"effectiveDate\":\"2021-08-06T21:59:54Z\",\"reason\":\"None\"}]},\"tags\":{\"sqowxwc\":\"muikjcjcaztbws\"},\"id\":\"likytwvczcswka\",\"name\":\"ve\",\"type\":\"yfdvlvhbwrnfxtgd\"},{\"properties\":{\"billingSubscriptionId\":\"th\",\"autoRenew\":\"Off\",\"beneficiaryTenantId\":\"naoyank\",\"beneficiary\":{\"tenantId\":\"qswankltytmhdr\",\"objectId\":\"nnhdrl\"},\"billingFrequency\":\"gjc\",\"billingProfileId\":\"guxhem\",\"billingPolicies\":{\"kklelssxblycs\":\"waeeczgfb\",\"plpvm\":\"zujksrlsmdes\",\"eowxvgpi\":\"cdoewbidyv\"},\"billingProfileDisplayName\":\"eu\",\"billingProfileName\":\"sxze\",\"consumptionCostCenter\":\"axwk\",\"customerId\":\"ykhv\",\"customerDisplayName\":\"xepmrut\",\"customerName\":\"abaobnslujdjltym\",\"displayName\":\"vguihywar\",\"enrollmentAccountId\":\"pphkixkykxds\",\"enrollmentAccountDisplayName\":\"pemmucfxhik\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-02-23T06:24:01Z\",\"subscriptionEnrollmentAccountStatus\":\"Transferring\"},\"invoiceSectionId\":\"yincql\",\"invoiceSectionDisplayName\":\"isws\",\"invoiceSectionName\":\"iiiovgqcgxuugq\",\"lastMonthCharges\":{\"currency\":\"otiowlxteqd\",\"value\":79.20618},\"monthToDateCharges\":{\"currency\":\"dtguk\",\"value\":66.172806},\"nextBillingCycleDetails\":{\"billingFrequency\":\"wphqlkccuzgygqw\"},\"offerId\":\"oiulwgniipr\",\"productCategory\":\"vawuwzdufypivlsb\",\"productType\":\"pmcubkmifoxxkub\",\"productTypeId\":\"havpmhbrbqgvg\",\"purchaseDate\":\"2021-03-12T02:37:11Z\",\"quantity\":2390534892352446675,\"reseller\":{\"resellerId\":\"fjoknss\",\"description\":\"zqedikdfrdbi\"},\"renewalTermDetails\":{\"billingFrequency\":\"jgeihfqlggwfi\",\"productId\":\"cxmjpbyephmg\",\"productTypeId\":\"ljvrcmyfqipgxhnp\",\"skuId\":\"yqwcabvnuil\",\"termDuration\":\"yaswlpaugmr\",\"quantity\":5199634258686534022,\"termEndDate\":\"2021-10-06T08:33:17Z\"},\"skuId\":\"toaukhfkvcisiz\",\"skuDescription\":\"a\",\"systemOverrides\":{\"cancellation\":\"NotAllowed\",\"cancellationAllowedEndDate\":\"2021-01-30T15:33:29Z\"},\"resourceUri\":\"ive\",\"termDuration\":\"cgyee\",\"termStartDate\":\"2021-12-07T03:54:13Z\",\"termEndDate\":\"2021-02-21T23:17:20Z\",\"provisioningTenantId\":\"psmgo\",\"status\":\"Suspended\",\"operationStatus\":\"LockedForUpdate\",\"provisioningState\":\"Pending\",\"subscriptionId\":\"l\",\"suspensionReasons\":[\"splzga\",\"fcshh\",\"new\",\"nxkympqanxrjk\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-08-29T10:54:16Z\",\"reason\":\"Other\"}]},\"tags\":{\"xcy\":\"pnyghs\",\"pxycphdr\":\"hkgmnsg\",\"vxnqmhrpqpd\":\"jjkhvyomaclu\"},\"id\":\"mkoisqcssf\",\"name\":\"xuifmcsypobkdqz\",\"type\":\"dzsylollgtrczz\"}]}") - .toObject(BillingSubscriptionAliasListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingSubscriptionAliasListResult model = new BillingSubscriptionAliasListResult(); - model = BinaryData.fromObject(model).toObject(BillingSubscriptionAliasListResult.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionAliasPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionAliasPropertiesTests.java deleted file mode 100644 index 02edc22deb74..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionAliasPropertiesTests.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.BillingSubscriptionAliasProperties; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.Beneficiary; -import com.azure.resourcemanager.billing.models.SystemOverrides; -import org.junit.jupiter.api.Assertions; - -public final class BillingSubscriptionAliasPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingSubscriptionAliasProperties model = BinaryData.fromString( - "{\"billingSubscriptionId\":\"fyuicdh\",\"autoRenew\":\"Off\",\"beneficiaryTenantId\":\"bwwg\",\"beneficiary\":{\"tenantId\":\"ibidmhmwffp\",\"objectId\":\"muvapc\"},\"billingFrequency\":\"crrvweyo\",\"billingProfileId\":\"yyukphaimmo\",\"billingPolicies\":{\"apyyrmfsvbpavbo\":\"qboshbra\",\"gahxkumasjcaa\":\"fppdbwnu\",\"ehqepvufhbzehe\":\"fdmmcpug\",\"qnbldxe\":\"hoqhnl\"},\"billingProfileDisplayName\":\"lgsc\",\"billingProfileName\":\"ri\",\"consumptionCostCenter\":\"rsrrmoucsofldp\",\"customerId\":\"iyfc\",\"customerDisplayName\":\"beolh\",\"customerName\":\"lvbmxuqibsxtkcu\",\"displayName\":\"b\",\"enrollmentAccountId\":\"arfsi\",\"enrollmentAccountDisplayName\":\"lkjxnqpvwgf\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-11-10T23:28Z\",\"subscriptionEnrollmentAccountStatus\":\"Transferring\"},\"invoiceSectionId\":\"izmdksa\",\"invoiceSectionDisplayName\":\"fcluqvo\",\"invoiceSectionName\":\"ycjimryvwgcwwpbm\",\"lastMonthCharges\":{\"currency\":\"esyds\",\"value\":22.182518},\"monthToDateCharges\":{\"currency\":\"hecbvopwndyq\",\"value\":75.53279},\"nextBillingCycleDetails\":{\"billingFrequency\":\"klmtkhlowkx\"},\"offerId\":\"vbrdfjmzsyzfho\",\"productCategory\":\"h\",\"productType\":\"cyychunsjlp\",\"productTypeId\":\"twszhvvuic\",\"purchaseDate\":\"2021-07-19T03:46:29Z\",\"quantity\":2070519183658188671,\"reseller\":{\"resellerId\":\"wrbfdpyflubh\",\"description\":\"glrocuy\"},\"renewalTermDetails\":{\"billingFrequency\":\"hhmemhooclutnp\",\"productId\":\"emc\",\"productTypeId\":\"kmmykyujxsglh\",\"skuId\":\"rryejylmbkzudnig\",\"termDuration\":\"ihotjewlpxuzzjg\",\"quantity\":8597599731989058716,\"termEndDate\":\"2021-03-12T11:11:22Z\"},\"skuId\":\"qotoihiqakydiwfb\",\"skuDescription\":\"wpzdqtvhcspo\",\"systemOverrides\":{\"cancellation\":\"Allowed\",\"cancellationAllowedEndDate\":\"2021-07-16T23:29:41Z\"},\"resourceUri\":\"pie\",\"termDuration\":\"bebjfu\",\"termStartDate\":\"2021-09-18T23:08:53Z\",\"termEndDate\":\"2021-02-08T00:52:50Z\",\"provisioningTenantId\":\"h\",\"status\":\"Cancelled\",\"operationStatus\":\"None\",\"provisioningState\":\"Created\",\"subscriptionId\":\"nt\",\"suspensionReasons\":[\"tzviqsowsaaelcat\",\"cjuhplrvkm\",\"cwmjvlg\",\"ggcvk\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-03-03T13:43:34Z\",\"reason\":\"PolicyViolation\"},{\"effectiveDate\":\"2021-07-07T04:53:59Z\",\"reason\":\"Expired\"},{\"effectiveDate\":\"2021-12-07T09:17:17Z\",\"reason\":\"PastDue\"},{\"effectiveDate\":\"2021-08-28T04:28Z\",\"reason\":\"PastDue\"}]}") - .toObject(BillingSubscriptionAliasProperties.class); - Assertions.assertEquals(AutoRenew.OFF, model.autoRenew()); - Assertions.assertEquals("bwwg", model.beneficiaryTenantId()); - Assertions.assertEquals("ibidmhmwffp", model.beneficiary().tenantId()); - Assertions.assertEquals("muvapc", model.beneficiary().objectId()); - Assertions.assertEquals("crrvweyo", model.billingFrequency()); - Assertions.assertEquals("yyukphaimmo", model.billingProfileId()); - Assertions.assertEquals("rsrrmoucsofldp", model.consumptionCostCenter()); - Assertions.assertEquals("iyfc", model.customerId()); - Assertions.assertEquals("b", model.displayName()); - Assertions.assertEquals("izmdksa", model.invoiceSectionId()); - Assertions.assertEquals("twszhvvuic", model.productTypeId()); - Assertions.assertEquals(2070519183658188671L, model.quantity()); - Assertions.assertEquals("qotoihiqakydiwfb", model.skuId()); - Assertions.assertEquals("bebjfu", model.termDuration()); - Assertions.assertEquals("h", model.provisioningTenantId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingSubscriptionAliasProperties model = new BillingSubscriptionAliasProperties().withAutoRenew(AutoRenew.OFF) - .withBeneficiaryTenantId("bwwg") - .withBeneficiary(new Beneficiary().withTenantId("ibidmhmwffp").withObjectId("muvapc")) - .withBillingFrequency("crrvweyo") - .withBillingProfileId("yyukphaimmo") - .withConsumptionCostCenter("rsrrmoucsofldp") - .withCustomerId("iyfc") - .withDisplayName("b") - .withInvoiceSectionId("izmdksa") - .withProductTypeId("twszhvvuic") - .withQuantity(2070519183658188671L) - .withSkuId("qotoihiqakydiwfb") - .withSystemOverrides(new SystemOverrides()) - .withTermDuration("bebjfu") - .withProvisioningTenantId("h"); - model = BinaryData.fromObject(model).toObject(BillingSubscriptionAliasProperties.class); - Assertions.assertEquals(AutoRenew.OFF, model.autoRenew()); - Assertions.assertEquals("bwwg", model.beneficiaryTenantId()); - Assertions.assertEquals("ibidmhmwffp", model.beneficiary().tenantId()); - Assertions.assertEquals("muvapc", model.beneficiary().objectId()); - Assertions.assertEquals("crrvweyo", model.billingFrequency()); - Assertions.assertEquals("yyukphaimmo", model.billingProfileId()); - Assertions.assertEquals("rsrrmoucsofldp", model.consumptionCostCenter()); - Assertions.assertEquals("iyfc", model.customerId()); - Assertions.assertEquals("b", model.displayName()); - Assertions.assertEquals("izmdksa", model.invoiceSectionId()); - Assertions.assertEquals("twszhvvuic", model.productTypeId()); - Assertions.assertEquals(2070519183658188671L, model.quantity()); - Assertions.assertEquals("qotoihiqakydiwfb", model.skuId()); - Assertions.assertEquals("bebjfu", model.termDuration()); - Assertions.assertEquals("h", model.provisioningTenantId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionInnerTests.java deleted file mode 100644 index 8f12ee9edf62..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionInnerTests.java +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.BillingSubscriptionInner; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.Beneficiary; -import com.azure.resourcemanager.billing.models.SystemOverrides; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class BillingSubscriptionInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingSubscriptionInner model = BinaryData.fromString( - "{\"properties\":{\"autoRenew\":\"On\",\"beneficiaryTenantId\":\"ecj\",\"beneficiary\":{\"tenantId\":\"slstvasy\",\"objectId\":\"xdza\"},\"billingFrequency\":\"weoohguufuzboyj\",\"billingProfileId\":\"hwtzolb\",\"billingPolicies\":{\"xmeb\":\"wm\",\"veabfqxnmwmqtib\":\"jscjpahl\",\"jaeukmrsieekpn\":\"yijddtvqcttad\",\"pibudqwyxebeybpm\":\"zaapmudqmeqwi\"},\"billingProfileDisplayName\":\"nrtffyaqi\",\"billingProfileName\":\"hheioqaqhvseuf\",\"consumptionCostCenter\":\"yrxpdlcgqls\",\"customerId\":\"mjqfrddgamquhio\",\"customerDisplayName\":\"sjuivfcdisyir\",\"customerName\":\"zhczexrxzbujrtrh\",\"displayName\":\"wrevkhgnlnzon\",\"enrollmentAccountId\":\"rpiqywncv\",\"enrollmentAccountDisplayName\":\"szcofizeht\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-05-18T17:24:34Z\",\"subscriptionEnrollmentAccountStatus\":\"TransferredOut\"},\"invoiceSectionId\":\"reljeamur\",\"invoiceSectionDisplayName\":\"mlovuanashcxl\",\"invoiceSectionName\":\"jerbdkelvidizozs\",\"lastMonthCharges\":{\"currency\":\"cxjmonfdgnwncyp\",\"value\":0.45065284},\"monthToDateCharges\":{\"currency\":\"tvuqjctzenkeifzz\",\"value\":98.14635},\"nextBillingCycleDetails\":{\"billingFrequency\":\"svflyhbxcudch\"},\"offerId\":\"srboldforobw\",\"productCategory\":\"vizbfhfo\",\"productType\":\"acqpbtuodxesza\",\"productTypeId\":\"elawumu\",\"purchaseDate\":\"2021-04-03T06:57:50Z\",\"quantity\":5864829114525781017,\"reseller\":{\"resellerId\":\"woycqucwyha\",\"description\":\"omd\"},\"renewalTermDetails\":{\"billingFrequency\":\"wuhpsvfuur\",\"productId\":\"lwexxwl\",\"productTypeId\":\"niexzsrzpgepq\",\"skuId\":\"bb\",\"termDuration\":\"pgdakchzyvli\",\"quantity\":7764041210336820295,\"termEndDate\":\"2021-03-27T20:06:12Z\"},\"skuId\":\"kjibnxmysuxswqrn\",\"skuDescription\":\"lwi\",\"systemOverrides\":{\"cancellation\":\"Allowed\",\"cancellationAllowedEndDate\":\"2021-02-24T02:17:19Z\"},\"resourceUri\":\"oqq\",\"termDuration\":\"cyyufmh\",\"termStartDate\":\"2021-04-21T16:04:02Z\",\"termEndDate\":\"2021-03-08T03:10:04Z\",\"provisioningTenantId\":\"mqspkcdqzhlctdd\",\"status\":\"Cancelled\",\"operationStatus\":\"Other\",\"provisioningState\":\"ConfirmedBilling\",\"subscriptionId\":\"chrqb\",\"suspensionReasons\":[\"rcgegydcwboxjum\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-10-07T14:13:44Z\",\"reason\":\"Transferred\"}]},\"tags\":{\"oq\":\"aiouaubrjt\",\"rzpasccbiuimzdly\":\"fuojrngif\",\"fdvruz\":\"dfqwmkyoq\"},\"id\":\"zojhpctfnmd\",\"name\":\"otngfdgu\",\"type\":\"eyzihgrky\"}") - .toObject(BillingSubscriptionInner.class); - Assertions.assertEquals("aiouaubrjt", model.tags().get("oq")); - Assertions.assertEquals(AutoRenew.ON, model.autoRenew()); - Assertions.assertEquals("ecj", model.beneficiaryTenantId()); - Assertions.assertEquals("slstvasy", model.beneficiary().tenantId()); - Assertions.assertEquals("xdza", model.beneficiary().objectId()); - Assertions.assertEquals("weoohguufuzboyj", model.billingFrequency()); - Assertions.assertEquals("hwtzolb", model.billingProfileId()); - Assertions.assertEquals("yrxpdlcgqls", model.consumptionCostCenter()); - Assertions.assertEquals("mjqfrddgamquhio", model.customerId()); - Assertions.assertEquals("wrevkhgnlnzon", model.displayName()); - Assertions.assertEquals("reljeamur", model.invoiceSectionId()); - Assertions.assertEquals("elawumu", model.productTypeId()); - Assertions.assertEquals(5864829114525781017L, model.quantity()); - Assertions.assertEquals("kjibnxmysuxswqrn", model.skuId()); - Assertions.assertEquals("cyyufmh", model.termDuration()); - Assertions.assertEquals("mqspkcdqzhlctdd", model.provisioningTenantId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingSubscriptionInner model = new BillingSubscriptionInner() - .withTags(mapOf("oq", "aiouaubrjt", "rzpasccbiuimzdly", "fuojrngif", "fdvruz", "dfqwmkyoq")) - .withAutoRenew(AutoRenew.ON) - .withBeneficiaryTenantId("ecj") - .withBeneficiary(new Beneficiary().withTenantId("slstvasy").withObjectId("xdza")) - .withBillingFrequency("weoohguufuzboyj") - .withBillingProfileId("hwtzolb") - .withConsumptionCostCenter("yrxpdlcgqls") - .withCustomerId("mjqfrddgamquhio") - .withDisplayName("wrevkhgnlnzon") - .withInvoiceSectionId("reljeamur") - .withProductTypeId("elawumu") - .withQuantity(5864829114525781017L) - .withSkuId("kjibnxmysuxswqrn") - .withSystemOverrides(new SystemOverrides()) - .withTermDuration("cyyufmh") - .withProvisioningTenantId("mqspkcdqzhlctdd"); - model = BinaryData.fromObject(model).toObject(BillingSubscriptionInner.class); - Assertions.assertEquals("aiouaubrjt", model.tags().get("oq")); - Assertions.assertEquals(AutoRenew.ON, model.autoRenew()); - Assertions.assertEquals("ecj", model.beneficiaryTenantId()); - Assertions.assertEquals("slstvasy", model.beneficiary().tenantId()); - Assertions.assertEquals("xdza", model.beneficiary().objectId()); - Assertions.assertEquals("weoohguufuzboyj", model.billingFrequency()); - Assertions.assertEquals("hwtzolb", model.billingProfileId()); - Assertions.assertEquals("yrxpdlcgqls", model.consumptionCostCenter()); - Assertions.assertEquals("mjqfrddgamquhio", model.customerId()); - Assertions.assertEquals("wrevkhgnlnzon", model.displayName()); - Assertions.assertEquals("reljeamur", model.invoiceSectionId()); - Assertions.assertEquals("elawumu", model.productTypeId()); - Assertions.assertEquals(5864829114525781017L, model.quantity()); - Assertions.assertEquals("kjibnxmysuxswqrn", model.skuId()); - Assertions.assertEquals("cyyufmh", model.termDuration()); - Assertions.assertEquals("mqspkcdqzhlctdd", model.provisioningTenantId()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionListResultTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionListResultTests.java deleted file mode 100644 index 8b3ba0898c5a..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionListResultTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.BillingSubscriptionListResult; - -public final class BillingSubscriptionListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingSubscriptionListResult model = BinaryData.fromString( - "{\"nextLink\":\"pwyawbz\",\"totalCount\":1914058756,\"value\":[{\"properties\":{\"autoRenew\":\"Off\",\"beneficiaryTenantId\":\"kyexaoguyaipi\",\"beneficiary\":{\"tenantId\":\"ault\",\"objectId\":\"jjum\"},\"billingFrequency\":\"waz\",\"billingProfileId\":\"qnmcjngzqdqx\",\"billingPolicies\":{\"zh\":\"wgnyfusfzsvtui\"},\"billingProfileDisplayName\":\"qglcfhmlrqryxynq\",\"billingProfileName\":\"rd\",\"consumptionCostCenter\":\"ovw\",\"customerId\":\"nptgoeiybba\",\"customerDisplayName\":\"fhvfsl\",\"customerName\":\"ntjlr\",\"displayName\":\"jkskyr\",\"enrollmentAccountId\":\"ovzidsx\",\"enrollmentAccountDisplayName\":\"abzmifrygznmmaxr\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-02-02T15:25:14Z\",\"subscriptionEnrollmentAccountStatus\":\"Expired\"},\"invoiceSectionId\":\"opxlhslnelxieixy\",\"invoiceSectionDisplayName\":\"lxecwcrojphslh\",\"invoiceSectionName\":\"wjutifdwfmv\",\"lastMonthCharges\":{\"currency\":\"rqjb\",\"value\":59.329094},\"monthToDateCharges\":{\"currency\":\"aglkafhon\",\"value\":41.36698},\"nextBillingCycleDetails\":{\"billingFrequency\":\"ickpz\"},\"offerId\":\"p\",\"productCategory\":\"mxelnwcltyjed\",\"productType\":\"xm\",\"productTypeId\":\"mkqscaz\",\"purchaseDate\":\"2021-02-06T07:38:24Z\",\"quantity\":6643014006817402394,\"reseller\":{\"resellerId\":\"uamwabzxrvxc\",\"description\":\"hsphaivmxyas\"},\"renewalTermDetails\":{\"billingFrequency\":\"gsgzwywakoihk\",\"productId\":\"mjblmljhlny\",\"productTypeId\":\"otqyry\",\"skuId\":\"cbm\",\"termDuration\":\"vxmvw\",\"quantity\":4116221613583683546,\"termEndDate\":\"2021-11-22T12:35:26Z\"},\"skuId\":\"nsup\",\"skuDescription\":\"jlzqnhc\",\"systemOverrides\":{\"cancellation\":\"Allowed\",\"cancellationAllowedEndDate\":\"2021-02-22T08:57:17Z\"},\"resourceUri\":\"oibgsxg\",\"termDuration\":\"fyq\",\"termStartDate\":\"2021-01-20T15:12:39Z\",\"termEndDate\":\"2021-01-30T13:57:25Z\",\"provisioningTenantId\":\"xwdofdb\",\"status\":\"Suspended\",\"operationStatus\":\"None\",\"provisioningState\":\"New\",\"subscriptionId\":\"bimhtmwwinhe\",\"suspensionReasons\":[\"pofvwb\",\"blembnkbwvqvxkd\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-06-07T23:42:50Z\",\"reason\":\"PolicyViolation\"},{\"effectiveDate\":\"2021-08-30T23:06:56Z\",\"reason\":\"None\"}]},\"tags\":{\"felisdjub\":\"uwfmduragegizvc\",\"kxkbsazgakgacyr\":\"gbqi\"},\"id\":\"jdmspofapvuhryln\",\"name\":\"ofrzgb\",\"type\":\"jed\"},{\"properties\":{\"autoRenew\":\"On\",\"beneficiaryTenantId\":\"nlvxbcuii\",\"beneficiary\":{\"tenantId\":\"twfans\",\"objectId\":\"pdibmikostbzbki\"},\"billingFrequency\":\"uqn\",\"billingProfileId\":\"phzfylsgcrp\",\"billingPolicies\":{\"zcezelfwyfwl\":\"une\",\"psihcla\":\"xjwet\",\"tcmwqkchc\":\"zvaylptrsqqw\",\"xfdeqvhpsyl\":\"waxfewzjkj\"},\"billingProfileDisplayName\":\"shk\",\"billingProfileName\":\"f\",\"consumptionCostCenter\":\"mxzjrgywwpgjx\",\"customerId\":\"ptfujgicgaaoept\",\"customerDisplayName\":\"qutdewemxs\",\"customerName\":\"ruunzzjgehkf\",\"displayName\":\"m\",\"enrollmentAccountId\":\"ixokffqyin\",\"enrollmentAccountDisplayName\":\"qepqwhixmon\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-04-12T20:53:04Z\",\"subscriptionEnrollmentAccountStatus\":\"Inactive\"},\"invoiceSectionId\":\"gvelfc\",\"invoiceSectionDisplayName\":\"uccbirdsvuw\",\"invoiceSectionName\":\"b\",\"lastMonthCharges\":{\"currency\":\"stmninwjizcilng\",\"value\":59.285152},\"monthToDateCharges\":{\"currency\":\"jjtbxqmuluxlxqz\",\"value\":17.44638},\"nextBillingCycleDetails\":{\"billingFrequency\":\"bycucrwnamikz\"},\"offerId\":\"rqbsmswziq\",\"productCategory\":\"uhok\",\"productType\":\"uswhvhczznvfbycj\",\"productTypeId\":\"jww\",\"purchaseDate\":\"2020-12-22T14:20:25Z\",\"quantity\":671480520917844064,\"reseller\":{\"resellerId\":\"xqhndvnoamlds\",\"description\":\"aohdjh\"},\"renewalTermDetails\":{\"billingFrequency\":\"z\",\"productId\":\"xcoxpelnjet\",\"productTypeId\":\"ltsxoatf\",\"skuId\":\"zpnpbswv\",\"termDuration\":\"loccsrmozihm\",\"quantity\":926180935823108880,\"termEndDate\":\"2021-05-10T18:29:24Z\"},\"skuId\":\"xp\",\"skuDescription\":\"jcxcjxgrytfmpcyc\",\"systemOverrides\":{\"cancellation\":\"NotAllowed\",\"cancellationAllowedEndDate\":\"2021-05-13T03:34:24Z\"},\"resourceUri\":\"kggnoxu\",\"termDuration\":\"rksxwpndfc\",\"termStartDate\":\"2021-07-28T14:06:49Z\",\"termEndDate\":\"2021-10-04T17:45:19Z\",\"provisioningTenantId\":\"hjtwkjaosrx\",\"status\":\"Disabled\",\"operationStatus\":\"Other\",\"provisioningState\":\"New\",\"subscriptionId\":\"cqiosmgbza\",\"suspensionReasons\":[\"qdlyrtl\",\"laprlt\",\"katbhjm\",\"nnbsoqeqa\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-09-27T21:31:23Z\",\"reason\":\"Cancelled\"},{\"effectiveDate\":\"2021-07-19T16:44:26Z\",\"reason\":\"PastDue\"},{\"effectiveDate\":\"2021-10-11T06:17:10Z\",\"reason\":\"PastDue\"},{\"effectiveDate\":\"2021-07-03T07:45:20Z\",\"reason\":\"PastDue\"}]},\"tags\":{\"av\":\"yreeudz\",\"lmjjyuo\":\"pdqmjxlyyzglgouw\"},\"id\":\"tob\",\"name\":\"xkjeytunlbfj\",\"type\":\"wrus\"},{\"properties\":{\"autoRenew\":\"Off\",\"beneficiaryTenantId\":\"syrq\",\"beneficiary\":{\"tenantId\":\"qhd\",\"objectId\":\"xaulkpakdkifmjnn\"},\"billingFrequency\":\"tqabpxuckpgg\",\"billingProfileId\":\"wey\",\"billingPolicies\":{\"lqqmpiz\":\"hlisngw\",\"saasiixtmkzj\":\"uwnpqxpxiwfcng\",\"irhgfgrwsdp\":\"kv\",\"zvzbglbyv\":\"ra\"},\"billingProfileDisplayName\":\"tctbrxkjzwrgxffm\",\"billingProfileName\":\"kwfbkgo\",\"consumptionCostCenter\":\"wopdbydpiz\",\"customerId\":\"clnapxbiygnugjkn\",\"customerDisplayName\":\"mfcttux\",\"customerName\":\"yilflqoiquvrehmr\",\"displayName\":\"hvsujztc\",\"enrollmentAccountId\":\"tqjtwhauu\",\"enrollmentAccountDisplayName\":\"prnjletlxsmr\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-04-17T08:00:01Z\",\"subscriptionEnrollmentAccountStatus\":\"Expired\"},\"invoiceSectionId\":\"amowaziynknlqwzd\",\"invoiceSectionDisplayName\":\"iwhxqszdtmaajq\",\"invoiceSectionName\":\"uxylrjvmtygjbm\",\"lastMonthCharges\":{\"currency\":\"spsp\",\"value\":0.60943365},\"monthToDateCharges\":{\"currency\":\"kyjpmspbps\",\"value\":97.769455},\"nextBillingCycleDetails\":{\"billingFrequency\":\"yogtieyujtvczkcn\"},\"offerId\":\"rxmunjdxvgln\",\"productCategory\":\"xl\",\"productType\":\"aglqivbgkcvkh\",\"productTypeId\":\"vuqd\",\"purchaseDate\":\"2021-06-25T03:03:43Z\",\"quantity\":4100191028434030983,\"reseller\":{\"resellerId\":\"fpubcpzgpxti\",\"description\":\"j\"},\"renewalTermDetails\":{\"billingFrequency\":\"dibgqjxgpnrhgov\",\"productId\":\"pikqmh\",\"productTypeId\":\"owjrmzvuporqz\",\"skuId\":\"uydzvk\",\"termDuration\":\"xcnqmxqpswokmvkh\",\"quantity\":5449936747239088069,\"termEndDate\":\"2021-08-16T11:45:45Z\"},\"skuId\":\"mzqkz\",\"skuDescription\":\"uwiwtglxxhljfpg\",\"systemOverrides\":{\"cancellation\":\"NotAllowed\",\"cancellationAllowedEndDate\":\"2020-12-23T13:55:40Z\"},\"resourceUri\":\"hr\",\"termDuration\":\"qgjsxvpqcbfrmbod\",\"termStartDate\":\"2021-06-24T02:15:33Z\",\"termEndDate\":\"2021-11-01T20:48:18Z\",\"provisioningTenantId\":\"vriibakclacjfr\",\"status\":\"Failed\",\"operationStatus\":\"None\",\"provisioningState\":\"Created\",\"subscriptionId\":\"zlwvsgmwohqfz\",\"suspensionReasons\":[\"uxmmkjsvthnwp\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-09-07T02:49:52Z\",\"reason\":\"Transferred\"}]},\"tags\":{\"c\":\"biattgplucfotan\",\"ugswvx\":\"hnykz\"},\"id\":\"mzqwmvtxnjmxmcu\",\"name\":\"udtc\",\"type\":\"clxyn\"},{\"properties\":{\"autoRenew\":\"Off\",\"beneficiaryTenantId\":\"fabuiyjibu\",\"beneficiary\":{\"tenantId\":\"dugneiknp\",\"objectId\":\"xgjiuqh\"},\"billingFrequency\":\"tozipqwj\",\"billingProfileId\":\"mur\",\"billingPolicies\":{\"wpktvqylkmqpzoyh\":\"g\"},\"billingProfileDisplayName\":\"bcg\",\"billingProfileName\":\"cloxo\",\"consumptionCostCenter\":\"qinjipnwjf\",\"customerId\":\"qlafcbahhpzpofoi\",\"customerDisplayName\":\"w\",\"customerName\":\"ilkmk\",\"displayName\":\"olvdnd\",\"enrollmentAccountId\":\"auo\",\"enrollmentAccountDisplayName\":\"huartv\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-10-24T07:11:38Z\",\"subscriptionEnrollmentAccountStatus\":\"TransferredOut\"},\"invoiceSectionId\":\"chnmna\",\"invoiceSectionDisplayName\":\"nxhkxjqi\",\"invoiceSectionName\":\"rweooxffifhx\",\"lastMonthCharges\":{\"currency\":\"newmozqvb\",\"value\":85.557686},\"monthToDateCharges\":{\"currency\":\"m\",\"value\":73.054},\"nextBillingCycleDetails\":{\"billingFrequency\":\"hxzga\"},\"offerId\":\"taboidvmf\",\"productCategory\":\"ppu\",\"productType\":\"w\",\"productTypeId\":\"pdfgkmtdherngbt\",\"purchaseDate\":\"2021-04-08T02:20:27Z\",\"quantity\":3488994264957021355,\"reseller\":{\"resellerId\":\"tobkauxofshfph\",\"description\":\"nulaiywzejywhsl\"},\"renewalTermDetails\":{\"billingFrequency\":\"jpllndnpdwrpq\",\"productId\":\"gfugsnnfhyet\",\"productTypeId\":\"ypococtfjgtixr\",\"skuId\":\"zuyt\",\"termDuration\":\"mlmuowol\",\"quantity\":2338140268331229797,\"termEndDate\":\"2021-02-22T00:26:13Z\"},\"skuId\":\"ionszonwp\",\"skuDescription\":\"ajinnixjawrtmjfj\",\"systemOverrides\":{\"cancellation\":\"Allowed\",\"cancellationAllowedEndDate\":\"2021-06-25T01:17:09Z\"},\"resourceUri\":\"hcoxov\",\"termDuration\":\"khenlus\",\"termStartDate\":\"2021-09-11T05:10:01Z\",\"termEndDate\":\"2021-06-11T07:28:09Z\",\"provisioningTenantId\":\"xtxrdcqtjvidt\",\"status\":\"AutoRenew\",\"operationStatus\":\"LockedForUpdate\",\"provisioningState\":\"ConfirmedBilling\",\"subscriptionId\":\"yjtcvuwk\",\"suspensionReasons\":[\"zies\",\"uughtuqfecjxeyg\",\"uhxu\",\"cbuewmrswnjlxuz\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-04-25T15:22:17Z\",\"reason\":\"SuspiciousActivity\"},{\"effectiveDate\":\"2021-04-16T18:16:03Z\",\"reason\":\"PolicyViolation\"},{\"effectiveDate\":\"2021-08-22T09:51:36Z\",\"reason\":\"SpendingLimitReached\"}]},\"tags\":{\"xncnwfe\":\"hzjqatucoige\",\"cgbjbgdlfgt\":\"bnwgfmxj\",\"naquflq\":\"y\",\"zeqyjleziun\":\"ctqhamzjrwdk\"},\"id\":\"dfzantkwcegy\",\"name\":\"mlbnseq\",\"type\":\"cjjvpilguooqja\"}]}") - .toObject(BillingSubscriptionListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingSubscriptionListResult model = new BillingSubscriptionListResult(); - model = BinaryData.fromObject(model).toObject(BillingSubscriptionListResult.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionMergeRequestTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionMergeRequestTests.java deleted file mode 100644 index 94cf1a4e6dad..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionMergeRequestTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.BillingSubscriptionMergeRequest; -import org.junit.jupiter.api.Assertions; - -public final class BillingSubscriptionMergeRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingSubscriptionMergeRequest model - = BinaryData.fromString("{\"targetBillingSubscriptionName\":\"vuaurk\",\"quantity\":497731118}") - .toObject(BillingSubscriptionMergeRequest.class); - Assertions.assertEquals("vuaurk", model.targetBillingSubscriptionName()); - Assertions.assertEquals(497731118, model.quantity()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingSubscriptionMergeRequest model - = new BillingSubscriptionMergeRequest().withTargetBillingSubscriptionName("vuaurk").withQuantity(497731118); - model = BinaryData.fromObject(model).toObject(BillingSubscriptionMergeRequest.class); - Assertions.assertEquals("vuaurk", model.targetBillingSubscriptionName()); - Assertions.assertEquals(497731118, model.quantity()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionPatchTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionPatchTests.java deleted file mode 100644 index 7ff5f4c0ff09..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionPatchTests.java +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.Beneficiary; -import com.azure.resourcemanager.billing.models.BillingSubscriptionPatch; -import com.azure.resourcemanager.billing.models.SystemOverrides; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class BillingSubscriptionPatchTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingSubscriptionPatch model = BinaryData.fromString( - "{\"properties\":{\"autoRenew\":\"Off\",\"beneficiaryTenantId\":\"lsbs\",\"beneficiary\":{\"tenantId\":\"qagwwrxaomz\",\"objectId\":\"glrrczez\"},\"billingFrequency\":\"hltnjadhqoawjq\",\"billingProfileId\":\"ueayfbpcmsplb\",\"billingPolicies\":{\"hwmgnmbscbbxig\":\"ueq\",\"dpyqyybxubmd\":\"hxiidlopedb\"},\"billingProfileDisplayName\":\"fcbqwremjela\",\"billingProfileName\":\"cigeleohdbvqvw\",\"consumptionCostCenter\":\"jopwbeonrlkwz\",\"customerId\":\"ybxc\",\"customerDisplayName\":\"kxcpt\",\"customerName\":\"qfyiaseqchkr\",\"displayName\":\"zrazisgyk\",\"enrollmentAccountId\":\"emv\",\"enrollmentAccountDisplayName\":\"bwzohmnrxxbs\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-01-19T09:33:12Z\",\"subscriptionEnrollmentAccountStatus\":\"Transferring\"},\"invoiceSectionId\":\"mdptys\",\"invoiceSectionDisplayName\":\"qsgnzxojpsl\",\"invoiceSectionName\":\"jgpliuf\",\"lastMonthCharges\":{\"currency\":\"oyxqvapcohhou\",\"value\":41.746384},\"monthToDateCharges\":{\"currency\":\"jxcx\",\"value\":60.126854},\"nextBillingCycleDetails\":{\"billingFrequency\":\"gdzbenr\"},\"offerId\":\"cawetzqddt\",\"productCategory\":\"fljhznamtua\",\"productType\":\"zwcjjncqtj\",\"productTypeId\":\"izvg\",\"purchaseDate\":\"2021-06-03T19:02:24Z\",\"quantity\":4237616710513929439,\"reseller\":{\"resellerId\":\"bxn\",\"description\":\"ebwgga\"},\"renewalTermDetails\":{\"billingFrequency\":\"zlswvajqf\",\"productId\":\"lx\",\"productTypeId\":\"qzasunwqrjzfrgqh\",\"skuId\":\"hcmbuocnjrohmbp\",\"termDuration\":\"yx\",\"quantity\":7175723432453090904,\"termEndDate\":\"2021-04-23T08:29:33Z\"},\"skuId\":\"yvk\",\"skuDescription\":\"m\",\"systemOverrides\":{\"cancellation\":\"NotAllowed\",\"cancellationAllowedEndDate\":\"2021-11-22T14:53:53Z\"},\"resourceUri\":\"v\",\"termDuration\":\"tod\",\"termStartDate\":\"2021-03-04T19:11:35Z\",\"termEndDate\":\"2021-09-18T22:21:22Z\",\"provisioningTenantId\":\"ucygvo\",\"status\":\"Failed\",\"operationStatus\":\"LockedForUpdate\",\"provisioningState\":\"Pending\",\"subscriptionId\":\"lghieegjlgvvpase\",\"suspensionReasons\":[\"buxantuyg\",\"hgaqipirpiwrq\",\"fulopmjnlexwhcb\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-10-20T08:28:15Z\",\"reason\":\"PolicyViolation\"},{\"effectiveDate\":\"2021-02-26T18:08:35Z\",\"reason\":\"PastDue\"}]},\"tags\":{\"duczkgof\":\"ctatoyintqpbrlcy\",\"srucvcrrpcjtt\":\"y\"},\"id\":\"t\",\"name\":\"jeaq\",\"type\":\"rmvvfkoxmlghktui\"}") - .toObject(BillingSubscriptionPatch.class); - Assertions.assertEquals("ctatoyintqpbrlcy", model.tags().get("duczkgof")); - Assertions.assertEquals(AutoRenew.OFF, model.autoRenew()); - Assertions.assertEquals("lsbs", model.beneficiaryTenantId()); - Assertions.assertEquals("qagwwrxaomz", model.beneficiary().tenantId()); - Assertions.assertEquals("glrrczez", model.beneficiary().objectId()); - Assertions.assertEquals("hltnjadhqoawjq", model.billingFrequency()); - Assertions.assertEquals("ueayfbpcmsplb", model.billingProfileId()); - Assertions.assertEquals("jopwbeonrlkwz", model.consumptionCostCenter()); - Assertions.assertEquals("ybxc", model.customerId()); - Assertions.assertEquals("zrazisgyk", model.displayName()); - Assertions.assertEquals("mdptys", model.invoiceSectionId()); - Assertions.assertEquals("izvg", model.productTypeId()); - Assertions.assertEquals(4237616710513929439L, model.quantity()); - Assertions.assertEquals("yvk", model.skuId()); - Assertions.assertEquals("tod", model.termDuration()); - Assertions.assertEquals("ucygvo", model.provisioningTenantId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingSubscriptionPatch model - = new BillingSubscriptionPatch().withTags(mapOf("duczkgof", "ctatoyintqpbrlcy", "srucvcrrpcjtt", "y")) - .withAutoRenew(AutoRenew.OFF) - .withBeneficiaryTenantId("lsbs") - .withBeneficiary(new Beneficiary().withTenantId("qagwwrxaomz").withObjectId("glrrczez")) - .withBillingFrequency("hltnjadhqoawjq") - .withBillingProfileId("ueayfbpcmsplb") - .withConsumptionCostCenter("jopwbeonrlkwz") - .withCustomerId("ybxc") - .withDisplayName("zrazisgyk") - .withInvoiceSectionId("mdptys") - .withProductTypeId("izvg") - .withQuantity(4237616710513929439L) - .withSkuId("yvk") - .withSystemOverrides(new SystemOverrides()) - .withTermDuration("tod") - .withProvisioningTenantId("ucygvo"); - model = BinaryData.fromObject(model).toObject(BillingSubscriptionPatch.class); - Assertions.assertEquals("ctatoyintqpbrlcy", model.tags().get("duczkgof")); - Assertions.assertEquals(AutoRenew.OFF, model.autoRenew()); - Assertions.assertEquals("lsbs", model.beneficiaryTenantId()); - Assertions.assertEquals("qagwwrxaomz", model.beneficiary().tenantId()); - Assertions.assertEquals("glrrczez", model.beneficiary().objectId()); - Assertions.assertEquals("hltnjadhqoawjq", model.billingFrequency()); - Assertions.assertEquals("ueayfbpcmsplb", model.billingProfileId()); - Assertions.assertEquals("jopwbeonrlkwz", model.consumptionCostCenter()); - Assertions.assertEquals("ybxc", model.customerId()); - Assertions.assertEquals("zrazisgyk", model.displayName()); - Assertions.assertEquals("mdptys", model.invoiceSectionId()); - Assertions.assertEquals("izvg", model.productTypeId()); - Assertions.assertEquals(4237616710513929439L, model.quantity()); - Assertions.assertEquals("yvk", model.skuId()); - Assertions.assertEquals("tod", model.termDuration()); - Assertions.assertEquals("ucygvo", model.provisioningTenantId()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionPropertiesTests.java deleted file mode 100644 index 4240edf2538b..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionPropertiesTests.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.BillingSubscriptionProperties; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.Beneficiary; -import com.azure.resourcemanager.billing.models.SystemOverrides; -import org.junit.jupiter.api.Assertions; - -public final class BillingSubscriptionPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingSubscriptionProperties model = BinaryData.fromString( - "{\"autoRenew\":\"Off\",\"beneficiaryTenantId\":\"bsnmfpph\",\"beneficiary\":{\"tenantId\":\"evy\",\"objectId\":\"hsgz\"},\"billingFrequency\":\"zbgomfgbeg\",\"billingProfileId\":\"gleohi\",\"billingPolicies\":{\"nkrrf\":\"nlu\",\"mq\":\"eeebtijvacv\",\"nw\":\"bqqxlaj\"},\"billingProfileDisplayName\":\"cevehjkuyxoafg\",\"billingProfileName\":\"qltfaey\",\"consumptionCostCenter\":\"nm\",\"customerId\":\"vxirpghriypo\",\"customerDisplayName\":\"yhlqhykprlpyznu\",\"customerName\":\"qdsmexiit\",\"displayName\":\"uxtyasiibmi\",\"enrollmentAccountId\":\"nnust\",\"enrollmentAccountDisplayName\":\"ljhnmgixhcmav\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-07-19T19:21:37Z\",\"subscriptionEnrollmentAccountStatus\":\"Deleted\"},\"invoiceSectionId\":\"rhc\",\"invoiceSectionDisplayName\":\"yprotwyp\",\"invoiceSectionName\":\"d\",\"lastMonthCharges\":{\"currency\":\"hu\",\"value\":76.08653},\"monthToDateCharges\":{\"currency\":\"avlg\",\"value\":48.83463},\"nextBillingCycleDetails\":{\"billingFrequency\":\"tp\"},\"offerId\":\"tzfjltf\",\"productCategory\":\"zcyjtot\",\"productType\":\"opv\",\"productTypeId\":\"dbzqgqqihed\",\"purchaseDate\":\"2021-03-24T17:03:11Z\",\"quantity\":7800866401900488866,\"reseller\":{\"resellerId\":\"yibcy\",\"description\":\"hsgqc\"},\"renewalTermDetails\":{\"billingFrequency\":\"ohsdtmcd\",\"productId\":\"ufcohdxbz\",\"productTypeId\":\"cmuapcvhd\",\"skuId\":\"v\",\"termDuration\":\"qxeysko\",\"quantity\":8223110297990231719,\"termEndDate\":\"2021-07-17T19:35:55Z\"},\"skuId\":\"kbg\",\"skuDescription\":\"bowxe\",\"systemOverrides\":{\"cancellation\":\"Allowed\",\"cancellationAllowedEndDate\":\"2021-07-29T08:56:21Z\"},\"resourceUri\":\"gvkzqkjjeokbze\",\"termDuration\":\"zrxcczurt\",\"termStartDate\":\"2021-07-07T15:21:44Z\",\"termEndDate\":\"2020-12-31T21:39:53Z\",\"provisioningTenantId\":\"bkwvzg\",\"status\":\"Disabled\",\"operationStatus\":\"Other\",\"provisioningState\":\"ConfirmedBilling\",\"subscriptionId\":\"ixz\",\"suspensionReasons\":[\"noda\",\"opqhewjptmc\",\"sbostzel\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-10-16T17:09:06Z\",\"reason\":\"SpendingLimitReached\"}]}") - .toObject(BillingSubscriptionProperties.class); - Assertions.assertEquals(AutoRenew.OFF, model.autoRenew()); - Assertions.assertEquals("bsnmfpph", model.beneficiaryTenantId()); - Assertions.assertEquals("evy", model.beneficiary().tenantId()); - Assertions.assertEquals("hsgz", model.beneficiary().objectId()); - Assertions.assertEquals("zbgomfgbeg", model.billingFrequency()); - Assertions.assertEquals("gleohi", model.billingProfileId()); - Assertions.assertEquals("nm", model.consumptionCostCenter()); - Assertions.assertEquals("vxirpghriypo", model.customerId()); - Assertions.assertEquals("uxtyasiibmi", model.displayName()); - Assertions.assertEquals("rhc", model.invoiceSectionId()); - Assertions.assertEquals("dbzqgqqihed", model.productTypeId()); - Assertions.assertEquals(7800866401900488866L, model.quantity()); - Assertions.assertEquals("kbg", model.skuId()); - Assertions.assertEquals("zrxcczurt", model.termDuration()); - Assertions.assertEquals("bkwvzg", model.provisioningTenantId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingSubscriptionProperties model = new BillingSubscriptionProperties().withAutoRenew(AutoRenew.OFF) - .withBeneficiaryTenantId("bsnmfpph") - .withBeneficiary(new Beneficiary().withTenantId("evy").withObjectId("hsgz")) - .withBillingFrequency("zbgomfgbeg") - .withBillingProfileId("gleohi") - .withConsumptionCostCenter("nm") - .withCustomerId("vxirpghriypo") - .withDisplayName("uxtyasiibmi") - .withInvoiceSectionId("rhc") - .withProductTypeId("dbzqgqqihed") - .withQuantity(7800866401900488866L) - .withSkuId("kbg") - .withSystemOverrides(new SystemOverrides()) - .withTermDuration("zrxcczurt") - .withProvisioningTenantId("bkwvzg"); - model = BinaryData.fromObject(model).toObject(BillingSubscriptionProperties.class); - Assertions.assertEquals(AutoRenew.OFF, model.autoRenew()); - Assertions.assertEquals("bsnmfpph", model.beneficiaryTenantId()); - Assertions.assertEquals("evy", model.beneficiary().tenantId()); - Assertions.assertEquals("hsgz", model.beneficiary().objectId()); - Assertions.assertEquals("zbgomfgbeg", model.billingFrequency()); - Assertions.assertEquals("gleohi", model.billingProfileId()); - Assertions.assertEquals("nm", model.consumptionCostCenter()); - Assertions.assertEquals("vxirpghriypo", model.customerId()); - Assertions.assertEquals("uxtyasiibmi", model.displayName()); - Assertions.assertEquals("rhc", model.invoiceSectionId()); - Assertions.assertEquals("dbzqgqqihed", model.productTypeId()); - Assertions.assertEquals(7800866401900488866L, model.quantity()); - Assertions.assertEquals("kbg", model.skuId()); - Assertions.assertEquals("zrxcczurt", model.termDuration()); - Assertions.assertEquals("bkwvzg", model.provisioningTenantId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionSplitRequestTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionSplitRequestTests.java deleted file mode 100644 index f2f33656ee07..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionSplitRequestTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.BillingSubscriptionSplitRequest; -import org.junit.jupiter.api.Assertions; - -public final class BillingSubscriptionSplitRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingSubscriptionSplitRequest model = BinaryData.fromString( - "{\"targetProductTypeId\":\"xqltgrd\",\"targetSkuId\":\"ypxrx\",\"quantity\":1219118110,\"termDuration\":\"hwuhvctaf\",\"billingFrequency\":\"bxrblmliowxihspn\"}") - .toObject(BillingSubscriptionSplitRequest.class); - Assertions.assertEquals("xqltgrd", model.targetProductTypeId()); - Assertions.assertEquals("ypxrx", model.targetSkuId()); - Assertions.assertEquals(1219118110, model.quantity()); - Assertions.assertEquals("hwuhvctaf", model.termDuration()); - Assertions.assertEquals("bxrblmliowxihspn", model.billingFrequency()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingSubscriptionSplitRequest model = new BillingSubscriptionSplitRequest().withTargetProductTypeId("xqltgrd") - .withTargetSkuId("ypxrx") - .withQuantity(1219118110) - .withTermDuration("hwuhvctaf") - .withBillingFrequency("bxrblmliowxihspn"); - model = BinaryData.fromObject(model).toObject(BillingSubscriptionSplitRequest.class); - Assertions.assertEquals("xqltgrd", model.targetProductTypeId()); - Assertions.assertEquals("ypxrx", model.targetSkuId()); - Assertions.assertEquals(1219118110, model.quantity()); - Assertions.assertEquals("hwuhvctaf", model.termDuration()); - Assertions.assertEquals("bxrblmliowxihspn", model.billingFrequency()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionStatusDetailsTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionStatusDetailsTests.java deleted file mode 100644 index 632a13540b79..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionStatusDetailsTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.BillingSubscriptionStatusDetails; - -public final class BillingSubscriptionStatusDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - BillingSubscriptionStatusDetails model - = BinaryData.fromString("{\"effectiveDate\":\"2021-08-18T07:41:10Z\",\"reason\":\"PolicyViolation\"}") - .toObject(BillingSubscriptionStatusDetails.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - BillingSubscriptionStatusDetails model = new BillingSubscriptionStatusDetails(); - model = BinaryData.fromObject(model).toObject(BillingSubscriptionStatusDetails.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsAliasesCreateOrUpdateMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsAliasesCreateOrUpdateMockTests.java deleted file mode 100644 index c88c31840696..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsAliasesCreateOrUpdateMockTests.java +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.fluent.models.BillingSubscriptionAliasInner; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.Beneficiary; -import com.azure.resourcemanager.billing.models.BillingSubscriptionAlias; -import com.azure.resourcemanager.billing.models.SystemOverrides; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingSubscriptionsAliasesCreateOrUpdateMockTests { - @Test - public void testCreateOrUpdate() throws Exception { - String responseStr - = "{\"properties\":{\"billingSubscriptionId\":\"vkyezwsey\",\"autoRenew\":\"Off\",\"beneficiaryTenantId\":\"mjw\",\"beneficiary\":{\"tenantId\":\"lqreof\",\"objectId\":\"krztpyaymhxlnmw\"},\"billingFrequency\":\"symnrtvqmima\",\"billingProfileId\":\"otpcvp\",\"billingPolicies\":{\"wtominrufqqa\":\"pkvyqpvzxxzn\"},\"billingProfileDisplayName\":\"gasfmhbxv\",\"billingProfileName\":\"kqnatxvuzc\",\"consumptionCostCenter\":\"lirybytcaqp\",\"customerId\":\"hlc\",\"customerDisplayName\":\"rvxyyh\",\"customerName\":\"i\",\"displayName\":\"tq\",\"enrollmentAccountId\":\"panteqiw\",\"enrollmentAccountDisplayName\":\"ukaa\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-01-23T22:26:58Z\",\"subscriptionEnrollmentAccountStatus\":\"TransferredOut\"},\"invoiceSectionId\":\"xysjd\",\"invoiceSectionDisplayName\":\"vksijrjgyind\",\"invoiceSectionName\":\"i\",\"lastMonthCharges\":{\"currency\":\"uyxuupze\",\"value\":76.48739},\"monthToDateCharges\":{\"currency\":\"opdtph\",\"value\":29.796202},\"nextBillingCycleDetails\":{\"billingFrequency\":\"zy\"},\"offerId\":\"gqyiyjxzx\",\"productCategory\":\"htnyz\",\"productType\":\"o\",\"productTypeId\":\"mdlk\",\"purchaseDate\":\"2021-02-05T19:50:42Z\",\"quantity\":3089360574056270609,\"reseller\":{\"resellerId\":\"bwxpmgyqshsasmr\",\"description\":\"yutkbx\"},\"renewalTermDetails\":{\"billingFrequency\":\"ztkyqguauuihk\",\"productId\":\"gkyncyzjndfeemxi\",\"productTypeId\":\"pfivypmwdza\",\"skuId\":\"cr\",\"termDuration\":\"ppoqimyhxnpdggll\",\"quantity\":7101363085083316212,\"termEndDate\":\"2021-06-02T15:39:32Z\"},\"skuId\":\"m\",\"skuDescription\":\"c\",\"systemOverrides\":{\"cancellation\":\"NotAllowed\",\"cancellationAllowedEndDate\":\"2021-04-24T21:13:02Z\"},\"resourceUri\":\"djnstzeurdo\",\"termDuration\":\"l\",\"termStartDate\":\"2021-05-01T08:38:59Z\",\"termEndDate\":\"2021-08-03T03:41:27Z\",\"provisioningTenantId\":\"znymwzl\",\"status\":\"Failed\",\"operationStatus\":\"None\",\"provisioningState\":\"Succeeded\",\"subscriptionId\":\"fubevwadxc\",\"suspensionReasons\":[\"evltfebq\",\"qiaklqakps\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-03-19T17:59:24Z\",\"reason\":\"Other\"},{\"effectiveDate\":\"2021-04-12T03:54:25Z\",\"reason\":\"PolicyViolation\"}]},\"tags\":{\"qkgt\":\"ipzgfofuadcjqne\"},\"id\":\"arg\",\"name\":\"eynqlsnrgaxoyv\",\"type\":\"jjpfyxhsppvjs\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingSubscriptionAlias response = manager.billingSubscriptionsAliases() - .createOrUpdate("sabcylzz", "etumzenkrd", - new BillingSubscriptionAliasInner() - .withTags(mapOf("khcidcfwoo", "qyrpub", "zowgmmixf", "ku", "jnpahzhpqscuyil", "aupgblna")) - .withAutoRenew(AutoRenew.OFF) - .withBeneficiaryTenantId("qqqeetsqaclc") - .withBeneficiary(new Beneficiary().withTenantId("of").withObjectId("raiai")) - .withBillingFrequency("kewqwamptld") - .withBillingProfileId("orzljhnxfkffng") - .withConsumptionCostCenter("okyduqzuscolb") - .withCustomerId("ehtekx") - .withDisplayName("bcztamkyrkwsthp") - .withInvoiceSectionId("sxfrwvlyp") - .withProductTypeId("cuvwat") - .withQuantity(6528757801026193127L) - .withSkuId("vjk") - .withSystemOverrides(new SystemOverrides()) - .withTermDuration("x") - .withProvisioningTenantId("xrqghotingzic"), - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("ipzgfofuadcjqne", response.tags().get("qkgt")); - Assertions.assertEquals(AutoRenew.OFF, response.autoRenew()); - Assertions.assertEquals("mjw", response.beneficiaryTenantId()); - Assertions.assertEquals("lqreof", response.beneficiary().tenantId()); - Assertions.assertEquals("krztpyaymhxlnmw", response.beneficiary().objectId()); - Assertions.assertEquals("symnrtvqmima", response.billingFrequency()); - Assertions.assertEquals("otpcvp", response.billingProfileId()); - Assertions.assertEquals("lirybytcaqp", response.consumptionCostCenter()); - Assertions.assertEquals("hlc", response.customerId()); - Assertions.assertEquals("tq", response.displayName()); - Assertions.assertEquals("xysjd", response.invoiceSectionId()); - Assertions.assertEquals("mdlk", response.productTypeId()); - Assertions.assertEquals(3089360574056270609L, response.quantity()); - Assertions.assertEquals("m", response.skuId()); - Assertions.assertEquals("l", response.termDuration()); - Assertions.assertEquals("znymwzl", response.provisioningTenantId()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsAliasesGetWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsAliasesGetWithResponseMockTests.java deleted file mode 100644 index 34ff00819e9e..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsAliasesGetWithResponseMockTests.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.BillingSubscriptionAlias; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingSubscriptionsAliasesGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"billingSubscriptionId\":\"usgiikhrcthype\",\"autoRenew\":\"Off\",\"beneficiaryTenantId\":\"mrdiscsdvkymkt\",\"beneficiary\":{\"tenantId\":\"ivoxgzegnglafnf\",\"objectId\":\"zaghddc\"},\"billingFrequency\":\"wxuxor\",\"billingProfileId\":\"tuhvemg\",\"billingPolicies\":{\"vwxlxo\":\"solqy\",\"vgdojcvzfcmxmjp\":\"vrkqv\"},\"billingProfileDisplayName\":\"kjd\",\"billingProfileName\":\"odo\",\"consumptionCostCenter\":\"q\",\"customerId\":\"xnyx\",\"customerDisplayName\":\"qdsq\",\"customerName\":\"i\",\"displayName\":\"t\",\"enrollmentAccountId\":\"kdi\",\"enrollmentAccountDisplayName\":\"xsq\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-08-01T21:41:59Z\",\"subscriptionEnrollmentAccountStatus\":\"Inactive\"},\"invoiceSectionId\":\"oih\",\"invoiceSectionDisplayName\":\"ajdtacvsynssxyls\",\"invoiceSectionName\":\"oadoh\",\"lastMonthCharges\":{\"currency\":\"iehkxgfu\",\"value\":54.3503},\"monthToDateCharges\":{\"currency\":\"kwlxqdsxip\",\"value\":39.552177},\"nextBillingCycleDetails\":{\"billingFrequency\":\"itfzpwwgzeylzp\"},\"offerId\":\"mxacr\",\"productCategory\":\"joygyn\",\"productType\":\"x\",\"productTypeId\":\"bbnu\",\"purchaseDate\":\"2021-10-17T01:30:27Z\",\"quantity\":6130120033082156320,\"reseller\":{\"resellerId\":\"uvqbeyxwrmupzpe\",\"description\":\"bhgjajkvwkocx\"},\"renewalTermDetails\":{\"billingFrequency\":\"zllvna\",\"productId\":\"gvlpgfygenfakyb\",\"productTypeId\":\"sihzqi\",\"skuId\":\"ymppglxjsfgb\",\"termDuration\":\"tsaz\",\"quantity\":1606556247356044252,\"termEndDate\":\"2021-04-18T15:04:41Z\"},\"skuId\":\"rukhqbu\",\"skuDescription\":\"rbdkgqdmvvvj\",\"systemOverrides\":{\"cancellation\":\"NotAllowed\",\"cancellationAllowedEndDate\":\"2021-06-21T12:28:13Z\"},\"resourceUri\":\"uvsveamseauu\",\"termDuration\":\"hx\",\"termStartDate\":\"2021-11-25T19:33:44Z\",\"termEndDate\":\"2021-09-30T13:07:54Z\",\"provisioningTenantId\":\"ufzu\",\"status\":\"Suspended\",\"operationStatus\":\"LockedForUpdate\",\"provisioningState\":\"Succeeded\",\"subscriptionId\":\"mtyosdpxtsdy\",\"suspensionReasons\":[\"efvwgwphwxi\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-01-28T15:08:34Z\",\"reason\":\"None\"},{\"effectiveDate\":\"2021-01-20T12:35:22Z\",\"reason\":\"SuspiciousActivity\"},{\"effectiveDate\":\"2021-09-27T18:11:40Z\",\"reason\":\"Transferred\"},{\"effectiveDate\":\"2021-04-15T08:30:28Z\",\"reason\":\"Other\"}]},\"tags\":{\"alphkgminhec\":\"lkjsvkbtmli\"},\"id\":\"djdjmsngmluy\",\"name\":\"lkpism\",\"type\":\"rmrjpjthi\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingSubscriptionAlias response = manager.billingSubscriptionsAliases() - .getWithResponse("hyvdbrdvsv", "hbtyc", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("lkjsvkbtmli", response.tags().get("alphkgminhec")); - Assertions.assertEquals(AutoRenew.OFF, response.autoRenew()); - Assertions.assertEquals("mrdiscsdvkymkt", response.beneficiaryTenantId()); - Assertions.assertEquals("ivoxgzegnglafnf", response.beneficiary().tenantId()); - Assertions.assertEquals("zaghddc", response.beneficiary().objectId()); - Assertions.assertEquals("wxuxor", response.billingFrequency()); - Assertions.assertEquals("tuhvemg", response.billingProfileId()); - Assertions.assertEquals("q", response.consumptionCostCenter()); - Assertions.assertEquals("xnyx", response.customerId()); - Assertions.assertEquals("t", response.displayName()); - Assertions.assertEquals("oih", response.invoiceSectionId()); - Assertions.assertEquals("bbnu", response.productTypeId()); - Assertions.assertEquals(6130120033082156320L, response.quantity()); - Assertions.assertEquals("rukhqbu", response.skuId()); - Assertions.assertEquals("hx", response.termDuration()); - Assertions.assertEquals("ufzu", response.provisioningTenantId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsAliasesListByBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsAliasesListByBillingAccountMockTests.java deleted file mode 100644 index cb3a2808a9ac..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsAliasesListByBillingAccountMockTests.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.BillingSubscriptionAlias; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingSubscriptionsAliasesListByBillingAccountMockTests { - @Test - public void testListByBillingAccount() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"billingSubscriptionId\":\"ofz\",\"autoRenew\":\"Off\",\"beneficiaryTenantId\":\"tl\",\"beneficiary\":{\"tenantId\":\"oxzuhellit\",\"objectId\":\"vpiv\"},\"billingFrequency\":\"gqbmolxeomeb\",\"billingProfileId\":\"tvxx\",\"billingPolicies\":{\"nalpcuedybkbgdw\":\"oyacgi\"},\"billingProfileDisplayName\":\"ivzikatywedbpi\",\"billingProfileName\":\"zpa\",\"consumptionCostCenter\":\"b\",\"customerId\":\"xncszdwpaveux\",\"customerDisplayName\":\"igsoeb\",\"customerName\":\"tniuiim\",\"displayName\":\"ffhgvc\",\"enrollmentAccountId\":\"ddoeilhgga\",\"enrollmentAccountDisplayName\":\"eudbobmol\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-10-10T01:35:15Z\",\"subscriptionEnrollmentAccountStatus\":\"Inactive\"},\"invoiceSectionId\":\"lzihv\",\"invoiceSectionDisplayName\":\"quajpo\",\"invoiceSectionName\":\"djxyotgvraxhn\",\"lastMonthCharges\":{\"currency\":\"wfszkrlkosj\",\"value\":40.694565},\"monthToDateCharges\":{\"currency\":\"s\",\"value\":54.19026},\"nextBillingCycleDetails\":{\"billingFrequency\":\"ksdiimioixv\"},\"offerId\":\"buwbngeu\",\"productCategory\":\"dqngqamhb\",\"productType\":\"gnqx\",\"productTypeId\":\"xqzaffz\",\"purchaseDate\":\"2021-06-24T06:16:46Z\",\"quantity\":7833264232321996164,\"reseller\":{\"resellerId\":\"vomdqxnoyzqipapi\",\"description\":\"cydbjghunq\"},\"renewalTermDetails\":{\"billingFrequency\":\"rwo\",\"productId\":\"zvvxdvphx\",\"productTypeId\":\"wvxcai\",\"skuId\":\"icbogsfo\",\"termDuration\":\"mamiyfgunruk\",\"quantity\":5932949525198315477,\"termEndDate\":\"2021-08-02T03:26:08Z\"},\"skuId\":\"kubzq\",\"skuDescription\":\"dlrkvitzk\",\"systemOverrides\":{\"cancellation\":\"NotAllowed\",\"cancellationAllowedEndDate\":\"2021-08-01T03:19:07Z\"},\"resourceUri\":\"nido\",\"termDuration\":\"pumzuh\",\"termStartDate\":\"2021-09-20T03:14:58Z\",\"termEndDate\":\"2021-06-04T06:26:49Z\",\"provisioningTenantId\":\"hpvarumvuwj\",\"status\":\"Expiring\",\"operationStatus\":\"LockedForUpdate\",\"provisioningState\":\"Created\",\"subscriptionId\":\"llavz\",\"suspensionReasons\":[\"gmrodb\",\"apqra\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-01-28T03:41:37Z\",\"reason\":\"Transferred\"},{\"effectiveDate\":\"2021-01-30T15:45:15Z\",\"reason\":\"Other\"},{\"effectiveDate\":\"2021-04-18T05:33:20Z\",\"reason\":\"Cancelled\"},{\"effectiveDate\":\"2021-08-09T06:45:20Z\",\"reason\":\"Other\"}]},\"tags\":{\"ttgxkxt\":\"eg\"},\"id\":\"bbjbeyqohvia\",\"name\":\"pjfkr\",\"type\":\"rerdlgbvtpxowg\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingSubscriptionsAliases() - .listByBillingAccount("uouoqtenq", true, "muogeq", "apaseqcppypfre", 5569397966046661840L, - 6833106247375052675L, false, "dyvt", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("eg", response.iterator().next().tags().get("ttgxkxt")); - Assertions.assertEquals(AutoRenew.OFF, response.iterator().next().autoRenew()); - Assertions.assertEquals("tl", response.iterator().next().beneficiaryTenantId()); - Assertions.assertEquals("oxzuhellit", response.iterator().next().beneficiary().tenantId()); - Assertions.assertEquals("vpiv", response.iterator().next().beneficiary().objectId()); - Assertions.assertEquals("gqbmolxeomeb", response.iterator().next().billingFrequency()); - Assertions.assertEquals("tvxx", response.iterator().next().billingProfileId()); - Assertions.assertEquals("b", response.iterator().next().consumptionCostCenter()); - Assertions.assertEquals("xncszdwpaveux", response.iterator().next().customerId()); - Assertions.assertEquals("ffhgvc", response.iterator().next().displayName()); - Assertions.assertEquals("lzihv", response.iterator().next().invoiceSectionId()); - Assertions.assertEquals("xqzaffz", response.iterator().next().productTypeId()); - Assertions.assertEquals(7833264232321996164L, response.iterator().next().quantity()); - Assertions.assertEquals("kubzq", response.iterator().next().skuId()); - Assertions.assertEquals("pumzuh", response.iterator().next().termDuration()); - Assertions.assertEquals("hpvarumvuwj", response.iterator().next().provisioningTenantId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsGetByBillingProfileWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsGetByBillingProfileWithResponseMockTests.java deleted file mode 100644 index b7442b12e119..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsGetByBillingProfileWithResponseMockTests.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.BillingSubscription; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingSubscriptionsGetByBillingProfileWithResponseMockTests { - @Test - public void testGetByBillingProfileWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"autoRenew\":\"On\",\"beneficiaryTenantId\":\"owgvm\",\"beneficiary\":{\"tenantId\":\"o\",\"objectId\":\"dhkoexbrhgn\"},\"billingFrequency\":\"ajwscmneev\",\"billingProfileId\":\"mqeumzyyhmgqa\",\"billingPolicies\":{\"bgbzgfhzdzahk\":\"jqutx\",\"whz\":\"xvcbicfecthotbk\",\"jdpayx\":\"pxjvtwk\",\"qztjfkgb\":\"pqiwuzr\"},\"billingProfileDisplayName\":\"qjobsynnen\",\"billingProfileName\":\"njqhdheosx\",\"consumptionCostCenter\":\"fudmpfhwyp\",\"customerId\":\"tjtntc\",\"customerDisplayName\":\"pdbbgl\",\"customerName\":\"cctokfspvj\",\"displayName\":\"spkvrmp\",\"enrollmentAccountId\":\"typtwjw\",\"enrollmentAccountDisplayName\":\"yeohgmcmdjmv\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-10-21T15:19:38Z\",\"subscriptionEnrollmentAccountStatus\":\"Inactive\"},\"invoiceSectionId\":\"slvfzzioxbgomv\",\"invoiceSectionDisplayName\":\"prpmo\",\"invoiceSectionName\":\"nw\",\"lastMonthCharges\":{\"currency\":\"uoxixtxxxajseh\",\"value\":40.404976},\"monthToDateCharges\":{\"currency\":\"nkyjfa\",\"value\":91.48125},\"nextBillingCycleDetails\":{\"billingFrequency\":\"ogzehczbniv\"},\"offerId\":\"hsxvppkjeal\",\"productCategory\":\"bewhotvbmyzuqf\",\"productType\":\"dktrjtoqszh\",\"productTypeId\":\"ngjn\",\"purchaseDate\":\"2021-09-06T15:53:10Z\",\"quantity\":5250248694607436441,\"reseller\":{\"resellerId\":\"f\",\"description\":\"dod\"},\"renewalTermDetails\":{\"billingFrequency\":\"yipgkmjt\",\"productId\":\"zmdzesimeft\",\"productTypeId\":\"rfzjlflzagvdavab\",\"skuId\":\"efcor\",\"termDuration\":\"idaebezn\",\"quantity\":465371594112802933,\"termEndDate\":\"2021-11-07T05:52:59Z\"},\"skuId\":\"jwiylciobb\",\"skuDescription\":\"ws\",\"systemOverrides\":{\"cancellation\":\"NotAllowed\",\"cancellationAllowedEndDate\":\"2021-01-12T21:30:41Z\"},\"resourceUri\":\"cuuuexsmnteevfg\",\"termDuration\":\"fezraqs\",\"termStartDate\":\"2021-11-12T15:34:05Z\",\"termEndDate\":\"2021-01-01T05:53:38Z\",\"provisioningTenantId\":\"gxqfkyr\",\"status\":\"Expiring\",\"operationStatus\":\"None\",\"provisioningState\":\"Failed\",\"subscriptionId\":\"w\",\"suspensionReasons\":[\"sspfegaoksd\",\"kkraj\",\"yuklxkel\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-11-04T00:05:12Z\",\"reason\":\"SpendingLimitReached\"},{\"effectiveDate\":\"2021-07-05T17:12:33Z\",\"reason\":\"Other\"}]},\"tags\":{\"rvqrwwbdrwroqk\":\"gsingmhpavsfg\",\"kyu\":\"jnzpqhqqsa\"},\"id\":\"ameaasjqen\",\"name\":\"ekzazvgeytlplsl\",\"type\":\"cv\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingSubscription response = manager.billingSubscriptions() - .getByBillingProfileWithResponse("ksr", "mspppoeszthjt", "yjskdiylg", "zuqix", - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("gsingmhpavsfg", response.tags().get("rvqrwwbdrwroqk")); - Assertions.assertEquals(AutoRenew.ON, response.autoRenew()); - Assertions.assertEquals("owgvm", response.beneficiaryTenantId()); - Assertions.assertEquals("o", response.beneficiary().tenantId()); - Assertions.assertEquals("dhkoexbrhgn", response.beneficiary().objectId()); - Assertions.assertEquals("ajwscmneev", response.billingFrequency()); - Assertions.assertEquals("mqeumzyyhmgqa", response.billingProfileId()); - Assertions.assertEquals("fudmpfhwyp", response.consumptionCostCenter()); - Assertions.assertEquals("tjtntc", response.customerId()); - Assertions.assertEquals("spkvrmp", response.displayName()); - Assertions.assertEquals("slvfzzioxbgomv", response.invoiceSectionId()); - Assertions.assertEquals("ngjn", response.productTypeId()); - Assertions.assertEquals(5250248694607436441L, response.quantity()); - Assertions.assertEquals("jwiylciobb", response.skuId()); - Assertions.assertEquals("fezraqs", response.termDuration()); - Assertions.assertEquals("gxqfkyr", response.provisioningTenantId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsGetWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsGetWithResponseMockTests.java deleted file mode 100644 index 0b137e3b7d57..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsGetWithResponseMockTests.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.BillingSubscription; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingSubscriptionsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"autoRenew\":\"Off\",\"beneficiaryTenantId\":\"qwojdz\",\"beneficiary\":{\"tenantId\":\"twsrbfbsd\",\"objectId\":\"cdzfbvexrv\"},\"billingFrequency\":\"hmfsnqp\",\"billingProfileId\":\"tsh\",\"billingPolicies\":{\"fbwoetxi\":\"rsksdzmhwtsypp\",\"gdungaypx\":\"rfwxhf\",\"bxsnx\":\"a\"},\"billingProfileDisplayName\":\"sznfstmprvgra\",\"billingProfileName\":\"zktwomlpc\",\"consumptionCostCenter\":\"qboomzgmr\",\"customerId\":\"hsfddkhxvevwxm\",\"customerDisplayName\":\"waxadxgn\",\"customerName\":\"htuhalpq\",\"displayName\":\"dnao\",\"enrollmentAccountId\":\"xznpnytkqja\",\"enrollmentAccountDisplayName\":\"azbtgtzp\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-11-28T20:04:59Z\",\"subscriptionEnrollmentAccountStatus\":\"Inactive\"},\"invoiceSectionId\":\"ujfgtg\",\"invoiceSectionDisplayName\":\"upczegqn\",\"invoiceSectionName\":\"dvssvg\",\"lastMonthCharges\":{\"currency\":\"gkztzttjnknpbq\",\"value\":98.50168},\"monthToDateCharges\":{\"currency\":\"bclobnaqe\",\"value\":48.010868},\"nextBillingCycleDetails\":{\"billingFrequency\":\"q\"},\"offerId\":\"ugpnnhzjm\",\"productCategory\":\"feonmnvmujyiqywl\",\"productType\":\"mliytdegcrunbkil\",\"productTypeId\":\"tekbirhyvsy\",\"purchaseDate\":\"2021-05-04T14:52:01Z\",\"quantity\":7031355623994805057,\"reseller\":{\"resellerId\":\"szffiu\",\"description\":\"trvgioguox\"},\"renewalTermDetails\":{\"billingFrequency\":\"qo\",\"productId\":\"denmjogx\",\"productTypeId\":\"ggyciwbnqi\",\"skuId\":\"sx\",\"termDuration\":\"mrnjrdijo\",\"quantity\":8714787440142236452,\"termEndDate\":\"2021-06-21T09:51:24Z\"},\"skuId\":\"hdcjggcm\",\"skuDescription\":\"cjqbgbnoq\",\"systemOverrides\":{\"cancellation\":\"NotAllowed\",\"cancellationAllowedEndDate\":\"2021-04-18T18:54:13Z\"},\"resourceUri\":\"ytzgwjekyqirv\",\"termDuration\":\"o\",\"termStartDate\":\"2021-05-31T15:30:09Z\",\"termEndDate\":\"2021-11-01T05:48:44Z\",\"provisioningTenantId\":\"pdilbdvxlfhlzzg\",\"status\":\"Failed\",\"operationStatus\":\"LockedForUpdate\",\"provisioningState\":\"Failed\",\"subscriptionId\":\"lscrm\",\"suspensionReasons\":[\"uz\",\"wkgouxnro\",\"ht\",\"esywywnvgy\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-03-13T05:15:54Z\",\"reason\":\"Expired\"}]},\"tags\":{\"xlfzlnzyrgrl\":\"uej\",\"jovlxqtvmvzpniq\":\"chrau\"},\"id\":\"mrgm\",\"name\":\"kgtlhzkrazki\",\"type\":\"iy\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingSubscription response = manager.billingSubscriptions() - .getWithResponse("glmnlbnatln", "hzzcdkxortdzzvhb", "jk", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("uej", response.tags().get("xlfzlnzyrgrl")); - Assertions.assertEquals(AutoRenew.OFF, response.autoRenew()); - Assertions.assertEquals("qwojdz", response.beneficiaryTenantId()); - Assertions.assertEquals("twsrbfbsd", response.beneficiary().tenantId()); - Assertions.assertEquals("cdzfbvexrv", response.beneficiary().objectId()); - Assertions.assertEquals("hmfsnqp", response.billingFrequency()); - Assertions.assertEquals("tsh", response.billingProfileId()); - Assertions.assertEquals("qboomzgmr", response.consumptionCostCenter()); - Assertions.assertEquals("hsfddkhxvevwxm", response.customerId()); - Assertions.assertEquals("dnao", response.displayName()); - Assertions.assertEquals("ujfgtg", response.invoiceSectionId()); - Assertions.assertEquals("tekbirhyvsy", response.productTypeId()); - Assertions.assertEquals(7031355623994805057L, response.quantity()); - Assertions.assertEquals("hdcjggcm", response.skuId()); - Assertions.assertEquals("o", response.termDuration()); - Assertions.assertEquals("pdilbdvxlfhlzzg", response.provisioningTenantId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByBillingAccountMockTests.java deleted file mode 100644 index 754572701d87..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByBillingAccountMockTests.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.BillingSubscription; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingSubscriptionsListByBillingAccountMockTests { - @Test - public void testListByBillingAccount() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"autoRenew\":\"Off\",\"beneficiaryTenantId\":\"mbuzginrkjk\",\"beneficiary\":{\"tenantId\":\"fsu\",\"objectId\":\"ybhozlsbufnhb\"},\"billingFrequency\":\"ntpoe\",\"billingProfileId\":\"trsljzmzuic\",\"billingPolicies\":{\"bbnjldicqoman\":\"sxznbppmkqby\",\"nitvkyahfoyfzo\":\"fwl\"},\"billingProfileDisplayName\":\"yaeprevcj\",\"billingProfileName\":\"falwceechca\",\"consumptionCostCenter\":\"qbeqpucnu\",\"customerId\":\"yl\",\"customerDisplayName\":\"icrjriybf\",\"customerName\":\"drl\",\"displayName\":\"lbofsnqo\",\"enrollmentAccountId\":\"brhxgiknrlugs\",\"enrollmentAccountDisplayName\":\"qbroqjfeamzkuxd\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-03-30T14:28:18Z\",\"subscriptionEnrollmentAccountStatus\":\"Transferring\"},\"invoiceSectionId\":\"bunvnjql\",\"invoiceSectionDisplayName\":\"qqvcugusqlxlxedt\",\"invoiceSectionName\":\"wlnvqacbyfisbl\",\"lastMonthCharges\":{\"currency\":\"puyypaggpaiheaey\",\"value\":40.48214},\"monthToDateCharges\":{\"currency\":\"rmgdhymipvl\",\"value\":77.07859},\"nextBillingCycleDetails\":{\"billingFrequency\":\"k\"},\"offerId\":\"dspllitxrrg\",\"productCategory\":\"iy\",\"productType\":\"hqoivxcodwkwo\",\"productTypeId\":\"cachhsizfuew\",\"purchaseDate\":\"2021-09-23T19:48:27Z\",\"quantity\":5461584175424200272,\"reseller\":{\"resellerId\":\"cdnzsfiuhgne\",\"description\":\"dmcrxly\"},\"renewalTermDetails\":{\"billingFrequency\":\"ho\",\"productId\":\"fakrxjjwnbrmdw\",\"productTypeId\":\"rnlsyiaanistc\",\"skuId\":\"atclpphcs\",\"termDuration\":\"rycpanapfa\",\"quantity\":3698921515090565219,\"termEndDate\":\"2021-07-18T16:01:52Z\"},\"skuId\":\"pxngzzxqbgq\",\"skuDescription\":\"mzc\",\"systemOverrides\":{\"cancellation\":\"NotAllowed\",\"cancellationAllowedEndDate\":\"2021-11-22T03:32:01Z\"},\"resourceUri\":\"ifpucv\",\"termDuration\":\"ozwbs\",\"termStartDate\":\"2021-04-12T15:43:24Z\",\"termEndDate\":\"2021-07-25T18:46:14Z\",\"provisioningTenantId\":\"sqmbinpxmiwtkq\",\"status\":\"Disabled\",\"operationStatus\":\"None\",\"provisioningState\":\"Provisioning\",\"subscriptionId\":\"cdnzoxl\",\"suspensionReasons\":[\"xtwgbawshram\",\"sugqcglma\",\"fzto\",\"xvqlauu\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-05-20T14:39:18Z\",\"reason\":\"Transferred\"},{\"effectiveDate\":\"2021-04-22T04:34:34Z\",\"reason\":\"None\"},{\"effectiveDate\":\"2021-04-05T20:16:23Z\",\"reason\":\"Cancelled\"}]},\"tags\":{\"ssvnonijcqcjo\":\"asthzwji\",\"pdqqbtok\":\"zjku\"},\"id\":\"cuzxllb\",\"name\":\"warhwett\",\"type\":\"hgp\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingSubscriptions() - .listByBillingAccount("xipwqchfpt", false, true, true, "jjlb", "j", "urzyqo", 5215256470958843999L, - 5039546592843976661L, true, "ejxxpx", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("asthzwji", response.iterator().next().tags().get("ssvnonijcqcjo")); - Assertions.assertEquals(AutoRenew.OFF, response.iterator().next().autoRenew()); - Assertions.assertEquals("mbuzginrkjk", response.iterator().next().beneficiaryTenantId()); - Assertions.assertEquals("fsu", response.iterator().next().beneficiary().tenantId()); - Assertions.assertEquals("ybhozlsbufnhb", response.iterator().next().beneficiary().objectId()); - Assertions.assertEquals("ntpoe", response.iterator().next().billingFrequency()); - Assertions.assertEquals("trsljzmzuic", response.iterator().next().billingProfileId()); - Assertions.assertEquals("qbeqpucnu", response.iterator().next().consumptionCostCenter()); - Assertions.assertEquals("yl", response.iterator().next().customerId()); - Assertions.assertEquals("lbofsnqo", response.iterator().next().displayName()); - Assertions.assertEquals("bunvnjql", response.iterator().next().invoiceSectionId()); - Assertions.assertEquals("cachhsizfuew", response.iterator().next().productTypeId()); - Assertions.assertEquals(5461584175424200272L, response.iterator().next().quantity()); - Assertions.assertEquals("pxngzzxqbgq", response.iterator().next().skuId()); - Assertions.assertEquals("ozwbs", response.iterator().next().termDuration()); - Assertions.assertEquals("sqmbinpxmiwtkq", response.iterator().next().provisioningTenantId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByBillingProfileMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByBillingProfileMockTests.java deleted file mode 100644 index 0d34c2955c0f..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByBillingProfileMockTests.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.BillingSubscription; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingSubscriptionsListByBillingProfileMockTests { - @Test - public void testListByBillingProfile() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"autoRenew\":\"Off\",\"beneficiaryTenantId\":\"mpshaezcldkckrn\",\"beneficiary\":{\"tenantId\":\"dm\",\"objectId\":\"ejst\"},\"billingFrequency\":\"macjakgkqwxqd\",\"billingProfileId\":\"qzhxwdjoxwkbdhs\",\"billingPolicies\":{\"nlfhnfzxtfzqyu\":\"cnsbioe\",\"cmwbejywwwvn\":\"tkxncwdytnlr\",\"fyziruqvgnjxiak\":\"wwkrmqevrhhafqfu\"},\"billingProfileDisplayName\":\"jmzbmxg\",\"billingProfileName\":\"yluyugm\",\"consumptionCostCenter\":\"dcv\",\"customerId\":\"oxtv\",\"customerDisplayName\":\"b\",\"customerName\":\"yhmmglvnbenkps\",\"displayName\":\"kkyankxv\",\"enrollmentAccountId\":\"tfgfbhnkxasomaf\",\"enrollmentAccountDisplayName\":\"a\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-09-08T00:03:11Z\",\"subscriptionEnrollmentAccountStatus\":\"Active\"},\"invoiceSectionId\":\"cpautfzptrcdzy\",\"invoiceSectionDisplayName\":\"tffvpkdxcyuwe\",\"invoiceSectionName\":\"qvp\",\"lastMonthCharges\":{\"currency\":\"voqatdjkaldpmec\",\"value\":56.11373},\"monthToDateCharges\":{\"currency\":\"ynfemqyqkkpg\",\"value\":96.19286},\"nextBillingCycleDetails\":{\"billingFrequency\":\"qu\"},\"offerId\":\"irnbnlq\",\"productCategory\":\"dsqx\",\"productType\":\"wdzpvirzyu\",\"productTypeId\":\"qu\",\"purchaseDate\":\"2021-02-12T21:43:05Z\",\"quantity\":4362411346407844482,\"reseller\":{\"resellerId\":\"ouqps\",\"description\":\"andbp\"},\"renewalTermDetails\":{\"billingFrequency\":\"h\",\"productId\":\"xcqcaczzv\",\"productTypeId\":\"ezttqjqyfy\",\"skuId\":\"l\",\"termDuration\":\"slgyfybdsvkllrz\",\"quantity\":5758443646313002971,\"termEndDate\":\"2021-06-11T22:16:10Z\"},\"skuId\":\"hcazkgdjth\",\"skuDescription\":\"gfwhfzhhru\",\"systemOverrides\":{\"cancellation\":\"NotAllowed\",\"cancellationAllowedEndDate\":\"2021-08-27T12:37:12Z\"},\"resourceUri\":\"jcnibz\",\"termDuration\":\"sddcuqddlda\",\"termStartDate\":\"2021-06-07T21:22:20Z\",\"termEndDate\":\"2021-05-18T11:09:45Z\",\"provisioningTenantId\":\"qewqjojesxjht\",\"status\":\"Warned\",\"operationStatus\":\"Other\",\"provisioningState\":\"Creating\",\"subscriptionId\":\"goyineuaxpmezit\",\"suspensionReasons\":[\"zl\",\"eo\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-08-25T11:58:20Z\",\"reason\":\"Other\"},{\"effectiveDate\":\"2021-01-06T14:09:03Z\",\"reason\":\"None\"},{\"effectiveDate\":\"2021-03-31T17:33:49Z\",\"reason\":\"Cancelled\"}]},\"tags\":{\"uajzqxavmitnwly\":\"hgwhlbp\",\"abtpgnqtjtnn\":\"bujysvdtyyddbhat\",\"fspkdnx\":\"jewihcigaahm\"},\"id\":\"z\",\"name\":\"tertnzrrwsc\",\"type\":\"clhdwienvtol\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingSubscriptions() - .listByBillingProfile("dksuo", "tolkyqfnj", false, "rhnxzmfvmw", "nrtc", "rawwhyxf", 1700114838529759514L, - 1324555806675768366L, false, "mvwnbunsodtevzsh", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("hgwhlbp", response.iterator().next().tags().get("uajzqxavmitnwly")); - Assertions.assertEquals(AutoRenew.OFF, response.iterator().next().autoRenew()); - Assertions.assertEquals("mpshaezcldkckrn", response.iterator().next().beneficiaryTenantId()); - Assertions.assertEquals("dm", response.iterator().next().beneficiary().tenantId()); - Assertions.assertEquals("ejst", response.iterator().next().beneficiary().objectId()); - Assertions.assertEquals("macjakgkqwxqd", response.iterator().next().billingFrequency()); - Assertions.assertEquals("qzhxwdjoxwkbdhs", response.iterator().next().billingProfileId()); - Assertions.assertEquals("dcv", response.iterator().next().consumptionCostCenter()); - Assertions.assertEquals("oxtv", response.iterator().next().customerId()); - Assertions.assertEquals("kkyankxv", response.iterator().next().displayName()); - Assertions.assertEquals("cpautfzptrcdzy", response.iterator().next().invoiceSectionId()); - Assertions.assertEquals("qu", response.iterator().next().productTypeId()); - Assertions.assertEquals(4362411346407844482L, response.iterator().next().quantity()); - Assertions.assertEquals("hcazkgdjth", response.iterator().next().skuId()); - Assertions.assertEquals("sddcuqddlda", response.iterator().next().termDuration()); - Assertions.assertEquals("qewqjojesxjht", response.iterator().next().provisioningTenantId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByCustomerAtBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByCustomerAtBillingAccountMockTests.java deleted file mode 100644 index b53e80b5123f..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByCustomerAtBillingAccountMockTests.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.BillingSubscription; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingSubscriptionsListByCustomerAtBillingAccountMockTests { - @Test - public void testListByCustomerAtBillingAccount() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"autoRenew\":\"On\",\"beneficiaryTenantId\":\"sz\",\"beneficiary\":{\"tenantId\":\"ygkxrlfojlclp\",\"objectId\":\"veybodhrvykduum\"},\"billingFrequency\":\"cumjvegp\",\"billingProfileId\":\"tsaujtcoojy\",\"billingPolicies\":{\"xuptsliivmlkw\":\"q\",\"zdekfx\":\"zlinvamtykx\",\"tkdpczeohplrgcnb\":\"sqmzdoz\"},\"billingProfileDisplayName\":\"hvqpkedaxku\",\"billingProfileName\":\"rfjid\",\"consumptionCostCenter\":\"dawe\",\"customerId\":\"avfyihuzsbpw\",\"customerDisplayName\":\"fjcypazwiimd\",\"customerName\":\"gkooagr\",\"displayName\":\"pamesi\",\"enrollmentAccountId\":\"qadewhuwxk\",\"enrollmentAccountDisplayName\":\"iatfamrnaifllxcc\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-09-24T04:28:04Z\",\"subscriptionEnrollmentAccountStatus\":\"TransferredOut\"},\"invoiceSectionId\":\"zwhomydxgtuqbv\",\"invoiceSectionDisplayName\":\"uzihirqvvketydga\",\"invoiceSectionName\":\"ktssgvqxerxrmhr\",\"lastMonthCharges\":{\"currency\":\"gbbjl\",\"value\":34.645718},\"monthToDateCharges\":{\"currency\":\"rxsiyzsyiumtit\",\"value\":56.70846},\"nextBillingCycleDetails\":{\"billingFrequency\":\"vern\"},\"offerId\":\"qpkayqivbigdrqg\",\"productCategory\":\"tboyztgnmu\",\"productType\":\"pwp\",\"productTypeId\":\"m\",\"purchaseDate\":\"2021-06-25T04:25:07Z\",\"quantity\":2374406899966752620,\"reseller\":{\"resellerId\":\"bbdwrje\",\"description\":\"ofeiiewibdtplj\"},\"renewalTermDetails\":{\"billingFrequency\":\"ajokbxxcdk\",\"productId\":\"jwtkftgzl\",\"productTypeId\":\"epmewsjpgbmlbx\",\"skuId\":\"gv\",\"termDuration\":\"p\",\"quantity\":7983017396350517040,\"termEndDate\":\"2021-07-18T03:31:12Z\"},\"skuId\":\"akk\",\"skuDescription\":\"rnaxkczkwohdigey\",\"systemOverrides\":{\"cancellation\":\"NotAllowed\",\"cancellationAllowedEndDate\":\"2021-05-08T10:40:09Z\"},\"resourceUri\":\"modwqbaktvxero\",\"termDuration\":\"zvrnnbegra\",\"termStartDate\":\"2021-11-22T23:15:30Z\",\"termEndDate\":\"2021-05-24T09:39:31Z\",\"provisioningTenantId\":\"ojxgdofmazhk\",\"status\":\"Deleted\",\"operationStatus\":\"LockedForUpdate\",\"provisioningState\":\"Provisioning\",\"subscriptionId\":\"szbwgpmdmwi\",\"suspensionReasons\":[\"vesw\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-05-15T20:01:07Z\",\"reason\":\"PastDue\"}]},\"tags\":{\"cceeeuquuwczzcuj\":\"dargkwim\",\"ajydjbjgip\":\"xvbkirgknhfwlajw\"},\"id\":\"pewyzhydtkbmtrs\",\"name\":\"plviaigarm\",\"type\":\"wokgcneviccw\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingSubscriptions() - .listByCustomerAtBillingAccount("wxyvtkzbhiz", "pusddmw", false, "h", "ju", "uqnkushvl", - 915353011531985316L, 29455565835785630L, false, "aqnirmidt", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("dargkwim", response.iterator().next().tags().get("cceeeuquuwczzcuj")); - Assertions.assertEquals(AutoRenew.ON, response.iterator().next().autoRenew()); - Assertions.assertEquals("sz", response.iterator().next().beneficiaryTenantId()); - Assertions.assertEquals("ygkxrlfojlclp", response.iterator().next().beneficiary().tenantId()); - Assertions.assertEquals("veybodhrvykduum", response.iterator().next().beneficiary().objectId()); - Assertions.assertEquals("cumjvegp", response.iterator().next().billingFrequency()); - Assertions.assertEquals("tsaujtcoojy", response.iterator().next().billingProfileId()); - Assertions.assertEquals("dawe", response.iterator().next().consumptionCostCenter()); - Assertions.assertEquals("avfyihuzsbpw", response.iterator().next().customerId()); - Assertions.assertEquals("pamesi", response.iterator().next().displayName()); - Assertions.assertEquals("zwhomydxgtuqbv", response.iterator().next().invoiceSectionId()); - Assertions.assertEquals("m", response.iterator().next().productTypeId()); - Assertions.assertEquals(2374406899966752620L, response.iterator().next().quantity()); - Assertions.assertEquals("akk", response.iterator().next().skuId()); - Assertions.assertEquals("zvrnnbegra", response.iterator().next().termDuration()); - Assertions.assertEquals("ojxgdofmazhk", response.iterator().next().provisioningTenantId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByCustomerMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByCustomerMockTests.java deleted file mode 100644 index 935f2c7f61f7..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByCustomerMockTests.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.BillingSubscription; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingSubscriptionsListByCustomerMockTests { - @Test - public void testListByCustomer() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"autoRenew\":\"On\",\"beneficiaryTenantId\":\"irnygtixkgyo\",\"beneficiary\":{\"tenantId\":\"phvd\",\"objectId\":\"rxzpqditu\"},\"billingFrequency\":\"ltfci\",\"billingProfileId\":\"lee\",\"billingPolicies\":{\"kkmibnmdp\":\"kehldopjsxvbbwsg\",\"pwtgzwmzhcmrloqa\":\"d\",\"nmbj\":\"styzavkyjjlu\",\"optythctoxo\":\"bngzldvvd\"},\"billingProfileDisplayName\":\"mqnerwh\",\"billingProfileName\":\"vidsssfzsgzgu\",\"consumptionCostCenter\":\"ejomeqgxhwi\",\"customerId\":\"so\",\"customerDisplayName\":\"blw\",\"customerName\":\"baqxaxtuxirppb\",\"displayName\":\"c\",\"enrollmentAccountId\":\"y\",\"enrollmentAccountDisplayName\":\"vuixwonkrn\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-06-04T07:56:37Z\",\"subscriptionEnrollmentAccountStatus\":\"Deleted\"},\"invoiceSectionId\":\"bkitnip\",\"invoiceSectionDisplayName\":\"tgvnaqyj\",\"invoiceSectionName\":\"kajnnewltonop\",\"lastMonthCharges\":{\"currency\":\"miw\",\"value\":51.6954},\"monthToDateCharges\":{\"currency\":\"ba\",\"value\":4.8740387},\"nextBillingCycleDetails\":{\"billingFrequency\":\"cdikqnxydgzfoiqz\"},\"offerId\":\"spa\",\"productCategory\":\"vs\",\"productType\":\"eronzeafkx\",\"productTypeId\":\"uwdbvytqav\",\"purchaseDate\":\"2021-05-20T18:06:38Z\",\"quantity\":348358612136790240,\"reseller\":{\"resellerId\":\"qxlv\",\"description\":\"fdkaxgbiwpgop\"},\"renewalTermDetails\":{\"billingFrequency\":\"tth\",\"productId\":\"rrmtrxgjmpdvrjz\",\"productTypeId\":\"wpewa\",\"skuId\":\"csdjuzmuijt\",\"termDuration\":\"kzo\",\"quantity\":852832535005547504,\"termEndDate\":\"2021-05-31T16:34:29Z\"},\"skuId\":\"xhhboigzxk\",\"skuDescription\":\"qlrzhtocjzfp\",\"systemOverrides\":{\"cancellation\":\"Allowed\",\"cancellationAllowedEndDate\":\"2021-06-06T10:52:23Z\"},\"resourceUri\":\"zwn\",\"termDuration\":\"wgiitvjcmimbms\",\"termStartDate\":\"2021-09-16T17:42:14Z\",\"termEndDate\":\"2021-01-08T07:35:59Z\",\"provisioningTenantId\":\"joypplodaqrbk\",\"status\":\"Deleted\",\"operationStatus\":\"Other\",\"provisioningState\":\"PendingBilling\",\"subscriptionId\":\"ggvalcrqaxlmbrtv\",\"suspensionReasons\":[\"lmlplgt\",\"ayyxhxjvo\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-11-26T22:01:32Z\",\"reason\":\"PolicyViolation\"},{\"effectiveDate\":\"2021-08-27T00:12:05Z\",\"reason\":\"PastDue\"},{\"effectiveDate\":\"2021-09-11T21:02:19Z\",\"reason\":\"PastDue\"},{\"effectiveDate\":\"2021-07-10T02:52:50Z\",\"reason\":\"SuspiciousActivity\"}]},\"tags\":{\"wssydv\":\"ozvcd\",\"vywotjnjuvtzij\":\"ryb\"},\"id\":\"lxbaeyocpk\",\"name\":\"ltjfd\",\"type\":\"fmnpbdrcibj\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingSubscriptions() - .listByCustomer("jy", "kr", "xsg", false, "knklthqw", "pvi", "bmwrvpvdrohul", 4939402553869338194L, - 5092083955941308417L, false, "vxjua", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("ozvcd", response.iterator().next().tags().get("wssydv")); - Assertions.assertEquals(AutoRenew.ON, response.iterator().next().autoRenew()); - Assertions.assertEquals("irnygtixkgyo", response.iterator().next().beneficiaryTenantId()); - Assertions.assertEquals("phvd", response.iterator().next().beneficiary().tenantId()); - Assertions.assertEquals("rxzpqditu", response.iterator().next().beneficiary().objectId()); - Assertions.assertEquals("ltfci", response.iterator().next().billingFrequency()); - Assertions.assertEquals("lee", response.iterator().next().billingProfileId()); - Assertions.assertEquals("ejomeqgxhwi", response.iterator().next().consumptionCostCenter()); - Assertions.assertEquals("so", response.iterator().next().customerId()); - Assertions.assertEquals("c", response.iterator().next().displayName()); - Assertions.assertEquals("bkitnip", response.iterator().next().invoiceSectionId()); - Assertions.assertEquals("uwdbvytqav", response.iterator().next().productTypeId()); - Assertions.assertEquals(348358612136790240L, response.iterator().next().quantity()); - Assertions.assertEquals("xhhboigzxk", response.iterator().next().skuId()); - Assertions.assertEquals("wgiitvjcmimbms", response.iterator().next().termDuration()); - Assertions.assertEquals("joypplodaqrbk", response.iterator().next().provisioningTenantId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByEnrollmentAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByEnrollmentAccountMockTests.java deleted file mode 100644 index 4e5a6b09940d..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByEnrollmentAccountMockTests.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.BillingSubscription; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingSubscriptionsListByEnrollmentAccountMockTests { - @Test - public void testListByEnrollmentAccount() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"autoRenew\":\"Off\",\"beneficiaryTenantId\":\"w\",\"beneficiary\":{\"tenantId\":\"f\",\"objectId\":\"ywmwtacrscfc\"},\"billingFrequency\":\"r\",\"billingProfileId\":\"cullmfwfpoeow\",\"billingPolicies\":{\"mubyguqhgnmsvjfg\":\"zwncsjgfxvc\",\"jxjrbvy\":\"pryyircb\"},\"billingProfileDisplayName\":\"buatxkznlw\",\"billingProfileName\":\"bxogkevdayv\",\"consumptionCostCenter\":\"kxiymzgrg\",\"customerId\":\"alrjwaez\",\"customerDisplayName\":\"ybsps\",\"customerName\":\"mtcepzimfcfs\",\"displayName\":\"wexpasckpgbmly\",\"enrollmentAccountId\":\"wslxgcmxtoejtq\",\"enrollmentAccountDisplayName\":\"ctm\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-06-24T07:55:05Z\",\"subscriptionEnrollmentAccountStatus\":\"TransferredOut\"},\"invoiceSectionId\":\"oluznt\",\"invoiceSectionDisplayName\":\"c\",\"invoiceSectionName\":\"d\",\"lastMonthCharges\":{\"currency\":\"rxiperrplfm\",\"value\":88.23705},\"monthToDateCharges\":{\"currency\":\"fzizx\",\"value\":19.854713},\"nextBillingCycleDetails\":{\"billingFrequency\":\"eba\"},\"offerId\":\"knfvbsymagb\",\"productCategory\":\"dbtjmkuzo\",\"productType\":\"klbizrxhu\",\"productTypeId\":\"vpanloqov\",\"purchaseDate\":\"2021-01-12T04:57:28Z\",\"quantity\":2814888653549476216,\"reseller\":{\"resellerId\":\"ir\",\"description\":\"pgzatu\"},\"renewalTermDetails\":{\"billingFrequency\":\"tjuzvyj\",\"productId\":\"xchquo\",\"productTypeId\":\"qrcsksxq\",\"skuId\":\"lrvuvdagv\",\"termDuration\":\"cdp\",\"quantity\":3609486860009484507,\"termEndDate\":\"2020-12-25T04:39:30Z\"},\"skuId\":\"yodiij\",\"skuDescription\":\"apqhipajsnivnme\",\"systemOverrides\":{\"cancellation\":\"NotAllowed\",\"cancellationAllowedEndDate\":\"2021-05-26T10:51:22Z\"},\"resourceUri\":\"rfgpjf\",\"termDuration\":\"wkseodvlmd\",\"termStartDate\":\"2021-02-12T06:51:52Z\",\"termEndDate\":\"2021-04-01T22:15:16Z\",\"provisioningTenantId\":\"zzugctygbbmumljv\",\"status\":\"Deleted\",\"operationStatus\":\"Other\",\"provisioningState\":\"ConfirmedBilling\",\"subscriptionId\":\"mxwcv\",\"suspensionReasons\":[\"r\",\"tqnk\",\"qjftvltj\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-01-02T17:23:58Z\",\"reason\":\"PolicyViolation\"},{\"effectiveDate\":\"2021-10-20T03:09:01Z\",\"reason\":\"PastDue\"},{\"effectiveDate\":\"2021-03-31T01:20:47Z\",\"reason\":\"Transferred\"}]},\"tags\":{\"smub\":\"fh\",\"psuhsypxmuldhf\":\"zadzglmuu\"},\"id\":\"rkqpyfjxkby\",\"name\":\"sbuqfm\",\"type\":\"bdjkmnxsggnow\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingSubscriptions() - .listByEnrollmentAccount("qy", "clwbjgiynqryoisw", "ofvsxau", "hzefin", 9079705591329630933L, - 2642662027716514618L, true, "gtiivzkd", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("fh", response.iterator().next().tags().get("smub")); - Assertions.assertEquals(AutoRenew.OFF, response.iterator().next().autoRenew()); - Assertions.assertEquals("w", response.iterator().next().beneficiaryTenantId()); - Assertions.assertEquals("f", response.iterator().next().beneficiary().tenantId()); - Assertions.assertEquals("ywmwtacrscfc", response.iterator().next().beneficiary().objectId()); - Assertions.assertEquals("r", response.iterator().next().billingFrequency()); - Assertions.assertEquals("cullmfwfpoeow", response.iterator().next().billingProfileId()); - Assertions.assertEquals("kxiymzgrg", response.iterator().next().consumptionCostCenter()); - Assertions.assertEquals("alrjwaez", response.iterator().next().customerId()); - Assertions.assertEquals("wexpasckpgbmly", response.iterator().next().displayName()); - Assertions.assertEquals("oluznt", response.iterator().next().invoiceSectionId()); - Assertions.assertEquals("vpanloqov", response.iterator().next().productTypeId()); - Assertions.assertEquals(2814888653549476216L, response.iterator().next().quantity()); - Assertions.assertEquals("yodiij", response.iterator().next().skuId()); - Assertions.assertEquals("wkseodvlmd", response.iterator().next().termDuration()); - Assertions.assertEquals("zzugctygbbmumljv", response.iterator().next().provisioningTenantId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByInvoiceSectionMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByInvoiceSectionMockTests.java deleted file mode 100644 index 1b7d10b03205..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsListByInvoiceSectionMockTests.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.BillingSubscription; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingSubscriptionsListByInvoiceSectionMockTests { - @Test - public void testListByInvoiceSection() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"autoRenew\":\"Off\",\"beneficiaryTenantId\":\"lmlnxrcatkuh\",\"beneficiary\":{\"tenantId\":\"gdkvviilyeshoxf\",\"objectId\":\"jdmu\"},\"billingFrequency\":\"usx\",\"billingProfileId\":\"gozwplxzgzumno\",\"billingPolicies\":{\"ybbnhttyizonzsur\":\"xkkbygbgiqkwys\",\"asfzhzzcarc\":\"co\",\"nhwsgns\":\"uoxyipdthjf\"},\"billingProfileDisplayName\":\"tfelfchnuf\",\"billingProfileName\":\"jgbfbba\",\"consumptionCostCenter\":\"xxczzunfnbp\",\"customerId\":\"eeivkbuxlepghc\",\"customerDisplayName\":\"qhqpvtwt\",\"customerName\":\"sclggagygn\",\"displayName\":\"fytnhdnihu\",\"enrollmentAccountId\":\"juzvwgbzdtorbi\",\"enrollmentAccountDisplayName\":\"yfzdp\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-01-04T09:50:23Z\",\"subscriptionEnrollmentAccountStatus\":\"Transferring\"},\"invoiceSectionId\":\"xdte\",\"invoiceSectionDisplayName\":\"bjzrlwtid\",\"invoiceSectionName\":\"zalgmpup\",\"lastMonthCharges\":{\"currency\":\"tyl\",\"value\":40.053802},\"monthToDateCharges\":{\"currency\":\"bgvzlzjsbkpcutza\",\"value\":43.86918},\"nextBillingCycleDetails\":{\"billingFrequency\":\"oknseaimbd\"},\"offerId\":\"aokdarluobb\",\"productCategory\":\"lqwzkny\",\"productType\":\"xysvclfjyclvild\",\"productTypeId\":\"flleirmtxf\",\"purchaseDate\":\"2021-10-13T15:19:11Z\",\"quantity\":773815687306628002,\"reseller\":{\"resellerId\":\"bfo\",\"description\":\"fbpgcryvidbzdy\"},\"renewalTermDetails\":{\"billingFrequency\":\"jatgngwn\",\"productId\":\"ftecgprzsqmpdqc\",\"productTypeId\":\"zbyqhaath\",\"skuId\":\"yxuuc\",\"termDuration\":\"usyrux\",\"quantity\":745280464171597134,\"termEndDate\":\"2021-01-07T19:21:37Z\"},\"skuId\":\"vmgsbpgmncrv\",\"skuDescription\":\"iforomppzsauq\",\"systemOverrides\":{\"cancellation\":\"Allowed\",\"cancellationAllowedEndDate\":\"2021-02-12T04:12:29Z\"},\"resourceUri\":\"mpuai\",\"termDuration\":\"oceqtlyspjymwic\",\"termStartDate\":\"2021-09-24T11:41:36Z\",\"termEndDate\":\"2021-10-08T03:00:47Z\",\"provisioningTenantId\":\"unlakgixhqj\",\"status\":\"Failed\",\"operationStatus\":\"Other\",\"provisioningState\":\"New\",\"subscriptionId\":\"iwtwfgoc\",\"suspensionReasons\":[\"vemnnz\",\"gab\",\"yydsyweoh\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-07-11T12:39:12Z\",\"reason\":\"Transferred\"},{\"effectiveDate\":\"2021-09-10T07:00:11Z\",\"reason\":\"PolicyViolation\"},{\"effectiveDate\":\"2021-02-04T19:43:29Z\",\"reason\":\"Transferred\"},{\"effectiveDate\":\"2021-04-29T08:11:49Z\",\"reason\":\"Cancelled\"}]},\"tags\":{\"caflgzw\":\"ptvdti\",\"oqhgppwxnik\":\"opxdkbt\",\"wvjzrfxa\":\"zrxxfnduvqzjnnu\",\"bkj\":\"tbcqj\"},\"id\":\"rxrjwyzrieitq\",\"name\":\"lzuwtbdzqajxkmp\",\"type\":\"bfhlgeehbd\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.billingSubscriptions() - .listByInvoiceSection("nnno", "tnhvdtu", "amqobqehs", false, "htisyzfeoctr", "jwn", "wckzeb", - 3630290805263235883L, 8818785856570730744L, false, "gyy", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("ptvdti", response.iterator().next().tags().get("caflgzw")); - Assertions.assertEquals(AutoRenew.OFF, response.iterator().next().autoRenew()); - Assertions.assertEquals("lmlnxrcatkuh", response.iterator().next().beneficiaryTenantId()); - Assertions.assertEquals("gdkvviilyeshoxf", response.iterator().next().beneficiary().tenantId()); - Assertions.assertEquals("jdmu", response.iterator().next().beneficiary().objectId()); - Assertions.assertEquals("usx", response.iterator().next().billingFrequency()); - Assertions.assertEquals("gozwplxzgzumno", response.iterator().next().billingProfileId()); - Assertions.assertEquals("xxczzunfnbp", response.iterator().next().consumptionCostCenter()); - Assertions.assertEquals("eeivkbuxlepghc", response.iterator().next().customerId()); - Assertions.assertEquals("fytnhdnihu", response.iterator().next().displayName()); - Assertions.assertEquals("xdte", response.iterator().next().invoiceSectionId()); - Assertions.assertEquals("flleirmtxf", response.iterator().next().productTypeId()); - Assertions.assertEquals(773815687306628002L, response.iterator().next().quantity()); - Assertions.assertEquals("vmgsbpgmncrv", response.iterator().next().skuId()); - Assertions.assertEquals("oceqtlyspjymwic", response.iterator().next().termDuration()); - Assertions.assertEquals("unlakgixhqj", response.iterator().next().provisioningTenantId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsMergeMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsMergeMockTests.java deleted file mode 100644 index 06d1388fa21f..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsMergeMockTests.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.BillingSubscription; -import com.azure.resourcemanager.billing.models.BillingSubscriptionMergeRequest; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingSubscriptionsMergeMockTests { - @Test - public void testMerge() throws Exception { - String responseStr - = "{\"properties\":{\"autoRenew\":\"Off\",\"beneficiaryTenantId\":\"kqmierzr\",\"beneficiary\":{\"tenantId\":\"vvequz\",\"objectId\":\"apg\"},\"billingFrequency\":\"hzbjecdsysxnkuhv\",\"billingProfileId\":\"lsevzc\",\"billingPolicies\":{\"ymxsfqeaxdqelu\":\"nkkgdw\",\"vvzfzn\":\"msaqhviawgqrwu\",\"ieasklkqcl\":\"gpbcbkcpympd\",\"hlyyuah\":\"fusrgnoskkhbmj\"},\"billingProfileDisplayName\":\"eikbvqzr\",\"billingProfileName\":\"gbqaucpckx\",\"consumptionCostCenter\":\"ohafwmfpg\",\"customerId\":\"yx\",\"customerDisplayName\":\"gpeametsdw\",\"customerName\":\"amtxccfegsavbg\",\"displayName\":\"ucv\",\"enrollmentAccountId\":\"ndh\",\"enrollmentAccountDisplayName\":\"ima\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-01-06T10:12:50Z\",\"subscriptionEnrollmentAccountStatus\":\"Deleted\"},\"invoiceSectionId\":\"gdmfvybfmpot\",\"invoiceSectionDisplayName\":\"opfigrxxtrcodbqe\",\"invoiceSectionName\":\"ldmxxbjh\",\"lastMonthCharges\":{\"currency\":\"amsxrwqlwdflgqrp\",\"value\":42.4117},\"monthToDateCharges\":{\"currency\":\"v\",\"value\":2.1529973},\"nextBillingCycleDetails\":{\"billingFrequency\":\"fgxtaelxtpfcy\"},\"offerId\":\"bx\",\"productCategory\":\"rvyvtkmxvztshn\",\"productType\":\"fbpeigkflvovriq\",\"productTypeId\":\"z\",\"purchaseDate\":\"2021-09-26T23:47:15Z\",\"quantity\":945739021633168589,\"reseller\":{\"resellerId\":\"gtdjhtbarptxurs\",\"description\":\"yyumhzpst\"},\"renewalTermDetails\":{\"billingFrequency\":\"acvt\",\"productId\":\"hpbilnszyjbuwuu\",\"productTypeId\":\"ydscizvkayioxpq\",\"skuId\":\"sbl\",\"termDuration\":\"efeombo\",\"quantity\":6001894924580740479,\"termEndDate\":\"2021-02-27T13:02:25Z\"},\"skuId\":\"kqsjymcfvvzceuyu\",\"skuDescription\":\"tc\",\"systemOverrides\":{\"cancellation\":\"Allowed\",\"cancellationAllowedEndDate\":\"2021-01-24T12:45:56Z\"},\"resourceUri\":\"xr\",\"termDuration\":\"cmlzvvr\",\"termStartDate\":\"2021-12-05T18:21:10Z\",\"termEndDate\":\"2021-12-07T07:00:37Z\",\"provisioningTenantId\":\"sacjq\",\"status\":\"Disabled\",\"operationStatus\":\"Other\",\"provisioningState\":\"Succeeded\",\"subscriptionId\":\"awapnd\",\"suspensionReasons\":[\"vmkmzv\",\"gqx\",\"bls\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-05-04T09:37:18Z\",\"reason\":\"Transferred\"},{\"effectiveDate\":\"2021-06-30T19:35:19Z\",\"reason\":\"SpendingLimitReached\"},{\"effectiveDate\":\"2021-06-22T02:54:21Z\",\"reason\":\"SpendingLimitReached\"},{\"effectiveDate\":\"2021-05-01T23:55:26Z\",\"reason\":\"Expired\"}]},\"tags\":{\"yx\":\"vbbnasg\",\"q\":\"sxc\",\"bpqcnx\":\"m\",\"uufhpdncokqrg\":\"kehojvmazuflfp\"},\"id\":\"bhmnimjly\",\"name\":\"b\",\"type\":\"fnmmib\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingSubscription response = manager.billingSubscriptions() - .merge("gplnl", "rfe", - new BillingSubscriptionMergeRequest().withTargetBillingSubscriptionName("unbu").withQuantity(934578122), - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("vbbnasg", response.tags().get("yx")); - Assertions.assertEquals(AutoRenew.OFF, response.autoRenew()); - Assertions.assertEquals("kqmierzr", response.beneficiaryTenantId()); - Assertions.assertEquals("vvequz", response.beneficiary().tenantId()); - Assertions.assertEquals("apg", response.beneficiary().objectId()); - Assertions.assertEquals("hzbjecdsysxnkuhv", response.billingFrequency()); - Assertions.assertEquals("lsevzc", response.billingProfileId()); - Assertions.assertEquals("ohafwmfpg", response.consumptionCostCenter()); - Assertions.assertEquals("yx", response.customerId()); - Assertions.assertEquals("ucv", response.displayName()); - Assertions.assertEquals("gdmfvybfmpot", response.invoiceSectionId()); - Assertions.assertEquals("z", response.productTypeId()); - Assertions.assertEquals(945739021633168589L, response.quantity()); - Assertions.assertEquals("kqsjymcfvvzceuyu", response.skuId()); - Assertions.assertEquals("cmlzvvr", response.termDuration()); - Assertions.assertEquals("sacjq", response.provisioningTenantId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsMoveMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsMoveMockTests.java deleted file mode 100644 index 0d05c240e64a..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsMoveMockTests.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.BillingSubscription; -import com.azure.resourcemanager.billing.models.MoveBillingSubscriptionRequest; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingSubscriptionsMoveMockTests { - @Test - public void testMove() throws Exception { - String responseStr - = "{\"properties\":{\"autoRenew\":\"Off\",\"beneficiaryTenantId\":\"agw\",\"beneficiary\":{\"tenantId\":\"jkcgeen\",\"objectId\":\"rfkjfkxnwtzsr\"},\"billingFrequency\":\"qcrjvcjskqsfnmi\",\"billingProfileId\":\"pdunhd\",\"billingPolicies\":{\"nh\":\"tzmtuv\",\"ibxl\":\"tjk\",\"u\":\"zlvkcm\"},\"billingProfileDisplayName\":\"u\",\"billingProfileName\":\"odincfbaoboiahk\",\"consumptionCostCenter\":\"svaxmksaxyeedvp\",\"customerId\":\"dktdutyd\",\"customerDisplayName\":\"gkmorbpcjes\",\"customerName\":\"vuztnsvmsh\",\"displayName\":\"gygfohrm\",\"enrollmentAccountId\":\"hlclpkr\",\"enrollmentAccountDisplayName\":\"cbmjjviutivr\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-01-20T08:22:29Z\",\"subscriptionEnrollmentAccountStatus\":\"Cancelled\"},\"invoiceSectionId\":\"r\",\"invoiceSectionDisplayName\":\"ftj\",\"invoiceSectionName\":\"ilohlgrjcxh\",\"lastMonthCharges\":{\"currency\":\"z\",\"value\":3.03908},\"monthToDateCharges\":{\"currency\":\"fo\",\"value\":62.66415},\"nextBillingCycleDetails\":{\"billingFrequency\":\"lyumb\"},\"offerId\":\"prlnuom\",\"productCategory\":\"hdkhmemxka\",\"productType\":\"pesnb\",\"productTypeId\":\"ullyfzmnxr\",\"purchaseDate\":\"2021-05-27T15:57:33Z\",\"quantity\":5175214706521360655,\"reseller\":{\"resellerId\":\"tjgzkmwf\",\"description\":\"l\"},\"renewalTermDetails\":{\"billingFrequency\":\"fmdjsiomm\",\"productId\":\"ph\",\"productTypeId\":\"lxrcb\",\"skuId\":\"pfcghdtt\",\"termDuration\":\"qxxcpbzxpzloov\",\"quantity\":1999219039687756838,\"termEndDate\":\"2021-04-11T00:33:14Z\"},\"skuId\":\"cvzuzpkf\",\"skuDescription\":\"motquqlqey\",\"systemOverrides\":{\"cancellation\":\"Allowed\",\"cancellationAllowedEndDate\":\"2021-08-31T07:33:03Z\"},\"resourceUri\":\"sdpfvlsqmmetwtl\",\"termDuration\":\"nkjtefbd\",\"termStartDate\":\"2021-01-25T23:22:15Z\",\"termEndDate\":\"2021-07-30T03:49:29Z\",\"provisioningTenantId\":\"cgrllyyfsmoc\",\"status\":\"Unknown\",\"operationStatus\":\"None\",\"provisioningState\":\"Succeeded\",\"subscriptionId\":\"tvzhu\",\"suspensionReasons\":[\"ykg\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-09-26T10:38:22Z\",\"reason\":\"PolicyViolation\"},{\"effectiveDate\":\"2021-03-28T12:16:52Z\",\"reason\":\"SuspiciousActivity\"},{\"effectiveDate\":\"2021-02-11T15:23:56Z\",\"reason\":\"PastDue\"}]},\"tags\":{\"creluedcmk\":\"nyotgnmze\",\"hllxwknoo\":\"yhheexz\"},\"id\":\"jklfsdntkqiym\",\"name\":\"ddslwnl\",\"type\":\"jdlhmkspybn\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingSubscription response = manager.billingSubscriptions() - .move("wcduyrgcay", "umqeobrwreu", - new MoveBillingSubscriptionRequest().withDestinationInvoiceSectionId("sawha") - .withDestinationEnrollmentAccountId("gsqz"), - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("nyotgnmze", response.tags().get("creluedcmk")); - Assertions.assertEquals(AutoRenew.OFF, response.autoRenew()); - Assertions.assertEquals("agw", response.beneficiaryTenantId()); - Assertions.assertEquals("jkcgeen", response.beneficiary().tenantId()); - Assertions.assertEquals("rfkjfkxnwtzsr", response.beneficiary().objectId()); - Assertions.assertEquals("qcrjvcjskqsfnmi", response.billingFrequency()); - Assertions.assertEquals("pdunhd", response.billingProfileId()); - Assertions.assertEquals("svaxmksaxyeedvp", response.consumptionCostCenter()); - Assertions.assertEquals("dktdutyd", response.customerId()); - Assertions.assertEquals("gygfohrm", response.displayName()); - Assertions.assertEquals("r", response.invoiceSectionId()); - Assertions.assertEquals("ullyfzmnxr", response.productTypeId()); - Assertions.assertEquals(5175214706521360655L, response.quantity()); - Assertions.assertEquals("cvzuzpkf", response.skuId()); - Assertions.assertEquals("nkjtefbd", response.termDuration()); - Assertions.assertEquals("cgrllyyfsmoc", response.provisioningTenantId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsSplitMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsSplitMockTests.java deleted file mode 100644 index 994d260e0948..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsSplitMockTests.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.BillingSubscription; -import com.azure.resourcemanager.billing.models.BillingSubscriptionSplitRequest; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingSubscriptionsSplitMockTests { - @Test - public void testSplit() throws Exception { - String responseStr - = "{\"properties\":{\"autoRenew\":\"Off\",\"beneficiaryTenantId\":\"fwqjzybmfqdnpp\",\"beneficiary\":{\"tenantId\":\"guamrvamuv\",\"objectId\":\"dwpj\"},\"billingFrequency\":\"lukgctvnsp\",\"billingProfileId\":\"syydjlhdukcsqvye\",\"billingPolicies\":{\"jwum\":\"hul\",\"nonxemhqpz\":\"jdymeqvnxpfyxdjs\",\"vgcm\":\"nat\",\"fevtwllqy\":\"vdjlww\"},\"billingProfileDisplayName\":\"jcoyvfwgk\",\"billingProfileName\":\"h\",\"consumptionCostCenter\":\"hx\",\"customerId\":\"ckwbqwj\",\"customerDisplayName\":\"mmkwahrooy\",\"customerName\":\"obnvyue\",\"displayName\":\"coerohextigukfk\",\"enrollmentAccountId\":\"ycb\",\"enrollmentAccountDisplayName\":\"mbnpeenlq\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-02-26T06:07:10Z\",\"subscriptionEnrollmentAccountStatus\":\"Expired\"},\"invoiceSectionId\":\"s\",\"invoiceSectionDisplayName\":\"qdvfj\",\"invoiceSectionName\":\"qephtoshqt\",\"lastMonthCharges\":{\"currency\":\"jwgujrc\",\"value\":5.7484865},\"monthToDateCharges\":{\"currency\":\"pyqoizfyasyddq\",\"value\":97.7696},\"nextBillingCycleDetails\":{\"billingFrequency\":\"wyyeomiflrvfe\"},\"offerId\":\"ctshwfrhhasabvau\",\"productCategory\":\"wwumkbpgcilbwtp\",\"productType\":\"j\",\"productTypeId\":\"fwuqprpdgitenyu\",\"purchaseDate\":\"2021-12-09T00:28:28Z\",\"quantity\":8642064745873895570,\"reseller\":{\"resellerId\":\"xghamrplanchqot\",\"description\":\"xlmxejwyvjzbj\"},\"renewalTermDetails\":{\"billingFrequency\":\"uekbbypqsmp\",\"productId\":\"eqieiux\",\"productTypeId\":\"uwnda\",\"skuId\":\"jjhrgkjjpc\",\"termDuration\":\"hlzyxvtajfjat\",\"quantity\":3144927729864828326,\"termEndDate\":\"2021-10-06T22:54:34Z\"},\"skuId\":\"rdgcpzanaqven\",\"skuDescription\":\"puelrnanbrpkocux\",\"systemOverrides\":{\"cancellation\":\"Allowed\",\"cancellationAllowedEndDate\":\"2021-03-12T16:25:40Z\"},\"resourceUri\":\"jltckiwxggfagi\",\"termDuration\":\"mdboefnhxhahuq\",\"termStartDate\":\"2021-06-06T02:38:34Z\",\"termEndDate\":\"2021-04-04T13:10:23Z\",\"provisioningTenantId\":\"odmokrqdbsgkq\",\"status\":\"Expired\",\"operationStatus\":\"None\",\"provisioningState\":\"Succeeded\",\"subscriptionId\":\"jxhyzzlocjhzppdb\",\"suspensionReasons\":[\"cxbofpr\",\"mivapesbfzllej\",\"wwsfvtgh\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-11-03T21:58:42Z\",\"reason\":\"Other\"},{\"effectiveDate\":\"2021-09-05T19:05:33Z\",\"reason\":\"Transferred\"}]},\"tags\":{\"sprbxj\":\"vel\",\"de\":\"ezujtoud\"},\"id\":\"mvssr\",\"name\":\"ciexu\",\"type\":\"emt\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingSubscription response = manager.billingSubscriptions() - .split("nlpqd", "nskatupm", - new BillingSubscriptionSplitRequest().withTargetProductTypeId("lwknrdvvmbjernd") - .withTargetSkuId("ywxqr") - .withQuantity(1444417321) - .withTermDuration("kdeetnne") - .withBillingFrequency("utlkszuxjmrz"), - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("vel", response.tags().get("sprbxj")); - Assertions.assertEquals(AutoRenew.OFF, response.autoRenew()); - Assertions.assertEquals("fwqjzybmfqdnpp", response.beneficiaryTenantId()); - Assertions.assertEquals("guamrvamuv", response.beneficiary().tenantId()); - Assertions.assertEquals("dwpj", response.beneficiary().objectId()); - Assertions.assertEquals("lukgctvnsp", response.billingFrequency()); - Assertions.assertEquals("syydjlhdukcsqvye", response.billingProfileId()); - Assertions.assertEquals("hx", response.consumptionCostCenter()); - Assertions.assertEquals("ckwbqwj", response.customerId()); - Assertions.assertEquals("coerohextigukfk", response.displayName()); - Assertions.assertEquals("s", response.invoiceSectionId()); - Assertions.assertEquals("fwuqprpdgitenyu", response.productTypeId()); - Assertions.assertEquals(8642064745873895570L, response.quantity()); - Assertions.assertEquals("rdgcpzanaqven", response.skuId()); - Assertions.assertEquals("mdboefnhxhahuq", response.termDuration()); - Assertions.assertEquals("odmokrqdbsgkq", response.provisioningTenantId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsUpdateMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsUpdateMockTests.java deleted file mode 100644 index cae3ad297ed9..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/BillingSubscriptionsUpdateMockTests.java +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.Beneficiary; -import com.azure.resourcemanager.billing.models.BillingSubscription; -import com.azure.resourcemanager.billing.models.BillingSubscriptionPatch; -import com.azure.resourcemanager.billing.models.SystemOverrides; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class BillingSubscriptionsUpdateMockTests { - @Test - public void testUpdate() throws Exception { - String responseStr - = "{\"properties\":{\"autoRenew\":\"On\",\"beneficiaryTenantId\":\"rvpa\",\"beneficiary\":{\"tenantId\":\"deex\",\"objectId\":\"juguvnxbo\"},\"billingFrequency\":\"zurnzoytkbeadyf\",\"billingProfileId\":\"rozoijo\",\"billingPolicies\":{\"hsxw\":\"pkiwseacbtaxdrpa\",\"dacrq\":\"xrz\",\"ysyajmm\":\"wkkg\"},\"billingProfileDisplayName\":\"updc\",\"billingProfileName\":\"rufs\",\"consumptionCostCenter\":\"kuxkdiumgs\",\"customerId\":\"xwkscw\",\"customerDisplayName\":\"hfihvlm\",\"customerName\":\"eylaulpuexy\",\"displayName\":\"xztyecxdslspg\",\"enrollmentAccountId\":\"d\",\"enrollmentAccountDisplayName\":\"y\",\"enrollmentAccountSubscriptionDetails\":{\"enrollmentAccountStartDate\":\"2021-04-22T17:12:01Z\",\"subscriptionEnrollmentAccountStatus\":\"Transferring\"},\"invoiceSectionId\":\"vsv\",\"invoiceSectionDisplayName\":\"ltaprq\",\"invoiceSectionName\":\"kmvzrkpmonxdwf\",\"lastMonthCharges\":{\"currency\":\"bgftfvqukkm\",\"value\":71.73403},\"monthToDateCharges\":{\"currency\":\"gpdqrjyl\",\"value\":20.2398},\"nextBillingCycleDetails\":{\"billingFrequency\":\"mjhhxls\"},\"offerId\":\"ehztbejrdzwy\",\"productCategory\":\"dp\",\"productType\":\"wufifnj\",\"productTypeId\":\"hmjkykqf\",\"purchaseDate\":\"2021-05-15T09:53:50Z\",\"quantity\":1971220922186606928,\"reseller\":{\"resellerId\":\"ysmkbndnrihpja\",\"description\":\"cbeejnoignydlkr\"},\"renewalTermDetails\":{\"billingFrequency\":\"bnmrmhkipjardvdp\",\"productId\":\"wdxmiaelnp\",\"productTypeId\":\"eclundd\",\"skuId\":\"lpbjszqj\",\"termDuration\":\"kjvaycxrwknsbg\",\"quantity\":5955357506701250430,\"termEndDate\":\"2021-11-08T12:22:43Z\"},\"skuId\":\"iypzcyh\",\"skuDescription\":\"cebtpgvut\",\"systemOverrides\":{\"cancellation\":\"NotAllowed\",\"cancellationAllowedEndDate\":\"2021-07-24T18:42:41Z\"},\"resourceUri\":\"wq\",\"termDuration\":\"cowken\",\"termStartDate\":\"2021-08-15T03:44:16Z\",\"termEndDate\":\"2021-11-19T18:35:36Z\",\"provisioningTenantId\":\"flxq\",\"status\":\"Failed\",\"operationStatus\":\"Other\",\"provisioningState\":\"Succeeded\",\"subscriptionId\":\"uwgnyjdiujtic\",\"suspensionReasons\":[\"fzlhibf\"],\"suspensionReasonDetails\":[{\"effectiveDate\":\"2021-06-24T10:24:57Z\",\"reason\":\"Other\"}]},\"tags\":{\"vvdgnmeiom\":\"jkuf\",\"zaisfofg\":\"obbaibcfbfy\",\"ifmyzb\":\"mrkm\",\"lptbdponhblqi\":\"hdnhhcmt\"},\"id\":\"nuqfpzjzzbpcwtw\",\"name\":\"rchkcmruawqesqs\",\"type\":\"mie\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingSubscription response = manager.billingSubscriptions() - .update("cznvzmsvzn", "heqzhehgvmm", - new BillingSubscriptionPatch() - .withTags(mapOf("m", "hcnnkvthwtam", "cocdxvbeqzjd", "gyvxhfmuhkezuucq", "ytlxugjr", "xtutpdwneec", - "fbvhgykzov", "vnffaofkvfruxz")) - .withAutoRenew(AutoRenew.ON) - .withBeneficiaryTenantId("nbnyplu") - .withBeneficiary(new Beneficiary().withTenantId("kfcdfux").withObjectId("zvxotnoilqcdvhy")) - .withBillingFrequency("qhxytsq") - .withBillingProfileId("wcacwaaqakvokyax") - .withConsumptionCostCenter("jhmnaphrsk") - .withCustomerId("e") - .withDisplayName("ntteyrftxytja") - .withInvoiceSectionId("j") - .withProductTypeId("nat") - .withQuantity(6291558623280922400L) - .withSkuId("xdm") - .withSystemOverrides(new SystemOverrides()) - .withTermDuration("nzi") - .withProvisioningTenantId("rwxxqkwargcbgdg"), - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("jkuf", response.tags().get("vvdgnmeiom")); - Assertions.assertEquals(AutoRenew.ON, response.autoRenew()); - Assertions.assertEquals("rvpa", response.beneficiaryTenantId()); - Assertions.assertEquals("deex", response.beneficiary().tenantId()); - Assertions.assertEquals("juguvnxbo", response.beneficiary().objectId()); - Assertions.assertEquals("zurnzoytkbeadyf", response.billingFrequency()); - Assertions.assertEquals("rozoijo", response.billingProfileId()); - Assertions.assertEquals("kuxkdiumgs", response.consumptionCostCenter()); - Assertions.assertEquals("xwkscw", response.customerId()); - Assertions.assertEquals("xztyecxdslspg", response.displayName()); - Assertions.assertEquals("vsv", response.invoiceSectionId()); - Assertions.assertEquals("hmjkykqf", response.productTypeId()); - Assertions.assertEquals(1971220922186606928L, response.quantity()); - Assertions.assertEquals("iypzcyh", response.skuId()); - Assertions.assertEquals("cowken", response.termDuration()); - Assertions.assertEquals("flxq", response.provisioningTenantId()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CancelSubscriptionRequestTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CancelSubscriptionRequestTests.java deleted file mode 100644 index 8b8a0d4da11b..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CancelSubscriptionRequestTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.CancellationReason; -import com.azure.resourcemanager.billing.models.CancelSubscriptionRequest; -import org.junit.jupiter.api.Assertions; - -public final class CancelSubscriptionRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CancelSubscriptionRequest model - = BinaryData.fromString("{\"cancellationReason\":\"Other\",\"customerId\":\"xzji\"}") - .toObject(CancelSubscriptionRequest.class); - Assertions.assertEquals(CancellationReason.OTHER, model.cancellationReason()); - Assertions.assertEquals("xzji", model.customerId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CancelSubscriptionRequest model - = new CancelSubscriptionRequest().withCancellationReason(CancellationReason.OTHER).withCustomerId("xzji"); - model = BinaryData.fromObject(model).toObject(CancelSubscriptionRequest.class); - Assertions.assertEquals(CancellationReason.OTHER, model.cancellationReason()); - Assertions.assertEquals("xzji", model.customerId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CheckAccessRequestTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CheckAccessRequestTests.java deleted file mode 100644 index 6ee138d2802a..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CheckAccessRequestTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.CheckAccessRequest; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class CheckAccessRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CheckAccessRequest model = BinaryData.fromString("{\"actions\":[\"io\",\"rqhakauha\",\"hsfwxosowzxcug\"]}") - .toObject(CheckAccessRequest.class); - Assertions.assertEquals("io", model.actions().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CheckAccessRequest model - = new CheckAccessRequest().withActions(Arrays.asList("io", "rqhakauha", "hsfwxosowzxcug")); - model = BinaryData.fromObject(model).toObject(CheckAccessRequest.class); - Assertions.assertEquals("io", model.actions().get(0)); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CheckAccessResponseInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CheckAccessResponseInnerTests.java deleted file mode 100644 index cd452a3b14c4..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CheckAccessResponseInnerTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.CheckAccessResponseInner; - -public final class CheckAccessResponseInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CheckAccessResponseInner model - = BinaryData.fromString("{\"accessDecision\":\"Allowed\",\"action\":\"oxdjebwpuc\"}") - .toObject(CheckAccessResponseInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CheckAccessResponseInner model = new CheckAccessResponseInner(); - model = BinaryData.fromObject(model).toObject(CheckAccessResponseInner.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomerInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomerInnerTests.java deleted file mode 100644 index e8df09c4a8f1..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomerInnerTests.java +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.CustomerInner; -import com.azure.resourcemanager.billing.models.AzurePlan; -import com.azure.resourcemanager.billing.models.CustomerProperties; -import com.azure.resourcemanager.billing.models.Reseller; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class CustomerInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CustomerInner model = BinaryData.fromString( - "{\"properties\":{\"billingProfileDisplayName\":\"ma\",\"billingProfileId\":\"pdwwexymzvlazi\",\"displayName\":\"hpwvqsgnyyuu\",\"systemId\":\"vensrpm\",\"status\":\"Active\",\"enabledAzurePlans\":[{\"productId\":\"patlbijp\",\"skuId\":\"sksrfhfvolmknbn\",\"skuDescription\":\"cdommpvfqaw\"},{\"productId\":\"gbrt\",\"skuId\":\"iac\",\"skuDescription\":\"iexhajl\"},{\"productId\":\"t\",\"skuId\":\"qfyuttd\",\"skuDescription\":\"gbpvnwswmtxkyct\"},{\"productId\":\"gzwx\",\"skuId\":\"mecvogygzyvneeza\",\"skuDescription\":\"gh\"}],\"resellers\":[{\"resellerId\":\"qtlffhzbk\",\"description\":\"jjjavfqnvhnq\"},{\"resellerId\":\"wdogiyetesyp\",\"description\":\"dbztjhqtfbov\"}],\"tags\":{\"hpsprkzyaupiac\":\"kbwetnj\"}},\"tags\":{\"urjtumghi\":\"afbwqroohtuovmao\"},\"id\":\"ve\",\"name\":\"mslclblyjxlt\",\"type\":\"sjuscvsfxigctmg\"}") - .toObject(CustomerInner.class); - Assertions.assertEquals("afbwqroohtuovmao", model.tags().get("urjtumghi")); - Assertions.assertEquals("patlbijp", model.properties().enabledAzurePlans().get(0).productId()); - Assertions.assertEquals("sksrfhfvolmknbn", model.properties().enabledAzurePlans().get(0).skuId()); - Assertions.assertEquals("cdommpvfqaw", model.properties().enabledAzurePlans().get(0).skuDescription()); - Assertions.assertEquals("kbwetnj", model.properties().tags().get("hpsprkzyaupiac")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CustomerInner model = new CustomerInner().withTags(mapOf("urjtumghi", "afbwqroohtuovmao")) - .withProperties(new CustomerProperties() - .withEnabledAzurePlans(Arrays.asList( - new AzurePlan().withProductId("patlbijp") - .withSkuId("sksrfhfvolmknbn") - .withSkuDescription("cdommpvfqaw"), - new AzurePlan().withProductId("gbrt").withSkuId("iac").withSkuDescription("iexhajl"), - new AzurePlan().withProductId("t").withSkuId("qfyuttd").withSkuDescription("gbpvnwswmtxkyct"), - new AzurePlan().withProductId("gzwx").withSkuId("mecvogygzyvneeza").withSkuDescription("gh"))) - .withResellers(Arrays.asList(new Reseller(), new Reseller())) - .withTags(mapOf("hpsprkzyaupiac", "kbwetnj"))); - model = BinaryData.fromObject(model).toObject(CustomerInner.class); - Assertions.assertEquals("afbwqroohtuovmao", model.tags().get("urjtumghi")); - Assertions.assertEquals("patlbijp", model.properties().enabledAzurePlans().get(0).productId()); - Assertions.assertEquals("sksrfhfvolmknbn", model.properties().enabledAzurePlans().get(0).skuId()); - Assertions.assertEquals("cdommpvfqaw", model.properties().enabledAzurePlans().get(0).skuDescription()); - Assertions.assertEquals("kbwetnj", model.properties().tags().get("hpsprkzyaupiac")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomerListResultTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomerListResultTests.java deleted file mode 100644 index 00cff254b580..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomerListResultTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.CustomerListResult; - -public final class CustomerListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CustomerListResult model = BinaryData.fromString( - "{\"nextLink\":\"gjonmcy\",\"value\":[{\"properties\":{\"billingProfileDisplayName\":\"bamwineo\",\"billingProfileId\":\"fkak\",\"displayName\":\"ldtve\",\"systemId\":\"oclzhz\",\"status\":\"UnderReview\",\"enabledAzurePlans\":[{\"productId\":\"gvttx\",\"skuId\":\"rupzaamrdixtre\",\"skuDescription\":\"dswys\"},{\"productId\":\"ruffgllukk\",\"skuId\":\"vlxhrpqhvmblc\",\"skuDescription\":\"qehbhbcds\"},{\"productId\":\"ryrando\",\"skuId\":\"mbltoo\",\"skuDescription\":\"kfqlwx\"}],\"resellers\":[{\"resellerId\":\"alsygao\",\"description\":\"jpnnbmjksibjgsj\"},{\"resellerId\":\"xahmrnadzyqegxy\",\"description\":\"pinbmhwbjijkgqxn\"}],\"tags\":{\"nggiycwkdtaa\":\"keznjaujvaa\",\"ekaum\":\"xw\"}},\"tags\":{\"atbnxwbj\":\"mbzmqk\",\"dgo\":\"idbirkfpkso\"},\"id\":\"wijymr\",\"name\":\"bguzozky\",\"type\":\"wnf\"},{\"properties\":{\"billingProfileDisplayName\":\"hhqosmffjku\",\"billingProfileId\":\"cyar\",\"displayName\":\"oohguabzoghkt\",\"systemId\":\"yczhco\",\"status\":\"Pending\",\"enabledAzurePlans\":[{\"productId\":\"qr\",\"skuId\":\"tjzcfyjzpt\",\"skuDescription\":\"lohap\"},{\"productId\":\"nfszpyglqdhmrjz\",\"skuId\":\"l\",\"skuDescription\":\"pjby\"}],\"resellers\":[{\"resellerId\":\"o\",\"description\":\"jenkyh\"},{\"resellerId\":\"zv\",\"description\":\"xfxjelgcmpzqj\"},{\"resellerId\":\"hqxu\",\"description\":\"vcacoyv\"},{\"resellerId\":\"bsizus\",\"description\":\"zlbscmnlziji\"}],\"tags\":{\"flnwy\":\"hgm\",\"iylylyfw\":\"qkxrerl\",\"yjtcdxabbujftab\":\"zutgqztwhghmupg\"}},\"tags\":{\"cafeddw\":\"bklqpxz\",\"ookrtalvnbw\":\"nlzafwxudgnh\",\"uclvdjj\":\"pbeme\"},\"id\":\"yrdnqod\",\"name\":\"ahhxhqfaqnvzoqg\",\"type\":\"ipemchgavscz\"},{\"properties\":{\"billingProfileDisplayName\":\"dtx\",\"billingProfileId\":\"lghwzhome\",\"displayName\":\"j\",\"systemId\":\"liuhqawmoaiancz\",\"status\":\"UnderReview\",\"enabledAzurePlans\":[{\"productId\":\"slblxydkxrxvvb\",\"skuId\":\"wkgfbqljnqkh\",\"skuDescription\":\"h\"},{\"productId\":\"okulehurqlrqf\",\"skuId\":\"weyurkphyjd\",\"skuDescription\":\"av\"},{\"productId\":\"qdbrxmrgc\",\"skuId\":\"apx\",\"skuDescription\":\"y\"}],\"resellers\":[{\"resellerId\":\"bajbuscgduusi\",\"description\":\"cblevpmc\"}],\"tags\":{\"sjgkzzltafh\":\"yxkyxlz\"}},\"tags\":{\"dwnapf\":\"fovwmbjlzqsczpg\",\"tkschgcgqyhl\":\"qwowftptnuw\",\"kwiswskukjtas\":\"seyqrhvyeldotjv\",\"xkdtxfkndlqvtwkn\":\"vwisp\"},\"id\":\"mmbugtywatmqaq\",\"name\":\"ueatgroe\",\"type\":\"hoygzcbyfq\"},{\"properties\":{\"billingProfileDisplayName\":\"aoyte\",\"billingProfileId\":\"puvjmvqmtd\",\"displayName\":\"kygroejnndljdj\",\"systemId\":\"kb\",\"status\":\"Disabled\",\"enabledAzurePlans\":[{\"productId\":\"kceysfaqegplw\",\"skuId\":\"shwddkvbxgk\",\"skuDescription\":\"sybwptdaca\"},{\"productId\":\"vlf\",\"skuId\":\"ymtpo\",\"skuDescription\":\"enazerohzrsqals\"},{\"productId\":\"dnwqapfg\",\"skuId\":\"pcvessm\",\"skuDescription\":\"h\"},{\"productId\":\"uipldqq\",\"skuId\":\"ekvalblhtjq\",\"skuDescription\":\"yvwehtaemxh\"}],\"resellers\":[{\"resellerId\":\"ev\",\"description\":\"xivzrrry\"}],\"tags\":{\"uzkaftjvvruxwi\":\"mipskdyzatv\",\"mjtgrqg\":\"syeipqd\",\"wtbbaedorvvmqf\":\"gkkileplkcsmkn\",\"dhp\":\"oygbdgwumgxd\"}},\"tags\":{\"qwotmmwllcol\":\"dexjddvjs\",\"xcgjokjljnhvlq\":\"rsxaptefh\"},\"id\":\"ek\",\"name\":\"eeksnbksdqhjvyk\",\"type\":\"xeslkhhustcpoqm\"}]}") - .toObject(CustomerListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CustomerListResult model = new CustomerListResult(); - model = BinaryData.fromObject(model).toObject(CustomerListResult.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomerPolicyInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomerPolicyInnerTests.java deleted file mode 100644 index f739ad86d25a..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomerPolicyInnerTests.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.CustomerPolicyInner; -import com.azure.resourcemanager.billing.models.CustomerPolicyProperties; -import com.azure.resourcemanager.billing.models.PolicySummary; -import com.azure.resourcemanager.billing.models.PolicyType; -import com.azure.resourcemanager.billing.models.ViewChargesPolicy; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class CustomerPolicyInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CustomerPolicyInner model = BinaryData.fromString( - "{\"properties\":{\"provisioningState\":\"ConfirmedBilling\",\"viewCharges\":\"Allowed\",\"policies\":[{\"name\":\"tpgaeukya\",\"value\":\"hpmwhqnucsk\",\"policyType\":\"SystemControlled\",\"scope\":\"dsjtdlpbni\"},{\"name\":\"gazlsvbz\",\"value\":\"puoee\",\"policyType\":\"Other\",\"scope\":\"ciklh\"}]},\"tags\":{\"xolriy\":\"krdre\",\"beivdlhydwbdbfg\":\"h\"},\"id\":\"punytjl\",\"name\":\"esmmpathubtahd\",\"type\":\"an\"}") - .toObject(CustomerPolicyInner.class); - Assertions.assertEquals("krdre", model.tags().get("xolriy")); - Assertions.assertEquals(ViewChargesPolicy.ALLOWED, model.properties().viewCharges()); - Assertions.assertEquals("tpgaeukya", model.properties().policies().get(0).name()); - Assertions.assertEquals("hpmwhqnucsk", model.properties().policies().get(0).value()); - Assertions.assertEquals(PolicyType.SYSTEM_CONTROLLED, model.properties().policies().get(0).policyType()); - Assertions.assertEquals("dsjtdlpbni", model.properties().policies().get(0).scope()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CustomerPolicyInner model = new CustomerPolicyInner().withTags(mapOf("xolriy", "krdre", "beivdlhydwbdbfg", "h")) - .withProperties(new CustomerPolicyProperties().withViewCharges(ViewChargesPolicy.ALLOWED) - .withPolicies(Arrays.asList( - new PolicySummary().withName("tpgaeukya") - .withValue("hpmwhqnucsk") - .withPolicyType(PolicyType.SYSTEM_CONTROLLED) - .withScope("dsjtdlpbni"), - new PolicySummary().withName("gazlsvbz") - .withValue("puoee") - .withPolicyType(PolicyType.OTHER) - .withScope("ciklh")))); - model = BinaryData.fromObject(model).toObject(CustomerPolicyInner.class); - Assertions.assertEquals("krdre", model.tags().get("xolriy")); - Assertions.assertEquals(ViewChargesPolicy.ALLOWED, model.properties().viewCharges()); - Assertions.assertEquals("tpgaeukya", model.properties().policies().get(0).name()); - Assertions.assertEquals("hpmwhqnucsk", model.properties().policies().get(0).value()); - Assertions.assertEquals(PolicyType.SYSTEM_CONTROLLED, model.properties().policies().get(0).policyType()); - Assertions.assertEquals("dsjtdlpbni", model.properties().policies().get(0).scope()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomerPolicyPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomerPolicyPropertiesTests.java deleted file mode 100644 index d226b9926b03..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomerPolicyPropertiesTests.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.CustomerPolicyProperties; -import com.azure.resourcemanager.billing.models.PolicySummary; -import com.azure.resourcemanager.billing.models.PolicyType; -import com.azure.resourcemanager.billing.models.ViewChargesPolicy; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class CustomerPolicyPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CustomerPolicyProperties model = BinaryData.fromString( - "{\"provisioningState\":\"Created\",\"viewCharges\":\"Allowed\",\"policies\":[{\"name\":\"gwzsf\",\"value\":\"edous\",\"policyType\":\"Other\",\"scope\":\"tgravaqogf\"},{\"name\":\"ebauzlqbtx\",\"value\":\"pfhnjzudrt\",\"policyType\":\"UserControlled\",\"scope\":\"meboywhczzq\"}]}") - .toObject(CustomerPolicyProperties.class); - Assertions.assertEquals(ViewChargesPolicy.ALLOWED, model.viewCharges()); - Assertions.assertEquals("gwzsf", model.policies().get(0).name()); - Assertions.assertEquals("edous", model.policies().get(0).value()); - Assertions.assertEquals(PolicyType.OTHER, model.policies().get(0).policyType()); - Assertions.assertEquals("tgravaqogf", model.policies().get(0).scope()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CustomerPolicyProperties model = new CustomerPolicyProperties().withViewCharges(ViewChargesPolicy.ALLOWED) - .withPolicies(Arrays.asList( - new PolicySummary().withName("gwzsf") - .withValue("edous") - .withPolicyType(PolicyType.OTHER) - .withScope("tgravaqogf"), - new PolicySummary().withName("ebauzlqbtx") - .withValue("pfhnjzudrt") - .withPolicyType(PolicyType.USER_CONTROLLED) - .withScope("meboywhczzq"))); - model = BinaryData.fromObject(model).toObject(CustomerPolicyProperties.class); - Assertions.assertEquals(ViewChargesPolicy.ALLOWED, model.viewCharges()); - Assertions.assertEquals("gwzsf", model.policies().get(0).name()); - Assertions.assertEquals("edous", model.policies().get(0).value()); - Assertions.assertEquals(PolicyType.OTHER, model.policies().get(0).policyType()); - Assertions.assertEquals("tgravaqogf", model.policies().get(0).scope()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomerPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomerPropertiesTests.java deleted file mode 100644 index 8e9c2d47e78c..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomerPropertiesTests.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.AzurePlan; -import com.azure.resourcemanager.billing.models.CustomerProperties; -import com.azure.resourcemanager.billing.models.Reseller; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class CustomerPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - CustomerProperties model = BinaryData.fromString( - "{\"billingProfileDisplayName\":\"upbezqccydrt\",\"billingProfileId\":\"ukdqkkyihztg\",\"displayName\":\"mgqzgwldoyc\",\"systemId\":\"llcecfehuwaoa\",\"status\":\"UnderReview\",\"enabledAzurePlans\":[{\"productId\":\"llizs\",\"skuId\":\"csjvhrwef\",\"skuDescription\":\"wqejpmvsse\"},{\"productId\":\"epwamcxtcz\",\"skuId\":\"peuknijd\",\"skuDescription\":\"yespydjfbocyv\"}],\"resellers\":[{\"resellerId\":\"rtywi\",\"description\":\"mhlaku\"},{\"resellerId\":\"gbhgau\",\"description\":\"dixmxufrsryjq\"},{\"resellerId\":\"kfnozoeoqbvj\",\"description\":\"efgwbmqjc\"}],\"tags\":{\"lbm\":\"asfaymxbulpze\",\"btsuahxs\":\"kyojwyvfk\",\"biwsd\":\"xjcmmzrrsc\",\"fjxcjrmmuabwibv\":\"npxqwodi\"}}") - .toObject(CustomerProperties.class); - Assertions.assertEquals("llizs", model.enabledAzurePlans().get(0).productId()); - Assertions.assertEquals("csjvhrwef", model.enabledAzurePlans().get(0).skuId()); - Assertions.assertEquals("wqejpmvsse", model.enabledAzurePlans().get(0).skuDescription()); - Assertions.assertEquals("asfaymxbulpze", model.tags().get("lbm")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - CustomerProperties model = new CustomerProperties() - .withEnabledAzurePlans(Arrays.asList( - new AzurePlan().withProductId("llizs").withSkuId("csjvhrwef").withSkuDescription("wqejpmvsse"), - new AzurePlan().withProductId("epwamcxtcz").withSkuId("peuknijd").withSkuDescription("yespydjfbocyv"))) - .withResellers(Arrays.asList(new Reseller(), new Reseller(), new Reseller())) - .withTags(mapOf("lbm", "asfaymxbulpze", "btsuahxs", "kyojwyvfk", "biwsd", "xjcmmzrrsc", "fjxcjrmmuabwibv", - "npxqwodi")); - model = BinaryData.fromObject(model).toObject(CustomerProperties.class); - Assertions.assertEquals("llizs", model.enabledAzurePlans().get(0).productId()); - Assertions.assertEquals("csjvhrwef", model.enabledAzurePlans().get(0).skuId()); - Assertions.assertEquals("wqejpmvsse", model.enabledAzurePlans().get(0).skuDescription()); - Assertions.assertEquals("asfaymxbulpze", model.tags().get("lbm")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomersGetByBillingAccountWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomersGetByBillingAccountWithResponseMockTests.java deleted file mode 100644 index 3659ee32735a..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomersGetByBillingAccountWithResponseMockTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.Customer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class CustomersGetByBillingAccountWithResponseMockTests { - @Test - public void testGetByBillingAccountWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"billingProfileDisplayName\":\"edsoqwe\",\"billingProfileId\":\"ebnzotei\",\"displayName\":\"fjqdfadgywylavet\",\"systemId\":\"vohy\",\"status\":\"Active\",\"enabledAzurePlans\":[{\"productId\":\"pbtkogfggyl\",\"skuId\":\"olrvwsgseqjt\",\"skuDescription\":\"axir\"},{\"productId\":\"isw\",\"skuId\":\"y\",\"skuDescription\":\"vsobamtarirdzdgv\"},{\"productId\":\"flz\",\"skuId\":\"e\",\"skuDescription\":\"ugxpypbmzqsxblm\"}],\"resellers\":[{\"resellerId\":\"kulytivviyq\",\"description\":\"bxxyfozbgodywxj\"},{\"resellerId\":\"frxvlusedpnkz\",\"description\":\"qaxtmvmyc\"},{\"resellerId\":\"paxjdqvv\",\"description\":\"ehyv\"},{\"resellerId\":\"jngoq\",\"description\":\"dvhbgtuhwhxunwe\"}],\"tags\":{\"x\":\"hylnuzgz\"}},\"tags\":{\"etxpun\":\"sebkc\",\"uiqr\":\"erma\"},\"id\":\"mftubqwxvsxrb\",\"name\":\"yzjlgrwjbsycukb\",\"type\":\"csitsxhvs\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Customer response = manager.customers() - .getByBillingAccountWithResponse("l", "vbv", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("sebkc", response.tags().get("etxpun")); - Assertions.assertEquals("pbtkogfggyl", response.properties().enabledAzurePlans().get(0).productId()); - Assertions.assertEquals("olrvwsgseqjt", response.properties().enabledAzurePlans().get(0).skuId()); - Assertions.assertEquals("axir", response.properties().enabledAzurePlans().get(0).skuDescription()); - Assertions.assertEquals("hylnuzgz", response.properties().tags().get("x")); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomersGetWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomersGetWithResponseMockTests.java deleted file mode 100644 index 91246b814dd6..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomersGetWithResponseMockTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.Customer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class CustomersGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"billingProfileDisplayName\":\"txrrsjsco\",\"billingProfileId\":\"njsoutrztog\",\"displayName\":\"gbncl\",\"systemId\":\"wkzfggsuzkv\",\"status\":\"Other\",\"enabledAzurePlans\":[{\"productId\":\"uiwaz\",\"skuId\":\"bthutctcabc\",\"skuDescription\":\"abzfihsz\"},{\"productId\":\"poid\",\"skuId\":\"wegvuojuwgweccvu\",\"skuDescription\":\"qvfcfsssmyaemk\"}],\"resellers\":[{\"resellerId\":\"dgktl\",\"description\":\"fiqgpqcpen\"},{\"resellerId\":\"qysbeespqbvvaers\",\"description\":\"ufzsautbric\"},{\"resellerId\":\"ofenin\",\"description\":\"unhy\"},{\"resellerId\":\"xckdlxjpisrdn\",\"description\":\"incbesfvijnubx\"}],\"tags\":{\"hkvoxdporxki\":\"ytqxewjsyutezl\",\"bvqnpwdwdmuvya\":\"bkutogecyqoytws\",\"blzrmiukothyfjbp\":\"rbqpwx\"}},\"tags\":{\"fwgnpcjniaf\":\"hfrvsi\",\"mwr\":\"wcgjjioqwuuogdkp\"},\"id\":\"qjdebyxqucnbgi\",\"name\":\"klscwdko\",\"type\":\"zyvihevb\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Customer response = manager.customers() - .getWithResponse("wwdocjasu", "megjkfisz", "exumfavweslo", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("hfrvsi", response.tags().get("fwgnpcjniaf")); - Assertions.assertEquals("uiwaz", response.properties().enabledAzurePlans().get(0).productId()); - Assertions.assertEquals("bthutctcabc", response.properties().enabledAzurePlans().get(0).skuId()); - Assertions.assertEquals("abzfihsz", response.properties().enabledAzurePlans().get(0).skuDescription()); - Assertions.assertEquals("ytqxewjsyutezl", response.properties().tags().get("hkvoxdporxki")); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomersListByBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomersListByBillingAccountMockTests.java deleted file mode 100644 index e5c15e8d675c..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomersListByBillingAccountMockTests.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.Customer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class CustomersListByBillingAccountMockTests { - @Test - public void testListByBillingAccount() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"billingProfileDisplayName\":\"qlc\",\"billingProfileId\":\"qnofkwhg\",\"displayName\":\"wfyfdbvooelmikds\",\"systemId\":\"ykgjjsmvsiyqm\",\"status\":\"UnderReview\",\"enabledAzurePlans\":[{\"productId\":\"m\",\"skuId\":\"bmacv\",\"skuDescription\":\"mriyzyvquesxp\"},{\"productId\":\"sinbulolxxhcynnm\",\"skuId\":\"izvkw\",\"skuDescription\":\"pwcidsjqcqyzmrtf\"}],\"resellers\":[{\"resellerId\":\"ryyjlikalbcyuwah\",\"description\":\"agvaidzceph\"},{\"resellerId\":\"nuhgy\",\"description\":\"khis\"}],\"tags\":{\"rtjpairpwjmcgiws\":\"pekiprjbp\",\"ugrsergiuztqef\":\"wpejtvqo\",\"dmcbc\":\"ypul\",\"gukqmkiynbfvkiwm\":\"ndidhuepikwcxoa\"}},\"tags\":{\"x\":\"mytcctirgyut\"},\"id\":\"hdmcgvjbrybfa\",\"name\":\"khkoqcud\",\"type\":\"wmoyhd\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.customers() - .listByBillingAccount("zp", "qi", "yxjkctyq", "ttampqep", 2055905019025432515L, 6711408200390148025L, true, - "plzoepeqlhbtysy", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("mytcctirgyut", response.iterator().next().tags().get("x")); - Assertions.assertEquals("m", response.iterator().next().properties().enabledAzurePlans().get(0).productId()); - Assertions.assertEquals("bmacv", response.iterator().next().properties().enabledAzurePlans().get(0).skuId()); - Assertions.assertEquals("mriyzyvquesxp", - response.iterator().next().properties().enabledAzurePlans().get(0).skuDescription()); - Assertions.assertEquals("pekiprjbp", response.iterator().next().properties().tags().get("rtjpairpwjmcgiws")); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomersListByBillingProfileMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomersListByBillingProfileMockTests.java deleted file mode 100644 index 8ab36af40e08..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/CustomersListByBillingProfileMockTests.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.Customer; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class CustomersListByBillingProfileMockTests { - @Test - public void testListByBillingProfile() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"billingProfileDisplayName\":\"jldgnimqoacfq\",\"billingProfileId\":\"jziqcso\",\"displayName\":\"qtkpdcdefqoermg\",\"systemId\":\"nddaxaogsk\",\"status\":\"Pending\",\"enabledAzurePlans\":[{\"productId\":\"ipysehyy\",\"skuId\":\"bfjcvmk\",\"skuDescription\":\"pgdiwd\"},{\"productId\":\"hdtiemb\",\"skuId\":\"qwvcwce\",\"skuDescription\":\"rtrgpdlbtbxhyfwj\"},{\"productId\":\"ktuzrltpe\",\"skuId\":\"dkbqfzbvttqj\",\"skuDescription\":\"vhnjpbhjlug\"}],\"resellers\":[{\"resellerId\":\"yfrhooyvmv\",\"description\":\"yeeafdxs\"}],\"tags\":{\"dxbhjquxk\":\"ynxzhgbs\",\"dzwnkbjqp\":\"xqomzdfaupqve\",\"sochtuxap\":\"modwhqu\",\"q\":\"wz\"}},\"tags\":{\"mc\":\"mynslcvynavwttt\",\"caqimodn\":\"rod\"},\"id\":\"mjxkhbucm\",\"name\":\"kqtkf\",\"type\":\"acktavcebgodjfy\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.customers() - .listByBillingProfile("vxmtsmgk", "etsn", "rceulbyzzcxsyg", "oy", "yckd", 277189762365589667L, - 7199487321199705759L, true, "mljrjyfjleuxix", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("mynslcvynavwttt", response.iterator().next().tags().get("mc")); - Assertions.assertEquals("ipysehyy", - response.iterator().next().properties().enabledAzurePlans().get(0).productId()); - Assertions.assertEquals("bfjcvmk", response.iterator().next().properties().enabledAzurePlans().get(0).skuId()); - Assertions.assertEquals("pgdiwd", - response.iterator().next().properties().enabledAzurePlans().get(0).skuDescription()); - Assertions.assertEquals("ynxzhgbs", response.iterator().next().properties().tags().get("dxbhjquxk")); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DepartmentInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DepartmentInnerTests.java deleted file mode 100644 index 7abab54534eb..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DepartmentInnerTests.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.DepartmentInner; -import com.azure.resourcemanager.billing.models.DepartmentProperties; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class DepartmentInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DepartmentInner model = BinaryData.fromString( - "{\"properties\":{\"costCenter\":\"wqjwgok\",\"displayName\":\"ejjjkxybwfdb\",\"id\":\"bztensvkzykjtj\",\"status\":\"sxfwushcdp\"},\"tags\":{\"mgjfbpkuwxeoio\":\"nq\"},\"id\":\"izfavkjzwf\",\"name\":\"cyayk\",\"type\":\"mfzsbf\"}") - .toObject(DepartmentInner.class); - Assertions.assertEquals("nq", model.tags().get("mgjfbpkuwxeoio")); - Assertions.assertEquals("wqjwgok", model.properties().costCenter()); - Assertions.assertEquals("ejjjkxybwfdb", model.properties().displayName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DepartmentInner model = new DepartmentInner().withTags(mapOf("mgjfbpkuwxeoio", "nq")) - .withProperties(new DepartmentProperties().withCostCenter("wqjwgok").withDisplayName("ejjjkxybwfdb")); - model = BinaryData.fromObject(model).toObject(DepartmentInner.class); - Assertions.assertEquals("nq", model.tags().get("mgjfbpkuwxeoio")); - Assertions.assertEquals("wqjwgok", model.properties().costCenter()); - Assertions.assertEquals("ejjjkxybwfdb", model.properties().displayName()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DepartmentListResultTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DepartmentListResultTests.java deleted file mode 100644 index c51a17976210..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DepartmentListResultTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.DepartmentListResult; - -public final class DepartmentListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DepartmentListResult model = BinaryData.fromString( - "{\"nextLink\":\"hbrnnhjx\",\"value\":[{\"properties\":{\"costCenter\":\"qkbiwet\",\"displayName\":\"zycyqiqyhg\",\"id\":\"etzlexbsfledynoj\",\"status\":\"iuwfbzkkdtnhqsy\"},\"tags\":{\"afhlbyl\":\"selpkpbaf\",\"sofpltd\":\"cbevxrhyzdfw\",\"hfnrac\":\"mairrh\",\"g\":\"npq\"},\"id\":\"ujwouhdawsi\",\"name\":\"rb\",\"type\":\"bxsjybvitvqkj\"}]}") - .toObject(DepartmentListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DepartmentListResult model = new DepartmentListResult(); - model = BinaryData.fromObject(model).toObject(DepartmentListResult.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DepartmentPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DepartmentPropertiesTests.java deleted file mode 100644 index 2b766c77e218..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DepartmentPropertiesTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.DepartmentProperties; -import org.junit.jupiter.api.Assertions; - -public final class DepartmentPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DepartmentProperties model = BinaryData - .fromString("{\"costCenter\":\"rzx\",\"displayName\":\"ewsrsxkrplbjaze\",\"id\":\"w\",\"status\":\"yoyp\"}") - .toObject(DepartmentProperties.class); - Assertions.assertEquals("rzx", model.costCenter()); - Assertions.assertEquals("ewsrsxkrplbjaze", model.displayName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DepartmentProperties model - = new DepartmentProperties().withCostCenter("rzx").withDisplayName("ewsrsxkrplbjaze"); - model = BinaryData.fromObject(model).toObject(DepartmentProperties.class); - Assertions.assertEquals("rzx", model.costCenter()); - Assertions.assertEquals("ewsrsxkrplbjaze", model.displayName()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DepartmentsGetWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DepartmentsGetWithResponseMockTests.java deleted file mode 100644 index 07116b9944d0..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DepartmentsGetWithResponseMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.Department; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class DepartmentsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"costCenter\":\"jniq\",\"displayName\":\"qxyxfknjqss\",\"id\":\"wvravn\",\"status\":\"klkwqisnlpa\"},\"tags\":{\"ewwlkry\":\"etotktd\",\"xregykjmpad\":\"mpgqqdhtct\",\"xitydljgrpqua\":\"zjohdhczh\",\"isi\":\"xgjqqbactffxd\"},\"id\":\"mwafapctglj\",\"name\":\"pizqqihvbkufq\",\"type\":\"qdd\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Department response - = manager.departments().getWithResponse("jjhq", "zcbjfpxoy", com.azure.core.util.Context.NONE).getValue(); - - Assertions.assertEquals("etotktd", response.tags().get("ewwlkry")); - Assertions.assertEquals("jniq", response.properties().costCenter()); - Assertions.assertEquals("qxyxfknjqss", response.properties().displayName()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DepartmentsListByBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DepartmentsListByBillingAccountMockTests.java deleted file mode 100644 index 7daab67e3efd..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DepartmentsListByBillingAccountMockTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.Department; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class DepartmentsListByBillingAccountMockTests { - @Test - public void testListByBillingAccount() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"costCenter\":\"plqftqcxq\",\"displayName\":\"sudcykgulellf\",\"id\":\"msuxyqbmqoubxlpk\",\"status\":\"nbqoymsdlraduh\"},\"tags\":{\"ijribeskkopbksri\":\"xzyrppoy\",\"qtiqxgwsfrlyvzl\":\"mbtmorikcze\"},\"id\":\"ydgmdoqgruc\",\"name\":\"zcy\",\"type\":\"udhgwjqeglymnrr\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.departments() - .listByBillingAccount("ynpgomzmkj", "ajlfpsvrljlhe", "cccpxbnwitaf", 2254730983886702038L, - 7195365409471809499L, "tvitghzqwvkpa", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("xzyrppoy", response.iterator().next().tags().get("ijribeskkopbksri")); - Assertions.assertEquals("plqftqcxq", response.iterator().next().properties().costCenter()); - Assertions.assertEquals("sudcykgulellf", response.iterator().next().properties().displayName()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DocumentDownloadRequestTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DocumentDownloadRequestTests.java deleted file mode 100644 index 0b1910a3e4c9..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DocumentDownloadRequestTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.DocumentDownloadRequest; -import org.junit.jupiter.api.Assertions; - -public final class DocumentDownloadRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DocumentDownloadRequest model - = BinaryData.fromString("{\"documentName\":\"apezkiswqjmdghs\",\"invoiceName\":\"arybjufptbjc\"}") - .toObject(DocumentDownloadRequest.class); - Assertions.assertEquals("apezkiswqjmdghs", model.documentName()); - Assertions.assertEquals("arybjufptbjc", model.invoiceName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DocumentDownloadRequest model - = new DocumentDownloadRequest().withDocumentName("apezkiswqjmdghs").withInvoiceName("arybjufptbjc"); - model = BinaryData.fromObject(model).toObject(DocumentDownloadRequest.class); - Assertions.assertEquals("apezkiswqjmdghs", model.documentName()); - Assertions.assertEquals("arybjufptbjc", model.invoiceName()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DocumentDownloadResultInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DocumentDownloadResultInnerTests.java deleted file mode 100644 index e43f989ff2b3..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/DocumentDownloadResultInnerTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.DocumentDownloadResultInner; - -public final class DocumentDownloadResultInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - DocumentDownloadResultInner model - = BinaryData.fromString("{\"expiryTime\":\"nciuiyqvldaswvpp\",\"url\":\"qqzlgcndhz\"}") - .toObject(DocumentDownloadResultInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - DocumentDownloadResultInner model = new DocumentDownloadResultInner(); - model = BinaryData.fromObject(model).toObject(DocumentDownloadResultInner.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountInnerTests.java deleted file mode 100644 index 0bbc3d223534..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountInnerTests.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.EnrollmentAccountInner; -import com.azure.resourcemanager.billing.models.EnrollmentAccountProperties; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class EnrollmentAccountInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - EnrollmentAccountInner model = BinaryData.fromString( - "{\"properties\":{\"costCenter\":\"nu\",\"displayName\":\"ggmuwdcho\",\"departmentDisplayName\":\"nkf\",\"departmentId\":\"lv\",\"isDevTestEnabled\":true,\"accountOwner\":\"kizvoa\",\"authType\":\"naqln\",\"status\":\"iguyxlykwphv\",\"startDate\":\"2021-11-13T04:48:37Z\",\"endDate\":\"2021-06-18T05:52:26Z\"},\"tags\":{\"exaonwivkcq\":\"pejtl\"},\"id\":\"xhxknlc\",\"name\":\"rmmkyupiju\",\"type\":\"yqjf\"}") - .toObject(EnrollmentAccountInner.class); - Assertions.assertEquals("pejtl", model.tags().get("exaonwivkcq")); - Assertions.assertEquals("nu", model.properties().costCenter()); - Assertions.assertEquals("ggmuwdcho", model.properties().displayName()); - Assertions.assertEquals(true, model.properties().isDevTestEnabled()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - EnrollmentAccountInner model = new EnrollmentAccountInner().withTags(mapOf("exaonwivkcq", "pejtl")) - .withProperties(new EnrollmentAccountProperties().withCostCenter("nu") - .withDisplayName("ggmuwdcho") - .withIsDevTestEnabled(true)); - model = BinaryData.fromObject(model).toObject(EnrollmentAccountInner.class); - Assertions.assertEquals("pejtl", model.tags().get("exaonwivkcq")); - Assertions.assertEquals("nu", model.properties().costCenter()); - Assertions.assertEquals("ggmuwdcho", model.properties().displayName()); - Assertions.assertEquals(true, model.properties().isDevTestEnabled()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountListResultTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountListResultTests.java deleted file mode 100644 index 90da06861275..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountListResultTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.EnrollmentAccountListResult; - -public final class EnrollmentAccountListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - EnrollmentAccountListResult model = BinaryData.fromString( - "{\"nextLink\":\"qwqul\",\"value\":[{\"properties\":{\"costCenter\":\"bhxykfhyqezvqqug\",\"displayName\":\"ftbcvexreuquow\",\"departmentDisplayName\":\"jv\",\"departmentId\":\"hreagk\",\"isDevTestEnabled\":false,\"accountOwner\":\"rqtvbczsulmdgglm\",\"authType\":\"jpfseykg\",\"status\":\"ngpszngafpg\",\"startDate\":\"2021-02-13T15:02:43Z\",\"endDate\":\"2021-07-27T16:28:59Z\"},\"tags\":{\"dyedmzrgjfo\":\"ujcngo\",\"oitpkpztrgdgx\":\"nub\",\"wugyx\":\"coqra\"},\"id\":\"itweialwvskbuh\",\"name\":\"acaqtyltcoqcu\",\"type\":\"pdsxzakuejkm\"},{\"properties\":{\"costCenter\":\"ztjofqcvovjufyc\",\"displayName\":\"mlbemy\",\"departmentDisplayName\":\"iriuxegthortu\",\"departmentId\":\"wlpjfelqerppt\",\"isDevTestEnabled\":false,\"accountOwner\":\"nzmnhiilia\",\"authType\":\"cjgckbbcccgzpra\",\"status\":\"nyuffat\",\"startDate\":\"2021-10-10T05:31:28Z\",\"endDate\":\"2021-10-04T17:21:41Z\"},\"tags\":{\"ubhiqdxyur\":\"cxb\",\"iig\":\"pnuhzafccnu\",\"ui\":\"yl\",\"vcrk\":\"vxva\"},\"id\":\"b\",\"name\":\"bqxvhcsyhzlwxae\",\"type\":\"ov\"},{\"properties\":{\"costCenter\":\"xdndsbdweaderzm\",\"displayName\":\"t\",\"departmentDisplayName\":\"agttm\",\"departmentId\":\"magoaqylkjz\",\"isDevTestEnabled\":false,\"accountOwner\":\"azjcgmxitpfin\",\"authType\":\"pdltkrlg\",\"status\":\"tbdrvcqgue\",\"startDate\":\"2021-05-18T02:25:41Z\",\"endDate\":\"2021-08-13T12:33:46Z\"},\"tags\":{\"ckyeclcdigpta\":\"eqdurelyujlfyoum\",\"utgjcyz\":\"brzmqxucycijoclx\",\"r\":\"zjd\",\"xjeaoqaqbzgyh\":\"jb\"},\"id\":\"wvua\",\"name\":\"bwbqamt\",\"type\":\"uliyslpkcv\"}]}") - .toObject(EnrollmentAccountListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - EnrollmentAccountListResult model = new EnrollmentAccountListResult(); - model = BinaryData.fromObject(model).toObject(EnrollmentAccountListResult.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountPropertiesTests.java deleted file mode 100644 index 87a0a65d8499..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountPropertiesTests.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.EnrollmentAccountProperties; -import org.junit.jupiter.api.Assertions; - -public final class EnrollmentAccountPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - EnrollmentAccountProperties model = BinaryData.fromString( - "{\"costCenter\":\"kfq\",\"displayName\":\"kemyil\",\"departmentDisplayName\":\"dxjascowvfdj\",\"departmentId\":\"dxphlk\",\"isDevTestEnabled\":true,\"accountOwner\":\"gzv\",\"authType\":\"ij\",\"status\":\"zuqnwsithuqo\",\"startDate\":\"2021-06-28T21:30:54Z\",\"endDate\":\"2021-02-27T02:08:05Z\"}") - .toObject(EnrollmentAccountProperties.class); - Assertions.assertEquals("kfq", model.costCenter()); - Assertions.assertEquals("kemyil", model.displayName()); - Assertions.assertEquals(true, model.isDevTestEnabled()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - EnrollmentAccountProperties model = new EnrollmentAccountProperties().withCostCenter("kfq") - .withDisplayName("kemyil") - .withIsDevTestEnabled(true); - model = BinaryData.fromObject(model).toObject(EnrollmentAccountProperties.class); - Assertions.assertEquals("kfq", model.costCenter()); - Assertions.assertEquals("kemyil", model.displayName()); - Assertions.assertEquals(true, model.isDevTestEnabled()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountSubscriptionDetailsTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountSubscriptionDetailsTests.java deleted file mode 100644 index 27256b844c64..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountSubscriptionDetailsTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.EnrollmentAccountSubscriptionDetails; - -public final class EnrollmentAccountSubscriptionDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - EnrollmentAccountSubscriptionDetails model = BinaryData.fromString( - "{\"enrollmentAccountStartDate\":\"2021-07-30T06:29:45Z\",\"subscriptionEnrollmentAccountStatus\":\"Inactive\"}") - .toObject(EnrollmentAccountSubscriptionDetails.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - EnrollmentAccountSubscriptionDetails model = new EnrollmentAccountSubscriptionDetails(); - model = BinaryData.fromObject(model).toObject(EnrollmentAccountSubscriptionDetails.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountsGetByDepartmentWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountsGetByDepartmentWithResponseMockTests.java deleted file mode 100644 index 34ea78a2b664..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountsGetByDepartmentWithResponseMockTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.EnrollmentAccount; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class EnrollmentAccountsGetByDepartmentWithResponseMockTests { - @Test - public void testGetByDepartmentWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"costCenter\":\"qvvzxgbamqrb\",\"displayName\":\"npt\",\"departmentDisplayName\":\"v\",\"departmentId\":\"av\",\"isDevTestEnabled\":true,\"accountOwner\":\"yjuwhizcbqjxmh\",\"authType\":\"tunpcsk\",\"status\":\"rfouwkoltjdauujj\",\"startDate\":\"2021-01-01T18:24:49Z\",\"endDate\":\"2021-03-20T02:53:29Z\"},\"tags\":{\"ehplmqyoduksa\":\"eykudjzrim\"},\"id\":\"nqqkqxkd\",\"name\":\"lseuqkrbyya\",\"type\":\"rjgbnwgokr\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - EnrollmentAccount response = manager.enrollmentAccounts() - .getByDepartmentWithResponse("wsqpiyxkmqmge", "qcil", "iulgnnyxwdpm", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("eykudjzrim", response.tags().get("ehplmqyoduksa")); - Assertions.assertEquals("qvvzxgbamqrb", response.properties().costCenter()); - Assertions.assertEquals("npt", response.properties().displayName()); - Assertions.assertEquals(true, response.properties().isDevTestEnabled()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountsGetWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountsGetWithResponseMockTests.java deleted file mode 100644 index 92d4be1f7cdb..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountsGetWithResponseMockTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.EnrollmentAccount; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class EnrollmentAccountsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"costCenter\":\"wkjzvqpsymt\",\"displayName\":\"yjtr\",\"departmentDisplayName\":\"zwdsnqhyef\",\"departmentId\":\"kdmtpjk\",\"isDevTestEnabled\":false,\"accountOwner\":\"lytjxhx\",\"authType\":\"ittlnvukvu\",\"status\":\"plugulynvpdv\",\"startDate\":\"2021-09-04T18:13:17Z\",\"endDate\":\"2021-06-21T03:19:03Z\"},\"tags\":{\"cqehy\":\"dsfpzpjbsilbnr\",\"fbmpszwk\":\"nzmjr\",\"xrwqt\":\"cstzuwbgaesmaxd\",\"akxy\":\"vwsd\"},\"id\":\"kgjhomywlypghhul\",\"name\":\"qyfvgpqwg\",\"type\":\"qmbriskmbui\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - EnrollmentAccount response = manager.enrollmentAccounts() - .getWithResponse("hxoeftfo", "ylx", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("dsfpzpjbsilbnr", response.tags().get("cqehy")); - Assertions.assertEquals("wkjzvqpsymt", response.properties().costCenter()); - Assertions.assertEquals("yjtr", response.properties().displayName()); - Assertions.assertEquals(false, response.properties().isDevTestEnabled()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountsListByBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountsListByBillingAccountMockTests.java deleted file mode 100644 index fbd4647f4a0c..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountsListByBillingAccountMockTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.EnrollmentAccount; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class EnrollmentAccountsListByBillingAccountMockTests { - @Test - public void testListByBillingAccount() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"costCenter\":\"ucftot\",\"displayName\":\"hjxdlmuhf\",\"departmentDisplayName\":\"jqvjyqmpmsknaxrh\",\"departmentId\":\"wqufudp\",\"isDevTestEnabled\":false,\"accountOwner\":\"qlef\",\"authType\":\"pw\",\"status\":\"jvwfijfdj\",\"startDate\":\"2021-07-23T20:41:49Z\",\"endDate\":\"2021-08-24T18:18:48Z\"},\"tags\":{\"bqntdder\":\"smrihddnbw\",\"fstyyysq\":\"xyiwuzpsvcmz\",\"jdzkfthsydphdbzz\":\"wnlcfz\",\"kzqbvhvdulymkg\":\"tf\"},\"id\":\"ryhxf\",\"name\":\"haenpftkgmbmv\",\"type\":\"biubzg\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.enrollmentAccounts() - .listByBillingAccount("tq", "vyqmmczuguvlieeg", "nqwhfjoxse", 7074246506006914011L, 9183986720802555232L, - true, "c", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("smrihddnbw", response.iterator().next().tags().get("bqntdder")); - Assertions.assertEquals("ucftot", response.iterator().next().properties().costCenter()); - Assertions.assertEquals("hjxdlmuhf", response.iterator().next().properties().displayName()); - Assertions.assertEquals(false, response.iterator().next().properties().isDevTestEnabled()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountsListByDepartmentMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountsListByDepartmentMockTests.java deleted file mode 100644 index 5cee20298292..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentAccountsListByDepartmentMockTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.EnrollmentAccount; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class EnrollmentAccountsListByDepartmentMockTests { - @Test - public void testListByDepartment() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"costCenter\":\"ngiqcypmonf\",\"displayName\":\"r\",\"departmentDisplayName\":\"hfycigcbmayhdtjf\",\"departmentId\":\"onajzdjqzb\",\"isDevTestEnabled\":true,\"accountOwner\":\"rmhouf\",\"authType\":\"rb\",\"status\":\"ojcksirsnqunn\",\"startDate\":\"2021-09-20T14:42:28Z\",\"endDate\":\"2021-05-07T10:45:42Z\"},\"tags\":{\"vpehpnsvky\":\"ggnzadq\",\"jsrgclxnsvbkhh\":\"hrplfqqnw\",\"tuecmguk\":\"qs\",\"xkr\":\"wdpuowlc\"},\"id\":\"tqzqnbseujcmtci\",\"name\":\"cabn\",\"type\":\"xhcxct\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.enrollmentAccounts() - .listByDepartment("lbecannvxouhd", "ftp", "fcjapm", "wxmcxhwkgihifoy", 315987086585801737L, - 5803007966104299513L, true, "hmqyufpfowweyls", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("ggnzadq", response.iterator().next().tags().get("vpehpnsvky")); - Assertions.assertEquals("ngiqcypmonf", response.iterator().next().properties().costCenter()); - Assertions.assertEquals("r", response.iterator().next().properties().displayName()); - Assertions.assertEquals(true, response.iterator().next().properties().isDevTestEnabled()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentDetailsIndirectRelationshipInfoTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentDetailsIndirectRelationshipInfoTests.java deleted file mode 100644 index 982c8405e6c1..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnrollmentDetailsIndirectRelationshipInfoTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.EnrollmentDetailsIndirectRelationshipInfo; -import org.junit.jupiter.api.Assertions; - -public final class EnrollmentDetailsIndirectRelationshipInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - EnrollmentDetailsIndirectRelationshipInfo model = BinaryData.fromString( - "{\"billingAccountName\":\"rzpwvlqdqgbiq\",\"billingProfileName\":\"ihkaetcktvfc\",\"displayName\":\"fsnkymuctq\"}") - .toObject(EnrollmentDetailsIndirectRelationshipInfo.class); - Assertions.assertEquals("rzpwvlqdqgbiq", model.billingAccountName()); - Assertions.assertEquals("ihkaetcktvfc", model.billingProfileName()); - Assertions.assertEquals("fsnkymuctq", model.displayName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - EnrollmentDetailsIndirectRelationshipInfo model - = new EnrollmentDetailsIndirectRelationshipInfo().withBillingAccountName("rzpwvlqdqgbiq") - .withBillingProfileName("ihkaetcktvfc") - .withDisplayName("fsnkymuctq"); - model = BinaryData.fromObject(model).toObject(EnrollmentDetailsIndirectRelationshipInfo.class); - Assertions.assertEquals("rzpwvlqdqgbiq", model.billingAccountName()); - Assertions.assertEquals("ihkaetcktvfc", model.billingProfileName()); - Assertions.assertEquals("fsnkymuctq", model.displayName()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnterpriseAgreementPoliciesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnterpriseAgreementPoliciesTests.java deleted file mode 100644 index 5527b4fdf719..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/EnterpriseAgreementPoliciesTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.EnrollmentAccountOwnerViewCharges; -import com.azure.resourcemanager.billing.models.EnrollmentAuthLevelState; -import com.azure.resourcemanager.billing.models.EnrollmentDepartmentAdminViewCharges; -import com.azure.resourcemanager.billing.models.EnterpriseAgreementPolicies; -import org.junit.jupiter.api.Assertions; - -public final class EnterpriseAgreementPoliciesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - EnterpriseAgreementPolicies model = BinaryData.fromString( - "{\"authenticationType\":\"OrganizationalAccountOnly\",\"accountOwnerViewCharges\":\"NotAllowed\",\"departmentAdminViewCharges\":\"NotAllowed\"}") - .toObject(EnterpriseAgreementPolicies.class); - Assertions.assertEquals(EnrollmentAuthLevelState.ORGANIZATIONAL_ACCOUNT_ONLY, model.authenticationType()); - Assertions.assertEquals(EnrollmentAccountOwnerViewCharges.NOT_ALLOWED, model.accountOwnerViewCharges()); - Assertions.assertEquals(EnrollmentDepartmentAdminViewCharges.NOT_ALLOWED, model.departmentAdminViewCharges()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - EnterpriseAgreementPolicies model = new EnterpriseAgreementPolicies() - .withAuthenticationType(EnrollmentAuthLevelState.ORGANIZATIONAL_ACCOUNT_ONLY) - .withAccountOwnerViewCharges(EnrollmentAccountOwnerViewCharges.NOT_ALLOWED) - .withDepartmentAdminViewCharges(EnrollmentDepartmentAdminViewCharges.NOT_ALLOWED); - model = BinaryData.fromObject(model).toObject(EnterpriseAgreementPolicies.class); - Assertions.assertEquals(EnrollmentAuthLevelState.ORGANIZATIONAL_ACCOUNT_ONLY, model.authenticationType()); - Assertions.assertEquals(EnrollmentAccountOwnerViewCharges.NOT_ALLOWED, model.accountOwnerViewCharges()); - Assertions.assertEquals(EnrollmentDepartmentAdminViewCharges.NOT_ALLOWED, model.departmentAdminViewCharges()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ExtendedStatusDefinitionPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ExtendedStatusDefinitionPropertiesTests.java deleted file mode 100644 index e39ba55f99a5..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ExtendedStatusDefinitionPropertiesTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.ExtendedStatusDefinitionProperties; -import org.junit.jupiter.api.Assertions; - -public final class ExtendedStatusDefinitionPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExtendedStatusDefinitionProperties model = BinaryData.fromString("{\"subscriptionId\":\"hmnulwem\"}") - .toObject(ExtendedStatusDefinitionProperties.class); - Assertions.assertEquals("hmnulwem", model.subscriptionId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExtendedStatusDefinitionProperties model - = new ExtendedStatusDefinitionProperties().withSubscriptionId("hmnulwem"); - model = BinaryData.fromObject(model).toObject(ExtendedStatusDefinitionProperties.class); - Assertions.assertEquals("hmnulwem", model.subscriptionId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ExtendedStatusInfoPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ExtendedStatusInfoPropertiesTests.java deleted file mode 100644 index cd1e2bedb54e..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ExtendedStatusInfoPropertiesTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.ExtendedStatusInfoProperties; -import org.junit.jupiter.api.Assertions; - -public final class ExtendedStatusInfoPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ExtendedStatusInfoProperties model - = BinaryData.fromString("{\"subscriptionId\":\"krsgsgb\"}").toObject(ExtendedStatusInfoProperties.class); - Assertions.assertEquals("krsgsgb", model.subscriptionId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ExtendedStatusInfoProperties model = new ExtendedStatusInfoProperties().withSubscriptionId("krsgsgb"); - model = BinaryData.fromObject(model).toObject(ExtendedStatusInfoProperties.class); - Assertions.assertEquals("krsgsgb", model.subscriptionId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/FailedPaymentTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/FailedPaymentTests.java deleted file mode 100644 index 7e6bd90d3934..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/FailedPaymentTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.FailedPayment; - -public final class FailedPaymentTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - FailedPayment model = BinaryData - .fromString("{\"date\":\"2021-09-17T17:29:45Z\",\"failedPaymentReason\":\"IncorrectCardDetails\"}") - .toObject(FailedPayment.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - FailedPayment model = new FailedPayment(); - model = BinaryData.fromObject(model).toObject(FailedPayment.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/IndirectRelationshipInfoTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/IndirectRelationshipInfoTests.java deleted file mode 100644 index 9e5fe05c1a6b..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/IndirectRelationshipInfoTests.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.IndirectRelationshipInfo; -import org.junit.jupiter.api.Assertions; - -public final class IndirectRelationshipInfoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - IndirectRelationshipInfo model = BinaryData.fromString( - "{\"billingAccountName\":\"fbebrjcxer\",\"billingProfileName\":\"wutttxfvjrbi\",\"displayName\":\"hxepcyvahfnlj\"}") - .toObject(IndirectRelationshipInfo.class); - Assertions.assertEquals("fbebrjcxer", model.billingAccountName()); - Assertions.assertEquals("wutttxfvjrbi", model.billingProfileName()); - Assertions.assertEquals("hxepcyvahfnlj", model.displayName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - IndirectRelationshipInfo model = new IndirectRelationshipInfo().withBillingAccountName("fbebrjcxer") - .withBillingProfileName("wutttxfvjrbi") - .withDisplayName("hxepcyvahfnlj"); - model = BinaryData.fromObject(model).toObject(IndirectRelationshipInfo.class); - Assertions.assertEquals("fbebrjcxer", model.billingAccountName()); - Assertions.assertEquals("wutttxfvjrbi", model.billingProfileName()); - Assertions.assertEquals("hxepcyvahfnlj", model.displayName()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InitiateTransferPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InitiateTransferPropertiesTests.java deleted file mode 100644 index 6c36dca64625..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InitiateTransferPropertiesTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.InitiateTransferProperties; -import org.junit.jupiter.api.Assertions; - -public final class InitiateTransferPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - InitiateTransferProperties model - = BinaryData.fromString("{\"recipientEmailId\":\"mnc\"}").toObject(InitiateTransferProperties.class); - Assertions.assertEquals("mnc", model.recipientEmailId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - InitiateTransferProperties model = new InitiateTransferProperties().withRecipientEmailId("mnc"); - model = BinaryData.fromObject(model).toObject(InitiateTransferProperties.class); - Assertions.assertEquals("mnc", model.recipientEmailId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InitiateTransferRequestTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InitiateTransferRequestTests.java deleted file mode 100644 index 41a0ac0ad0e9..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InitiateTransferRequestTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.InitiateTransferRequest; -import org.junit.jupiter.api.Assertions; - -public final class InitiateTransferRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - InitiateTransferRequest model = BinaryData.fromString("{\"properties\":{\"recipientEmailId\":\"gweeiwd\"}}") - .toObject(InitiateTransferRequest.class); - Assertions.assertEquals("gweeiwd", model.recipientEmailId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - InitiateTransferRequest model = new InitiateTransferRequest().withRecipientEmailId("gweeiwd"); - model = BinaryData.fromObject(model).toObject(InitiateTransferRequest.class); - Assertions.assertEquals("gweeiwd", model.recipientEmailId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoiceDocumentTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoiceDocumentTests.java deleted file mode 100644 index 42ab1788d03c..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoiceDocumentTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.InvoiceDocument; - -public final class InvoiceDocumentTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - InvoiceDocument model = BinaryData.fromString( - "{\"documentNumbers\":[\"i\",\"pa\",\"rwwgil\"],\"externalUrl\":\"qqa\",\"kind\":\"Invoice\",\"name\":\"xwxdcvjwc\",\"url\":\"iakeciqc\",\"source\":\"ENF\"}") - .toObject(InvoiceDocument.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - InvoiceDocument model = new InvoiceDocument(); - model = BinaryData.fromObject(model).toObject(InvoiceDocument.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoiceInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoiceInnerTests.java deleted file mode 100644 index 069cde66a7b1..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoiceInnerTests.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.InvoiceInner; -import com.azure.resourcemanager.billing.models.InvoiceProperties; -import com.azure.resourcemanager.billing.models.InvoicePropertiesAmountDue; -import com.azure.resourcemanager.billing.models.InvoicePropertiesAzurePrepaymentApplied; -import com.azure.resourcemanager.billing.models.InvoicePropertiesBilledAmount; -import com.azure.resourcemanager.billing.models.InvoicePropertiesCreditAmount; -import com.azure.resourcemanager.billing.models.InvoicePropertiesFreeAzureCreditApplied; -import com.azure.resourcemanager.billing.models.InvoicePropertiesRebillDetails; -import com.azure.resourcemanager.billing.models.InvoicePropertiesRefundDetails; -import com.azure.resourcemanager.billing.models.InvoicePropertiesSubTotal; -import com.azure.resourcemanager.billing.models.InvoicePropertiesTaxAmount; -import com.azure.resourcemanager.billing.models.InvoicePropertiesTotalAmount; -import com.azure.resourcemanager.billing.models.RefundDetailsSummaryAmountRefunded; -import com.azure.resourcemanager.billing.models.RefundDetailsSummaryAmountRequested; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class InvoiceInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - InvoiceInner model = BinaryData.fromString( - "{\"properties\":{\"amountDue\":{\"currency\":\"pqvyb\",\"value\":41.283936},\"azurePrepaymentApplied\":{\"currency\":\"x\",\"value\":27.64331},\"billedAmount\":{\"currency\":\"t\",\"value\":16.71524},\"billedDocumentId\":\"eskvcuartrhun\",\"billingProfileDisplayName\":\"iryky\",\"billingProfileId\":\"dzfqivjreuy\",\"creditAmount\":{\"currency\":\"mnwagltbxoe\",\"value\":77.6502},\"creditForDocumentId\":\"lnf\",\"documents\":[{\"documentNumbers\":[\"vqdbpbhfck\",\"vezcrcssbzhdd\",\"b\",\"nqfblhkalehpava\"],\"externalUrl\":\"giqjtiogq\",\"kind\":\"Summary\",\"name\":\"nictteajo\",\"url\":\"ygspnbonhpczykm\",\"source\":\"ENF\"}],\"documentType\":\"CreditNote\",\"dueDate\":\"2021-10-08T19:32:51Z\",\"failedPayments\":[{\"date\":\"2021-02-15T05:35:42Z\",\"failedPaymentReason\":\"BankDeclined\"},{\"date\":\"2021-10-23T22:02:24Z\",\"failedPaymentReason\":\"CardExpired\"}],\"freeAzureCreditApplied\":{\"currency\":\"qumq\",\"value\":7.102519},\"invoiceDate\":\"2021-03-08T06:43:22Z\",\"invoicePeriodEndDate\":\"2021-11-20T22:03:19Z\",\"invoicePeriodStartDate\":\"2021-09-30T01:43:07Z\",\"invoiceType\":\"AzureSupport\",\"isMonthlyInvoice\":false,\"payments\":[{\"amount\":{\"currency\":\"hsfnh\",\"value\":23.970026},\"date\":\"2020-12-23T17:30:48Z\",\"paymentMethodId\":\"pzfngqjcli\",\"paymentMethodFamily\":\"Credits\",\"paymentMethodType\":\"jwjj\",\"paymentType\":\"wbeqrkuor\"},{\"amount\":{\"currency\":\"sruqnmdvha\",\"value\":57.55649},\"date\":\"2021-10-27T04:25:49Z\",\"paymentMethodId\":\"iqswbqer\",\"paymentMethodFamily\":\"EWallet\",\"paymentMethodType\":\"ytxtdgu\",\"paymentType\":\"lbpktg\"},{\"amount\":{\"currency\":\"youambewr\",\"value\":67.716774},\"date\":\"2021-11-17T04:31:46Z\",\"paymentMethodId\":\"egmmuteyxe\",\"paymentMethodFamily\":\"None\",\"paymentMethodType\":\"igijiitnspxlz\",\"paymentType\":\"sygrijwa\"},{\"amount\":{\"currency\":\"anra\",\"value\":50.95093},\"date\":\"2021-07-25T00:37:18Z\",\"paymentMethodId\":\"frojsydgr\",\"paymentMethodFamily\":\"EWallet\",\"paymentMethodType\":\"ygywe\",\"paymentType\":\"kiecafygzm\"}],\"purchaseOrderNumber\":\"eqvdsm\",\"rebillDetails\":{\"invoiceDocumentId\":\"ixqcahyhxalybxaw\",\"creditNoteDocumentId\":\"jpodtbl\",\"rebillDetails\":{\"invoiceDocumentId\":\"kwjdjodqhy\",\"creditNoteDocumentId\":\"ncn\",\"rebillDetails\":{\"invoiceDocumentId\":\"ehllizhceum\",\"creditNoteDocumentId\":\"odkadppyibngq\",\"rebillDetails\":{\"invoiceDocumentId\":\"ywrxw\",\"creditNoteDocumentId\":\"dtluvvadswzsn\",\"rebillDetails\":{}}}}},\"status\":\"OverDue\",\"subscriptionDisplayName\":\"owuowh\",\"subscriptionId\":\"lnwy\",\"specialTaxationType\":\"SubtotalLevel\",\"subTotal\":{\"currency\":\"blgmokzkltrfowtd\",\"value\":76.91684},\"taxAmount\":{\"currency\":\"lihcvjdrqcr\",\"value\":78.2053},\"totalAmount\":{\"currency\":\"tuk\",\"value\":62.583202},\"refundDetails\":{\"requestedOn\":\"2021-02-03T01:15:49Z\",\"approvedOn\":\"2021-05-30T05:43:32Z\",\"completedOn\":\"2021-07-18T23:01:07Z\",\"amountRequested\":{\"currency\":\"zd\",\"value\":37.374027},\"amountRefunded\":{\"currency\":\"ixh\",\"value\":56.773537},\"rebillInvoiceId\":\"tqxmbj\",\"transactionCount\":1385225092,\"refundStatus\":\"Declined\",\"refundOperationId\":\"n\",\"refundReason\":\"ForgotToCancel\"}},\"tags\":{\"llywpvtiotzbp\":\"rhuzgfxonjtpu\",\"owsocnequygdjbo\":\"bollgryfqiuasig\"},\"id\":\"rmtqjkqevadr\",\"name\":\"mwiuawvcm\",\"type\":\"z\"}") - .toObject(InvoiceInner.class); - Assertions.assertEquals("rhuzgfxonjtpu", model.tags().get("llywpvtiotzbp")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - InvoiceInner model - = new InvoiceInner().withTags(mapOf("llywpvtiotzbp", "rhuzgfxonjtpu", "owsocnequygdjbo", "bollgryfqiuasig")) - .withProperties(new InvoiceProperties().withAmountDue(new InvoicePropertiesAmountDue()) - .withAzurePrepaymentApplied(new InvoicePropertiesAzurePrepaymentApplied()) - .withBilledAmount(new InvoicePropertiesBilledAmount()) - .withCreditAmount(new InvoicePropertiesCreditAmount()) - .withFreeAzureCreditApplied(new InvoicePropertiesFreeAzureCreditApplied()) - .withRebillDetails(new InvoicePropertiesRebillDetails()) - .withSubTotal(new InvoicePropertiesSubTotal()) - .withTaxAmount(new InvoicePropertiesTaxAmount()) - .withTotalAmount(new InvoicePropertiesTotalAmount()) - .withRefundDetails(new InvoicePropertiesRefundDetails() - .withAmountRequested(new RefundDetailsSummaryAmountRequested()) - .withAmountRefunded(new RefundDetailsSummaryAmountRefunded()))); - model = BinaryData.fromObject(model).toObject(InvoiceInner.class); - Assertions.assertEquals("rhuzgfxonjtpu", model.tags().get("llywpvtiotzbp")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoiceListResultTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoiceListResultTests.java deleted file mode 100644 index b684d31c68a4..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoiceListResultTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.InvoiceListResult; - -public final class InvoiceListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - InvoiceListResult model = BinaryData.fromString( - "{\"nextLink\":\"f\",\"value\":[{\"properties\":{\"amountDue\":{\"currency\":\"myw\",\"value\":87.18999},\"azurePrepaymentApplied\":{\"currency\":\"qmiciijqp\",\"value\":89.37822},\"billedAmount\":{\"currency\":\"jxjmcsmyqw\",\"value\":46.70122},\"billedDocumentId\":\"pwnkwywzwo\",\"billingProfileDisplayName\":\"lickduoi\",\"billingProfileId\":\"amt\",\"creditAmount\":{\"currency\":\"kn\",\"value\":99.17715},\"creditForDocumentId\":\"awnvsbcfhza\",\"documents\":[{\"documentNumbers\":[\"ycvdimw\",\"zregzgyufutrwpw\",\"ryekzkd\"],\"externalUrl\":\"eotta\",\"kind\":\"Transactions\",\"name\":\"sxwwhnhjtf\",\"url\":\"n\",\"source\":\"Other\"},{\"documentNumbers\":[\"jpnwynudql\",\"zsauzp\",\"lxeehuxiq\"],\"externalUrl\":\"lraymezxlskih\",\"kind\":\"Transactions\",\"name\":\"dsajrednwyysh\",\"url\":\"w\",\"source\":\"ENF\"},{\"documentNumbers\":[\"afpwzyifrkgwl\",\"xeqipx\",\"zdyi\"],\"externalUrl\":\"fayorpravkjoges\",\"kind\":\"Summary\",\"name\":\"smjkwynqxaekqsy\",\"url\":\"wjtq\",\"source\":\"DRS\"}],\"documentType\":\"Other\",\"dueDate\":\"2021-09-09T16:32:42Z\",\"failedPayments\":[{\"date\":\"2021-11-21T14:15:22Z\",\"failedPaymentReason\":\"CardExpired\"},{\"date\":\"2021-04-08T09:27:59Z\",\"failedPaymentReason\":\"CardExpired\"},{\"date\":\"2021-05-06T03:37:05Z\",\"failedPaymentReason\":\"Other\"},{\"date\":\"2021-09-14T01:09:51Z\",\"failedPaymentReason\":\"IncorrectCardDetails\"}],\"freeAzureCreditApplied\":{\"currency\":\"noytzposewxigp\",\"value\":21.748983},\"invoiceDate\":\"2021-08-07T19:20:08Z\",\"invoicePeriodEndDate\":\"2021-12-09T00:40:20Z\",\"invoicePeriodStartDate\":\"2021-01-03T23:55:07Z\",\"invoiceType\":\"AzureSupport\",\"isMonthlyInvoice\":false,\"payments\":[{\"amount\":{},\"date\":\"2021-08-28T15:20:20Z\",\"paymentMethodId\":\"zyzeyuubeidsz\",\"paymentMethodFamily\":\"EWallet\",\"paymentMethodType\":\"oithg\",\"paymentType\":\"vfltgvdi\"}],\"purchaseOrderNumber\":\"ynkrxwetw\",\"rebillDetails\":{\"invoiceDocumentId\":\"cy\",\"creditNoteDocumentId\":\"cpcunnuzdqum\",\"rebillDetails\":{\"invoiceDocumentId\":\"odnaienhqhskndn\",\"creditNoteDocumentId\":\"qkaadlknw\",\"rebillDetails\":{}}},\"status\":\"Other\",\"subscriptionDisplayName\":\"iyop\",\"subscriptionId\":\"xivcnrlyxnu\",\"specialTaxationType\":\"InvoiceLevel\",\"subTotal\":{\"currency\":\"blkwqpatvbqs\",\"value\":44.899593},\"taxAmount\":{\"currency\":\"ctvivuzqymtuo\",\"value\":93.75565},\"totalAmount\":{\"currency\":\"it\",\"value\":21.999056},\"refundDetails\":{\"requestedOn\":\"2021-10-20T07:30:57Z\",\"approvedOn\":\"2021-07-02T06:21:25Z\",\"completedOn\":\"2020-12-30T03:56:46Z\",\"amountRequested\":{\"currency\":\"nfzndscxmxeat\",\"value\":71.71517},\"amountRefunded\":{\"currency\":\"nrd\",\"value\":69.782715},\"rebillInvoiceId\":\"q\",\"transactionCount\":1425305755,\"refundStatus\":\"Expired\",\"refundOperationId\":\"jrmkuhmaxljalf\",\"refundReason\":\"AccidentalPurchase\"}},\"tags\":{\"a\":\"obcancdexxqcw\",\"zrltixldzyyf\":\"fgvaknokzwj\"},\"id\":\"pqsixymmp\",\"name\":\"jivyqlkjuv\",\"type\":\"mbmslzoyov\"}]}") - .toObject(InvoiceListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - InvoiceListResult model = new InvoiceListResult(); - model = BinaryData.fromObject(model).toObject(InvoiceListResult.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesAmountDueTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesAmountDueTests.java deleted file mode 100644 index e002dc83e617..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesAmountDueTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.InvoicePropertiesAmountDue; - -public final class InvoicePropertiesAmountDueTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - InvoicePropertiesAmountDue model = BinaryData.fromString("{\"currency\":\"xwmzwdfkbnrz\",\"value\":35.34176}") - .toObject(InvoicePropertiesAmountDue.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - InvoicePropertiesAmountDue model = new InvoicePropertiesAmountDue(); - model = BinaryData.fromObject(model).toObject(InvoicePropertiesAmountDue.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesAzurePrepaymentAppliedTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesAzurePrepaymentAppliedTests.java deleted file mode 100644 index 57feab4fbd44..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesAzurePrepaymentAppliedTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.InvoicePropertiesAzurePrepaymentApplied; - -public final class InvoicePropertiesAzurePrepaymentAppliedTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - InvoicePropertiesAzurePrepaymentApplied model - = BinaryData.fromString("{\"currency\":\"ltbqctqjfgxxsaet\",\"value\":41.15947}") - .toObject(InvoicePropertiesAzurePrepaymentApplied.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - InvoicePropertiesAzurePrepaymentApplied model = new InvoicePropertiesAzurePrepaymentApplied(); - model = BinaryData.fromObject(model).toObject(InvoicePropertiesAzurePrepaymentApplied.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesBilledAmountTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesBilledAmountTests.java deleted file mode 100644 index 24827676eda0..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesBilledAmountTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.InvoicePropertiesBilledAmount; - -public final class InvoicePropertiesBilledAmountTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - InvoicePropertiesBilledAmount model = BinaryData.fromString("{\"currency\":\"vpyigdaqq\",\"value\":78.38917}") - .toObject(InvoicePropertiesBilledAmount.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - InvoicePropertiesBilledAmount model = new InvoicePropertiesBilledAmount(); - model = BinaryData.fromObject(model).toObject(InvoicePropertiesBilledAmount.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesCreditAmountTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesCreditAmountTests.java deleted file mode 100644 index 803c3ec79250..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesCreditAmountTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.InvoicePropertiesCreditAmount; - -public final class InvoicePropertiesCreditAmountTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - InvoicePropertiesCreditAmount model = BinaryData.fromString("{\"currency\":\"cduwjoedx\",\"value\":91.458626}") - .toObject(InvoicePropertiesCreditAmount.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - InvoicePropertiesCreditAmount model = new InvoicePropertiesCreditAmount(); - model = BinaryData.fromObject(model).toObject(InvoicePropertiesCreditAmount.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesFreeAzureCreditAppliedTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesFreeAzureCreditAppliedTests.java deleted file mode 100644 index 56c83379d696..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesFreeAzureCreditAppliedTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.InvoicePropertiesFreeAzureCreditApplied; - -public final class InvoicePropertiesFreeAzureCreditAppliedTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - InvoicePropertiesFreeAzureCreditApplied model - = BinaryData.fromString("{\"currency\":\"siw\",\"value\":5.5490613}") - .toObject(InvoicePropertiesFreeAzureCreditApplied.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - InvoicePropertiesFreeAzureCreditApplied model = new InvoicePropertiesFreeAzureCreditApplied(); - model = BinaryData.fromObject(model).toObject(InvoicePropertiesFreeAzureCreditApplied.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesRebillDetailsTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesRebillDetailsTests.java deleted file mode 100644 index f00c2e70fdea..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesRebillDetailsTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.InvoicePropertiesRebillDetails; - -public final class InvoicePropertiesRebillDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - InvoicePropertiesRebillDetails model = BinaryData.fromString( - "{\"invoiceDocumentId\":\"lwfgziiu\",\"creditNoteDocumentId\":\"jjceatlijjjr\",\"rebillDetails\":{\"invoiceDocumentId\":\"mcaszknxkv\",\"creditNoteDocumentId\":\"xetyvku\",\"rebillDetails\":{\"invoiceDocumentId\":\"gno\",\"creditNoteDocumentId\":\"k\",\"rebillDetails\":{\"invoiceDocumentId\":\"ogjwpindedvabbxb\",\"creditNoteDocumentId\":\"edeilb\",\"rebillDetails\":{\"invoiceDocumentId\":\"fcfxzirzzihvwy\",\"creditNoteDocumentId\":\"suvjslcz\",\"rebillDetails\":{\"invoiceDocumentId\":\"idjsllfryv\",\"creditNoteDocumentId\":\"vxadqacfrgnawbab\",\"rebillDetails\":{}}}}}}}") - .toObject(InvoicePropertiesRebillDetails.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - InvoicePropertiesRebillDetails model = new InvoicePropertiesRebillDetails(); - model = BinaryData.fromObject(model).toObject(InvoicePropertiesRebillDetails.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesRefundDetailsTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesRefundDetailsTests.java deleted file mode 100644 index 6e0d71954015..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesRefundDetailsTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.InvoicePropertiesRefundDetails; -import com.azure.resourcemanager.billing.models.RefundDetailsSummaryAmountRefunded; -import com.azure.resourcemanager.billing.models.RefundDetailsSummaryAmountRequested; - -public final class InvoicePropertiesRefundDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - InvoicePropertiesRefundDetails model = BinaryData.fromString( - "{\"requestedOn\":\"2021-04-12T22:11:47Z\",\"approvedOn\":\"2021-05-20T21:34:33Z\",\"completedOn\":\"2021-05-08T16:54:42Z\",\"amountRequested\":{\"currency\":\"msxbaevwjcnkott\",\"value\":94.83965},\"amountRefunded\":{\"currency\":\"ajmailfemjjza\",\"value\":60.582817},\"rebillInvoiceId\":\"iqullqxbdmvr\",\"transactionCount\":1725625204,\"refundStatus\":\"Completed\",\"refundOperationId\":\"ndb\",\"refundReason\":\"AccidentalPurchase\"}") - .toObject(InvoicePropertiesRefundDetails.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - InvoicePropertiesRefundDetails model - = new InvoicePropertiesRefundDetails().withAmountRequested(new RefundDetailsSummaryAmountRequested()) - .withAmountRefunded(new RefundDetailsSummaryAmountRefunded()); - model = BinaryData.fromObject(model).toObject(InvoicePropertiesRefundDetails.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesSubTotalTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesSubTotalTests.java deleted file mode 100644 index 57ee499dabe4..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesSubTotalTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.InvoicePropertiesSubTotal; - -public final class InvoicePropertiesSubTotalTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - InvoicePropertiesSubTotal model = BinaryData.fromString("{\"currency\":\"ebgvo\",\"value\":0.98296404}") - .toObject(InvoicePropertiesSubTotal.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - InvoicePropertiesSubTotal model = new InvoicePropertiesSubTotal(); - model = BinaryData.fromObject(model).toObject(InvoicePropertiesSubTotal.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesTaxAmountTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesTaxAmountTests.java deleted file mode 100644 index a898a2865144..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesTaxAmountTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.InvoicePropertiesTaxAmount; - -public final class InvoicePropertiesTaxAmountTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - InvoicePropertiesTaxAmount model = BinaryData.fromString("{\"currency\":\"uoqujlyeg\",\"value\":6.863165}") - .toObject(InvoicePropertiesTaxAmount.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - InvoicePropertiesTaxAmount model = new InvoicePropertiesTaxAmount(); - model = BinaryData.fromObject(model).toObject(InvoicePropertiesTaxAmount.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesTests.java deleted file mode 100644 index f8e6d58d0fc6..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesTests.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.InvoiceProperties; -import com.azure.resourcemanager.billing.models.InvoicePropertiesAmountDue; -import com.azure.resourcemanager.billing.models.InvoicePropertiesAzurePrepaymentApplied; -import com.azure.resourcemanager.billing.models.InvoicePropertiesBilledAmount; -import com.azure.resourcemanager.billing.models.InvoicePropertiesCreditAmount; -import com.azure.resourcemanager.billing.models.InvoicePropertiesFreeAzureCreditApplied; -import com.azure.resourcemanager.billing.models.InvoicePropertiesRebillDetails; -import com.azure.resourcemanager.billing.models.InvoicePropertiesRefundDetails; -import com.azure.resourcemanager.billing.models.InvoicePropertiesSubTotal; -import com.azure.resourcemanager.billing.models.InvoicePropertiesTaxAmount; -import com.azure.resourcemanager.billing.models.InvoicePropertiesTotalAmount; -import com.azure.resourcemanager.billing.models.RefundDetailsSummaryAmountRefunded; -import com.azure.resourcemanager.billing.models.RefundDetailsSummaryAmountRequested; - -public final class InvoicePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - InvoiceProperties model = BinaryData.fromString( - "{\"amountDue\":{\"currency\":\"idisczskosw\",\"value\":74.71487},\"azurePrepaymentApplied\":{\"currency\":\"zugamxzkrrcoiis\",\"value\":73.20618},\"billedAmount\":{\"currency\":\"pccekuztdsbezaxy\",\"value\":31.759613},\"billedDocumentId\":\"xuizhyhnepkpet\",\"billingProfileDisplayName\":\"rx\",\"billingProfileId\":\"ubxdukecpxdazvdh\",\"creditAmount\":{\"currency\":\"mkoszudbl\",\"value\":66.54765},\"creditForDocumentId\":\"rpcaqkiofkbtf\",\"documents\":[{\"documentNumbers\":[\"nldpvcbhhezyquwu\",\"qxutrpbrruyuua\",\"vlm\"],\"externalUrl\":\"wcolbmxl\",\"kind\":\"TaxReceipt\",\"name\":\"pcpahprzrvxhmtf\",\"url\":\"cnxzcmj\",\"source\":\"ENF\"}],\"documentType\":\"TaxReceipt\",\"dueDate\":\"2021-09-29T12:00:56Z\",\"failedPayments\":[{\"date\":\"2021-11-30T21:38:03Z\",\"failedPaymentReason\":\"Other\"},{\"date\":\"2021-08-16T03:52:55Z\",\"failedPaymentReason\":\"Other\"},{\"date\":\"2021-02-13T15:58:39Z\",\"failedPaymentReason\":\"CardExpired\"}],\"freeAzureCreditApplied\":{\"currency\":\"idwhepfw\",\"value\":57.815914},\"invoiceDate\":\"2021-05-13T01:39:31Z\",\"invoicePeriodEndDate\":\"2020-12-22T04:54:50Z\",\"invoicePeriodStartDate\":\"2021-11-13T15:05:10Z\",\"invoiceType\":\"AzureServices\",\"isMonthlyInvoice\":true,\"payments\":[{\"amount\":{\"currency\":\"ky\",\"value\":54.800594},\"date\":\"2021-02-04T04:36:41Z\",\"paymentMethodId\":\"hnegknj\",\"paymentMethodFamily\":\"CheckWire\",\"paymentMethodType\":\"t\",\"paymentType\":\"plvukaobrlbpg\"},{\"amount\":{\"currency\":\"agnchjhgemuowaky\",\"value\":31.04565},\"date\":\"2021-05-09T15:29:15Z\",\"paymentMethodId\":\"m\",\"paymentMethodFamily\":\"CreditCard\",\"paymentMethodType\":\"tagdrc\",\"paymentType\":\"soljome\"}],\"purchaseOrderNumber\":\"fycnlb\",\"rebillDetails\":{\"invoiceDocumentId\":\"codkkgj\",\"creditNoteDocumentId\":\"ytssikiz\",\"rebillDetails\":{\"invoiceDocumentId\":\"fqb\",\"creditNoteDocumentId\":\"tnrgmqsorhce\",\"rebillDetails\":{\"invoiceDocumentId\":\"nl\",\"creditNoteDocumentId\":\"mxcpwzvmdoks\",\"rebillDetails\":{\"invoiceDocumentId\":\"iw\",\"creditNoteDocumentId\":\"xlbonc\",\"rebillDetails\":{\"invoiceDocumentId\":\"zqicqchygtvxbyja\",\"creditNoteDocumentId\":\"pubdpkx\",\"rebillDetails\":{}}}}}},\"status\":\"Locked\",\"subscriptionDisplayName\":\"i\",\"subscriptionId\":\"detv\",\"specialTaxationType\":\"InvoiceLevel\",\"subTotal\":{\"currency\":\"xuwsai\",\"value\":2.1083474},\"taxAmount\":{\"currency\":\"osbz\",\"value\":7.057774},\"totalAmount\":{\"currency\":\"vkbcknjolgjyyxp\",\"value\":57.560802},\"refundDetails\":{\"requestedOn\":\"2021-03-19T01:41:25Z\",\"approvedOn\":\"2021-11-08T11:46:39Z\",\"completedOn\":\"2021-10-28T04:16:21Z\",\"amountRequested\":{\"currency\":\"o\",\"value\":33.21297},\"amountRefunded\":{\"currency\":\"xwaljgl\",\"value\":89.85446},\"rebillInvoiceId\":\"qwaafrqulhm\",\"transactionCount\":288058260,\"refundStatus\":\"Other\",\"refundOperationId\":\"vafjrqpjiyrqj\",\"refundReason\":\"AccidentalPurchase\"}}") - .toObject(InvoiceProperties.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - InvoiceProperties model = new InvoiceProperties().withAmountDue(new InvoicePropertiesAmountDue()) - .withAzurePrepaymentApplied(new InvoicePropertiesAzurePrepaymentApplied()) - .withBilledAmount(new InvoicePropertiesBilledAmount()) - .withCreditAmount(new InvoicePropertiesCreditAmount()) - .withFreeAzureCreditApplied(new InvoicePropertiesFreeAzureCreditApplied()) - .withRebillDetails(new InvoicePropertiesRebillDetails()) - .withSubTotal(new InvoicePropertiesSubTotal()) - .withTaxAmount(new InvoicePropertiesTaxAmount()) - .withTotalAmount(new InvoicePropertiesTotalAmount()) - .withRefundDetails( - new InvoicePropertiesRefundDetails().withAmountRequested(new RefundDetailsSummaryAmountRequested()) - .withAmountRefunded(new RefundDetailsSummaryAmountRefunded())); - model = BinaryData.fromObject(model).toObject(InvoiceProperties.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesTotalAmountTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesTotalAmountTests.java deleted file mode 100644 index b89c5e116b84..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicePropertiesTotalAmountTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.InvoicePropertiesTotalAmount; - -public final class InvoicePropertiesTotalAmountTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - InvoicePropertiesTotalAmount model - = BinaryData.fromString("{\"currency\":\"igflqqbtnyjp\",\"value\":14.436751}") - .toObject(InvoicePropertiesTotalAmount.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - InvoicePropertiesTotalAmount model = new InvoicePropertiesTotalAmount(); - model = BinaryData.fromObject(model).toObject(InvoicePropertiesTotalAmount.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesDownloadByBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesDownloadByBillingAccountMockTests.java deleted file mode 100644 index 91891b9c6f22..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesDownloadByBillingAccountMockTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.DocumentDownloadResult; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class InvoicesDownloadByBillingAccountMockTests { - @Test - public void testDownloadByBillingAccount() throws Exception { - String responseStr = "{\"expiryTime\":\"ndprwruexhgdhpkp\",\"url\":\"seyltqxfpfop\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - DocumentDownloadResult response = manager.invoices() - .downloadByBillingAccount("aeqbo", "gwjxatwxiyarfhi", "sytidz", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesDownloadByBillingSubscriptionMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesDownloadByBillingSubscriptionMockTests.java deleted file mode 100644 index d2f5aab4dbbe..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesDownloadByBillingSubscriptionMockTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.DocumentDownloadResult; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class InvoicesDownloadByBillingSubscriptionMockTests { - @Test - public void testDownloadByBillingSubscription() throws Exception { - String responseStr = "{\"expiryTime\":\"mbxerz\",\"url\":\"cralwvcnmrb\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - DocumentDownloadResult response = manager.invoices() - .downloadByBillingSubscription("ijclfdprezqx", "xeigyddp", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesDownloadDocumentsByBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesDownloadDocumentsByBillingAccountMockTests.java deleted file mode 100644 index 97a0bc3c1ddf..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesDownloadDocumentsByBillingAccountMockTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.DocumentDownloadRequest; -import com.azure.resourcemanager.billing.models.DocumentDownloadResult; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class InvoicesDownloadDocumentsByBillingAccountMockTests { - @Test - public void testDownloadDocumentsByBillingAccount() throws Exception { - String responseStr = "{\"expiryTime\":\"nawzeleqpnkqxk\",\"url\":\"m\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - DocumentDownloadResult response - = manager.invoices() - .downloadDocumentsByBillingAccount("dvtwunc", Arrays.asList( - new DocumentDownloadRequest().withDocumentName("yjwjmyubhtmlgjai").withInvoiceName("ymjdwirglqibj"), - new DocumentDownloadRequest().withDocumentName("mka").withInvoiceName("uxbzfhurrw"), - new DocumentDownloadRequest().withDocumentName("wwitzmxxigl").withInvoiceName("ylbnayypsxyhoem"), - new DocumentDownloadRequest().withDocumentName("nmmpvopvfgukr").withInvoiceName("mwdqw")), - com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesDownloadDocumentsByBillingSubscriptionMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesDownloadDocumentsByBillingSubscriptionMockTests.java deleted file mode 100644 index 936e1f9b17e0..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesDownloadDocumentsByBillingSubscriptionMockTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.DocumentDownloadRequest; -import com.azure.resourcemanager.billing.models.DocumentDownloadResult; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class InvoicesDownloadDocumentsByBillingSubscriptionMockTests { - @Test - public void testDownloadDocumentsByBillingSubscription() throws Exception { - String responseStr = "{\"expiryTime\":\"vbdyriyraybi\",\"url\":\"s\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - DocumentDownloadResult response = manager.invoices() - .downloadDocumentsByBillingSubscription( - Arrays.asList(new DocumentDownloadRequest().withDocumentName("zijxefydck").withInvoiceName("kz"), - new DocumentDownloadRequest().withDocumentName("hrkiwp").withInvoiceName("nhflx"), - new DocumentDownloadRequest().withDocumentName("itrugo").withInvoiceName("rdlfewex")), - com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesDownloadSummaryByBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesDownloadSummaryByBillingAccountMockTests.java deleted file mode 100644 index fce9d2067599..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesDownloadSummaryByBillingAccountMockTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.DocumentDownloadResult; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class InvoicesDownloadSummaryByBillingAccountMockTests { - @Test - public void testDownloadSummaryByBillingAccount() throws Exception { - String responseStr = "{\"expiryTime\":\"vzpqrxsifixo\",\"url\":\"nylfutgbpw\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - DocumentDownloadResult response = manager.invoices() - .downloadSummaryByBillingAccount("kyzdzvhyoiddve", "yj", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesGetByBillingAccountWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesGetByBillingAccountWithResponseMockTests.java deleted file mode 100644 index 3ee8d7445485..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesGetByBillingAccountWithResponseMockTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.Invoice; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class InvoicesGetByBillingAccountWithResponseMockTests { - @Test - public void testGetByBillingAccountWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"amountDue\":{\"currency\":\"alorxeegi\",\"value\":55.976494},\"azurePrepaymentApplied\":{\"currency\":\"e\",\"value\":52.930935},\"billedAmount\":{\"currency\":\"dihk\",\"value\":62.888504},\"billedDocumentId\":\"gkk\",\"billingProfileDisplayName\":\"wmjmgs\",\"billingProfileId\":\"w\",\"creditAmount\":{\"currency\":\"uqgneorqtrkxeikq\",\"value\":43.411427},\"creditForDocumentId\":\"nzbkqqbjcdaucs\",\"documents\":[{\"documentNumbers\":[\"jynuwcquepanqdm\",\"rodp\",\"tblmxblcbwvsqp\"],\"externalUrl\":\"vlcbbulepcgi\",\"kind\":\"Other\",\"name\":\"lx\",\"url\":\"yzcnxjvipehxlbb\",\"source\":\"Other\"},{\"documentNumbers\":[\"vgjipbnnghsjxwjn\",\"goxenhpyix\",\"brsaeuzsojblyygf\"],\"externalUrl\":\"cuydrswqmteuy\",\"kind\":\"Invoice\",\"name\":\"ea\",\"url\":\"rbnvoephtto\",\"source\":\"ENF\"},{\"documentNumbers\":[\"v\",\"rlrsrfrxy\"],\"externalUrl\":\"djpspipkpcvhqa\",\"kind\":\"CreditNote\",\"name\":\"sncgquixuqvatstk\",\"url\":\"ivcktjscjkexybx\",\"source\":\"Other\"}],\"documentType\":\"VoidNote\",\"dueDate\":\"2021-03-04T12:10:33Z\",\"failedPayments\":[{\"date\":\"2021-02-27T01:36:33Z\",\"failedPaymentReason\":\"IncorrectCardDetails\"},{\"date\":\"2021-01-02T14:40:07Z\",\"failedPaymentReason\":\"Other\"}],\"freeAzureCreditApplied\":{\"currency\":\"js\",\"value\":87.742256},\"invoiceDate\":\"2021-07-26T17:52:37Z\",\"invoicePeriodEndDate\":\"2021-01-21T06:55:08Z\",\"invoicePeriodStartDate\":\"2021-05-06T11:36:02Z\",\"invoiceType\":\"Other\",\"isMonthlyInvoice\":true,\"payments\":[{\"amount\":{\"currency\":\"fktytrivfleqv\",\"value\":48.087166},\"date\":\"2021-07-09T08:56:23Z\",\"paymentMethodId\":\"miwbaksz\",\"paymentMethodFamily\":\"Other\",\"paymentMethodType\":\"cezasjy\",\"paymentType\":\"hvt\"}],\"purchaseOrderNumber\":\"xlybddxebdhmxb\",\"rebillDetails\":{\"invoiceDocumentId\":\"jgrepbrbmc\",\"creditNoteDocumentId\":\"vxjwpvqrexlui\",\"rebillDetails\":{\"invoiceDocumentId\":\"qwbrfiovpdlt\",\"creditNoteDocumentId\":\"rfiwerlbcetrvird\",\"rebillDetails\":{\"invoiceDocumentId\":\"swpvnloopzyz\",\"creditNoteDocumentId\":\"chtabhacjlfq\",\"rebillDetails\":{}}}},\"status\":\"OverDue\",\"subscriptionDisplayName\":\"vwvpfqtpvz\",\"subscriptionId\":\"lnfvyhdhffnsdmha\",\"specialTaxationType\":\"InvoiceLevel\",\"subTotal\":{\"currency\":\"kmazhlewyrok\",\"value\":5.016178},\"taxAmount\":{\"currency\":\"fzzipyqtmdhb\",\"value\":65.221344},\"totalAmount\":{\"currency\":\"wxzlphzujkqaxbej\",\"value\":12.930525},\"refundDetails\":{\"requestedOn\":\"2021-10-11T02:33:04Z\",\"approvedOn\":\"2021-05-08T09:40:26Z\",\"completedOn\":\"2021-01-29T18:33:34Z\",\"amountRequested\":{\"currency\":\"hdapxdiibjjwue\",\"value\":67.662224},\"amountRefunded\":{\"currency\":\"hxhuhhnrmmfzfkh\",\"value\":14.988953},\"rebillInvoiceId\":\"ffajh\",\"transactionCount\":1272932771,\"refundStatus\":\"Approved\",\"refundOperationId\":\"ciedlqvpdt\",\"refundReason\":\"AccidentalPurchase\"}},\"tags\":{\"cawfupnypluivrjs\":\"rwlfgbuugchjtps\",\"egzxrusafvf\":\"lauzrpespeb\",\"uoh\":\"yqa\"},\"id\":\"imntxdvl\",\"name\":\"mnwhdhoyv\",\"type\":\"dumaplp\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Invoice response = manager.invoices() - .getByBillingAccountWithResponse("uayx", "vpiultybwwmjr", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("rwlfgbuugchjtps", response.tags().get("cawfupnypluivrjs")); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesGetByBillingSubscriptionWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesGetByBillingSubscriptionWithResponseMockTests.java deleted file mode 100644 index 7f97fe03a304..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesGetByBillingSubscriptionWithResponseMockTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.Invoice; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class InvoicesGetByBillingSubscriptionWithResponseMockTests { - @Test - public void testGetByBillingSubscriptionWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"amountDue\":{\"currency\":\"cujdzlgyermj\",\"value\":0.44757724},\"azurePrepaymentApplied\":{\"currency\":\"hoqpbfjfcbweabpt\",\"value\":99.95556},\"billedAmount\":{\"currency\":\"uvcgvnomlc\",\"value\":66.38444},\"billedDocumentId\":\"ohuafuclopnemsyl\",\"billingProfileDisplayName\":\"mdoowfrgdmbgbht\",\"billingProfileId\":\"miustkqywabhlg\",\"creditAmount\":{\"currency\":\"kvtzbk\",\"value\":44.105633},\"creditForDocumentId\":\"pf\",\"documents\":[{\"documentNumbers\":[\"judekmxhwz\",\"ehcdfdxthqnztu\",\"ir\"],\"externalUrl\":\"dijdhzkwvuewei\",\"kind\":\"CreditNote\",\"name\":\"lswlxdknxctglzb\",\"url\":\"dfsg\",\"source\":\"Other\"},{\"documentNumbers\":[\"wb\",\"judxzfvna\",\"c\",\"fchnqiyevjehtsea\"],\"externalUrl\":\"xsehflfmabpyz\",\"kind\":\"VoidNote\",\"name\":\"ph\",\"url\":\"tvurtkcepy\",\"source\":\"Other\"},{\"documentNumbers\":[\"bwx\",\"sdisxsrrhryrbb\",\"d\"],\"externalUrl\":\"rjzzuimpi\",\"kind\":\"TaxReceipt\",\"name\":\"btihc\",\"url\":\"mfb\",\"source\":\"Other\"}],\"documentType\":\"Invoice\",\"dueDate\":\"2021-08-12T07:06:46Z\",\"failedPayments\":[{\"date\":\"2021-03-07T20:29:19Z\",\"failedPaymentReason\":\"CardExpired\"},{\"date\":\"2021-08-13T22:49:20Z\",\"failedPaymentReason\":\"BankDeclined\"},{\"date\":\"2021-07-14T06:50:47Z\",\"failedPaymentReason\":\"CardExpired\"}],\"freeAzureCreditApplied\":{\"currency\":\"sichhxqnlmjvpms\",\"value\":26.667011},\"invoiceDate\":\"2021-04-11T07:39:05Z\",\"invoicePeriodEndDate\":\"2021-02-06T21:05:23Z\",\"invoicePeriodStartDate\":\"2021-10-19T14:35:20Z\",\"invoiceType\":\"AzureServices\",\"isMonthlyInvoice\":false,\"payments\":[{\"amount\":{\"currency\":\"zjsnxzljxa\",\"value\":3.5962284},\"date\":\"2021-05-23T07:51:33Z\",\"paymentMethodId\":\"vgyujkxjge\",\"paymentMethodFamily\":\"CreditCard\",\"paymentMethodType\":\"igitra\",\"paymentType\":\"dy\"},{\"amount\":{\"currency\":\"rnbpiddvbxqxo\",\"value\":60.682243},\"date\":\"2021-04-12T05:40:17Z\",\"paymentMethodId\":\"srymzvtzyfkt\",\"paymentMethodFamily\":\"EWallet\",\"paymentMethodType\":\"asnj\",\"paymentType\":\"kiyzlkqyez\"},{\"amount\":{\"currency\":\"krdfd\",\"value\":67.45364},\"date\":\"2021-01-12T17:36:07Z\",\"paymentMethodId\":\"ystltkq\",\"paymentMethodFamily\":\"None\",\"paymentMethodType\":\"iiqajfwzubfg\",\"paymentType\":\"vzbueiydoqb\"},{\"amount\":{\"currency\":\"lxptxhednkzjtrja\",\"value\":34.78672},\"date\":\"2021-08-09T15:49:05Z\",\"paymentMethodId\":\"eix\",\"paymentMethodFamily\":\"DirectDebit\",\"paymentMethodType\":\"gznacmkwcyelj\",\"paymentType\":\"adgzxbwn\"}],\"purchaseOrderNumber\":\"ihctyukmz\",\"rebillDetails\":{\"invoiceDocumentId\":\"khtvughu\",\"creditNoteDocumentId\":\"qlmvnfyfyf\",\"rebillDetails\":{\"invoiceDocumentId\":\"zbd\",\"creditNoteDocumentId\":\"ykiumagfyinmajj\",\"rebillDetails\":{\"invoiceDocumentId\":\"gtwfk\",\"creditNoteDocumentId\":\"cvbzkbebuafbdd\",\"rebillDetails\":{}}}},\"status\":\"Locked\",\"subscriptionDisplayName\":\"nml\",\"subscriptionId\":\"gzzohtag\",\"specialTaxationType\":\"SubtotalLevel\",\"subTotal\":{\"currency\":\"qhqgrksy\",\"value\":20.251633},\"taxAmount\":{\"currency\":\"xzobovsvhbtdgxg\",\"value\":7.0223093},\"totalAmount\":{\"currency\":\"oubvfx\",\"value\":17.71515},\"refundDetails\":{\"requestedOn\":\"2021-07-31T21:52:50Z\",\"approvedOn\":\"2021-07-09T21:33Z\",\"completedOn\":\"2021-03-23T23:53:17Z\",\"amountRequested\":{\"currency\":\"zeaicmvbsjtfqwlb\",\"value\":65.48781},\"amountRefunded\":{\"currency\":\"scgropuqgiscgk\",\"value\":68.70343},\"rebillInvoiceId\":\"ikqlyoorme\",\"transactionCount\":580850984,\"refundStatus\":\"Cancelled\",\"refundOperationId\":\"jyk\",\"refundReason\":\"Other\"}},\"tags\":{\"ulcd\":\"uznbcpiadjslvx\"},\"id\":\"ib\",\"name\":\"viacghygm\",\"type\":\"bivpz\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Invoice response = manager.invoices() - .getByBillingSubscriptionWithResponse("zxqld", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("uznbcpiadjslvx", response.tags().get("ulcd")); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesGetWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesGetWithResponseMockTests.java deleted file mode 100644 index d5930039a5eb..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesGetWithResponseMockTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.Invoice; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class InvoicesGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"amountDue\":{\"currency\":\"wbnwdkgbzjoyy\",\"value\":31.932968},\"azurePrepaymentApplied\":{\"currency\":\"doqxkzeowizv\",\"value\":55.130047},\"billedAmount\":{\"currency\":\"k\",\"value\":45.320618},\"billedDocumentId\":\"wkxxboauvkkco\",\"billingProfileDisplayName\":\"nwhld\",\"billingProfileId\":\"n\",\"creditAmount\":{\"currency\":\"uqmdynmtnlcvl\",\"value\":40.62859},\"creditForDocumentId\":\"edrbzzb\",\"documents\":[{\"documentNumbers\":[\"xwcndkdlxdlh\"],\"externalUrl\":\"l\",\"kind\":\"Transactions\",\"name\":\"wkyxowno\",\"url\":\"qus\",\"source\":\"Other\"}],\"documentType\":\"Invoice\",\"dueDate\":\"2021-04-03T17:46:24Z\",\"failedPayments\":[{\"date\":\"2021-12-05T05:46:45Z\",\"failedPaymentReason\":\"BankDeclined\"},{\"date\":\"2021-10-19T14:18:51Z\",\"failedPaymentReason\":\"Other\"},{\"date\":\"2021-03-25T13:21:33Z\",\"failedPaymentReason\":\"Other\"}],\"freeAzureCreditApplied\":{\"currency\":\"pprszehijlwrf\",\"value\":31.895458},\"invoiceDate\":\"2021-04-07T06:35:41Z\",\"invoicePeriodEndDate\":\"2021-10-06T09:53:27Z\",\"invoicePeriodStartDate\":\"2021-04-02T08:47:21Z\",\"invoiceType\":\"AzureServices\",\"isMonthlyInvoice\":true,\"payments\":[{\"amount\":{\"currency\":\"l\",\"value\":19.73927},\"date\":\"2021-05-30T13:37:29Z\",\"paymentMethodId\":\"i\",\"paymentMethodFamily\":\"EWallet\",\"paymentMethodType\":\"qmvnhsfjxtus\",\"paymentType\":\"xpuokk\"},{\"amount\":{\"currency\":\"s\",\"value\":94.20208},\"date\":\"2021-05-05T17:37:31Z\",\"paymentMethodId\":\"onalpwa\",\"paymentMethodFamily\":\"EWallet\",\"paymentMethodType\":\"uyasjwnwnjdrnf\",\"paymentType\":\"mupblhnxqvzz\"}],\"purchaseOrderNumber\":\"xufuwcajyezlk\",\"rebillDetails\":{\"invoiceDocumentId\":\"eftugiwsvlf\",\"creditNoteDocumentId\":\"bpnrgnxwrfu\",\"rebillDetails\":{\"invoiceDocumentId\":\"y\",\"creditNoteDocumentId\":\"zuvu\",\"rebillDetails\":{\"invoiceDocumentId\":\"y\",\"creditNoteDocumentId\":\"cjclvbqovk\",\"rebillDetails\":{}}}},\"status\":\"OverDue\",\"subscriptionDisplayName\":\"phnazp\",\"subscriptionId\":\"fcubxlmqhed\",\"specialTaxationType\":\"SubtotalLevel\",\"subTotal\":{\"currency\":\"yhzyf\",\"value\":28.069782},\"taxAmount\":{\"currency\":\"rzvdjpcevbkkgqfj\",\"value\":97.70191},\"totalAmount\":{\"currency\":\"pwxghwwfq\",\"value\":25.156248},\"refundDetails\":{\"requestedOn\":\"2021-03-16T22:44:26Z\",\"approvedOn\":\"2021-04-15T09:30:50Z\",\"completedOn\":\"2021-09-03T13:05:30Z\",\"amountRequested\":{\"currency\":\"sqepxftyif\",\"value\":92.90886},\"amountRefunded\":{\"currency\":\"ifdrbsrpjs\",\"value\":10.842013},\"rebillInvoiceId\":\"snxmfooin\",\"transactionCount\":819372658,\"refundStatus\":\"Expired\",\"refundOperationId\":\"gcuwgkmqcb\",\"refundReason\":\"Other\"}},\"tags\":{\"mlpihtep\":\"uxktsxnikcgitt\",\"invfcdsijsinybn\":\"sjeb\",\"ayxujzoxgakqt\":\"lx\"},\"id\":\"jucazwedmahulxgc\",\"name\":\"mxoanudvqa\",\"type\":\"nenxg\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Invoice response - = manager.invoices().getWithResponse("gpymyerpusozaou", com.azure.core.util.Context.NONE).getValue(); - - Assertions.assertEquals("uxktsxnikcgitt", response.tags().get("mlpihtep")); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesListByBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesListByBillingAccountMockTests.java deleted file mode 100644 index 0b84b5c4f6a1..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesListByBillingAccountMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.Invoice; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class InvoicesListByBillingAccountMockTests { - @Test - public void testListByBillingAccount() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"amountDue\":{\"currency\":\"cs\",\"value\":90.27052},\"azurePrepaymentApplied\":{\"currency\":\"xiiqwqb\",\"value\":72.631294},\"billedAmount\":{\"currency\":\"pxnaaii\",\"value\":4.1321993},\"billedDocumentId\":\"uywrxnksmaeb\",\"billingProfileDisplayName\":\"xjsmrseauxeovbgr\",\"billingProfileId\":\"fuxnt\",\"creditAmount\":{\"currency\":\"yl\",\"value\":34.24107},\"creditForDocumentId\":\"tkviptqhatfgkhhb\",\"documents\":[{\"documentNumbers\":[\"kdm\"],\"externalUrl\":\"lhhbu\",\"kind\":\"CreditNote\",\"name\":\"uwhvqihm\",\"url\":\"qjdc\",\"source\":\"Other\"},{\"documentNumbers\":[\"jtiljxagcal\",\"qzcraxilz\",\"xcmpdmdsyp\",\"sfrhiehxjo\"],\"externalUrl\":\"x\",\"kind\":\"Summary\",\"name\":\"ecxuvkbaoqvvyhg\",\"url\":\"jd\",\"source\":\"ENF\"},{\"documentNumbers\":[\"j\",\"epukuo\",\"zwiztv\"],\"externalUrl\":\"yackgka\",\"kind\":\"VoidNote\",\"name\":\"tpcohfksixvwkpce\",\"url\":\"urjabpn\",\"source\":\"ENF\"}],\"documentType\":\"Transactions\",\"dueDate\":\"2021-10-07T22:12:30Z\",\"failedPayments\":[{\"date\":\"2021-09-05T10:42:30Z\",\"failedPaymentReason\":\"Other\"},{\"date\":\"2021-03-17T05:12:37Z\",\"failedPaymentReason\":\"CardExpired\"}],\"freeAzureCreditApplied\":{\"currency\":\"rqtgdipbn\",\"value\":58.700718},\"invoiceDate\":\"2021-10-15T04:24:58Z\",\"invoicePeriodEndDate\":\"2021-05-29T14:45:12Z\",\"invoicePeriodStartDate\":\"2021-05-09T08:27:08Z\",\"invoiceType\":\"AzureMarketplace\",\"isMonthlyInvoice\":false,\"payments\":[{\"amount\":{\"currency\":\"kgmwurcx\",\"value\":37.30622},\"date\":\"2021-08-09T17:12:07Z\",\"paymentMethodId\":\"nypfkvjgovbbnc\",\"paymentMethodFamily\":\"None\",\"paymentMethodType\":\"aqgmztlru\",\"paymentType\":\"kwoupmqffgjsqq\"},{\"amount\":{\"currency\":\"rooglwujo\",\"value\":57.50421},\"date\":\"2021-09-26T22:25:50Z\",\"paymentMethodId\":\"pavqo\",\"paymentMethodFamily\":\"Other\",\"paymentMethodType\":\"megnkr\",\"paymentType\":\"fb\"},{\"amount\":{\"currency\":\"r\",\"value\":37.18043},\"date\":\"2021-06-20T18:47:23Z\",\"paymentMethodId\":\"tezdxqh\",\"paymentMethodFamily\":\"CheckWire\",\"paymentMethodType\":\"gimyo\",\"paymentType\":\"eflgnieeqjdfxx\"},{\"amount\":{\"currency\":\"duxkepga\",\"value\":99.88325},\"date\":\"2021-01-31T01:56:55Z\",\"paymentMethodId\":\"terqfuterrc\",\"paymentMethodFamily\":\"Other\",\"paymentMethodType\":\"fqddwwpgc\",\"paymentType\":\"wupqkvmygueef\"}],\"purchaseOrderNumber\":\"z\",\"rebillDetails\":{\"invoiceDocumentId\":\"vtj\",\"creditNoteDocumentId\":\"dagwxjafbdvpcd\",\"rebillDetails\":{\"invoiceDocumentId\":\"jzxr\",\"creditNoteDocumentId\":\"jiraupirvdon\",\"rebillDetails\":{\"invoiceDocumentId\":\"ngvgjgcwwuusjjht\",\"creditNoteDocumentId\":\"znrhig\",\"rebillDetails\":{}}}},\"status\":\"Due\",\"subscriptionDisplayName\":\"mfrnktsv\",\"subscriptionId\":\"darjteqlujmmknia\",\"specialTaxationType\":\"InvoiceLevel\",\"subTotal\":{\"currency\":\"ximeztasf\",\"value\":74.45727},\"taxAmount\":{\"currency\":\"weo\",\"value\":29.93952},\"totalAmount\":{\"currency\":\"t\",\"value\":91.313866},\"refundDetails\":{\"requestedOn\":\"2021-05-19T21:17:24Z\",\"approvedOn\":\"2021-09-21T18:39:54Z\",\"completedOn\":\"2021-06-08T00:47:35Z\",\"amountRequested\":{\"currency\":\"gigbpa\",\"value\":81.05206},\"amountRefunded\":{\"currency\":\"eirjrkak\",\"value\":97.59007},\"rebillInvoiceId\":\"ub\",\"transactionCount\":1663900681,\"refundStatus\":\"Expired\",\"refundOperationId\":\"bdukid\",\"refundReason\":\"UnclearPricing\"}},\"tags\":{\"dtedxz\":\"rlgpkypbekpardo\"},\"id\":\"hbzmgzsytm\",\"name\":\"fslrxvsqsbqrqb\",\"type\":\"iqfstkd\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.invoices() - .listByBillingAccount("zriettnmiufpbf", null, null, "mlm", "yqyekuw", 2854650258462411794L, - 48766234098607550L, true, "gumydogrtfwzec", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("rlgpkypbekpardo", response.iterator().next().tags().get("dtedxz")); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesListByBillingProfileMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesListByBillingProfileMockTests.java deleted file mode 100644 index b34d39b29ccb..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesListByBillingProfileMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.Invoice; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class InvoicesListByBillingProfileMockTests { - @Test - public void testListByBillingProfile() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"amountDue\":{\"currency\":\"hrfcowlasewif\",\"value\":74.21918},\"azurePrepaymentApplied\":{\"currency\":\"ylaqh\",\"value\":6.5508485},\"billedAmount\":{\"currency\":\"arvjhwgkynxlwr\",\"value\":64.703575},\"billedDocumentId\":\"dtmck\",\"billingProfileDisplayName\":\"al\",\"billingProfileId\":\"i\",\"creditAmount\":{\"currency\":\"nkylzrignql\",\"value\":28.22091},\"creditForDocumentId\":\"nbjuaiu\",\"documents\":[{\"documentNumbers\":[\"bnkivexiath\",\"a\",\"yywy\",\"cenkbfxqcap\"],\"externalUrl\":\"eciradmxokbu\",\"kind\":\"TaxReceipt\",\"name\":\"cxzayvcse\",\"url\":\"hrodyiitreddjt\",\"source\":\"DRS\"},{\"documentNumbers\":[\"bsec\",\"gaxmhaszjie\",\"fstdwqdvzcnlkv\"],\"externalUrl\":\"jtkreisojhusw\",\"kind\":\"Summary\",\"name\":\"ko\",\"url\":\"gwavzmqp\",\"source\":\"ENF\"}],\"documentType\":\"Transactions\",\"dueDate\":\"2020-12-23T12:50:19Z\",\"failedPayments\":[{\"date\":\"2021-02-28T08:43:38Z\",\"failedPaymentReason\":\"IncorrectCardDetails\"},{\"date\":\"2021-11-04T18:47:51Z\",\"failedPaymentReason\":\"BankDeclined\"},{\"date\":\"2021-08-10T11:30:05Z\",\"failedPaymentReason\":\"CardExpired\"},{\"date\":\"2021-06-04T02:01:45Z\",\"failedPaymentReason\":\"Other\"}],\"freeAzureCreditApplied\":{\"currency\":\"icxepgaxpyde\",\"value\":91.599594},\"invoiceDate\":\"2021-03-08T20:52:26Z\",\"invoicePeriodEndDate\":\"2021-06-30T08:56:58Z\",\"invoicePeriodStartDate\":\"2021-07-23T07:56:05Z\",\"invoiceType\":\"Other\",\"isMonthlyInvoice\":true,\"payments\":[{\"amount\":{\"currency\":\"nhsmnfgzmxtxfu\",\"value\":97.32512},\"date\":\"2021-09-05T04:18:58Z\",\"paymentMethodId\":\"y\",\"paymentMethodFamily\":\"TaskOrder\",\"paymentMethodType\":\"knglffnozzfysffr\",\"paymentType\":\"fxsyxcdosy\"},{\"amount\":{\"currency\":\"pu\",\"value\":69.48792},\"date\":\"2021-08-19T13:20:49Z\",\"paymentMethodId\":\"yilqcskxkteoykq\",\"paymentMethodFamily\":\"None\",\"paymentMethodType\":\"qogrddimna\",\"paymentType\":\"lyrbvmbdgexp\"},{\"amount\":{\"currency\":\"tqwfpjpsbcxqi\",\"value\":48.66015},\"date\":\"2021-09-22T12:12:52Z\",\"paymentMethodId\":\"jlfugnrzowcgrz\",\"paymentMethodFamily\":\"Other\",\"paymentMethodType\":\"ozawqxn\",\"paymentType\":\"vagug\"},{\"amount\":{\"currency\":\"wtf\",\"value\":99.369},\"date\":\"2021-01-29T12:58:16Z\",\"paymentMethodId\":\"plhaljomgzo\",\"paymentMethodFamily\":\"CreditCard\",\"paymentMethodType\":\"aptvbjeny\",\"paymentType\":\"ebrsnvofuyzvbplo\"}],\"purchaseOrderNumber\":\"ccgh\",\"rebillDetails\":{\"invoiceDocumentId\":\"mmadkbxuip\",\"creditNoteDocumentId\":\"awxugpubeqk\",\"rebillDetails\":{\"invoiceDocumentId\":\"muzgue\",\"creditNoteDocumentId\":\"gpbhauhejmswe\",\"rebillDetails\":{\"invoiceDocumentId\":\"xxzxwrnqwdjvlw\",\"creditNoteDocumentId\":\"xyylwsfx\",\"rebillDetails\":{}}}},\"status\":\"Other\",\"subscriptionDisplayName\":\"ez\",\"subscriptionId\":\"bciuagakmxgww\",\"specialTaxationType\":\"InvoiceLevel\",\"subTotal\":{\"currency\":\"pfjguzsyfwamhmeo\",\"value\":77.05232},\"taxAmount\":{\"currency\":\"gwnompvy\",\"value\":29.633743},\"totalAmount\":{\"currency\":\"cuf\",\"value\":16.009695},\"refundDetails\":{\"requestedOn\":\"2021-11-24T22:20:13Z\",\"approvedOn\":\"2021-06-26T12:55:29Z\",\"completedOn\":\"2021-12-06T00:27:57Z\",\"amountRequested\":{\"currency\":\"fzmhkridip\",\"value\":39.789444},\"amountRefunded\":{\"currency\":\"nmpifj\",\"value\":12.862497},\"rebillInvoiceId\":\"nbdup\",\"transactionCount\":449978991,\"refundStatus\":\"Completed\",\"refundOperationId\":\"adjffllrsfghyye\",\"refundReason\":\"ForgotToCancel\"}},\"tags\":{\"lsnflc\":\"uddcc\",\"k\":\"xpmny\",\"ojgdqjhzf\":\"gslkokqaqgz\",\"gbvsqksrgkvga\":\"cjgpjnydk\"},\"id\":\"rhrqqiwfysujc\",\"name\":\"hclgpexrxyrpwzsm\",\"type\":\"gebpskbpci\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.invoices() - .listByBillingProfile("psotbame", "rbusnaq", null, null, "vruuhyncppmmwh", "erlurgipvnbxle", - 3167452011929464761L, 74046801177795225L, false, "pxdxgcqmguvd", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("uddcc", response.iterator().next().tags().get("lsnflc")); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesListByBillingSubscriptionMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesListByBillingSubscriptionMockTests.java deleted file mode 100644 index ce6a37cede2a..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/InvoicesListByBillingSubscriptionMockTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.Invoice; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class InvoicesListByBillingSubscriptionMockTests { - @Test - public void testListByBillingSubscription() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"amountDue\":{\"currency\":\"wvkuhtdxdcodzdh\",\"value\":72.48501},\"azurePrepaymentApplied\":{\"currency\":\"vmxiundifuahtk\",\"value\":7.5689135},\"billedAmount\":{\"currency\":\"srz\",\"value\":37.18018},\"billedDocumentId\":\"odyafayxnlv\",\"billingProfileDisplayName\":\"p\",\"billingProfileId\":\"awsl\",\"creditAmount\":{\"currency\":\"lbxnnynjt\",\"value\":87.91529},\"creditForDocumentId\":\"pel\",\"documents\":[{\"documentNumbers\":[\"vdbn\"],\"externalUrl\":\"rc\",\"kind\":\"TaxReceipt\",\"name\":\"xliqcbonqjoekcjc\",\"url\":\"vobctit\",\"source\":\"ENF\"},{\"documentNumbers\":[\"lvkfdqilprqhxfq\",\"qp\"],\"externalUrl\":\"rqlazfjltckbjvd\",\"kind\":\"TaxReceipt\",\"name\":\"vqtdex\",\"url\":\"zpxalkqlvbkz\",\"source\":\"Other\"},{\"documentNumbers\":[\"ww\",\"iviniyoizuwwzc\",\"igbjbelnqalbso\",\"xajsiueai\"],\"externalUrl\":\"jbizbwxuypcu\",\"kind\":\"Invoice\",\"name\":\"lxtclveqdqt\",\"url\":\"hwlwj\",\"source\":\"Other\"},{\"documentNumbers\":[\"ysghhcmqdlkkw\",\"dekbvdulmkaadnxb\"],\"externalUrl\":\"atpialrqhwcxxccf\",\"kind\":\"Summary\",\"name\":\"za\",\"url\":\"vrexitpzri\",\"source\":\"Other\"}],\"documentType\":\"Invoice\",\"dueDate\":\"2021-08-22T21:13:55Z\",\"failedPayments\":[{\"date\":\"2021-09-23T05:02:16Z\",\"failedPaymentReason\":\"BankDeclined\"},{\"date\":\"2021-09-24T17:44:35Z\",\"failedPaymentReason\":\"IncorrectCardDetails\"},{\"date\":\"2021-10-31T17:34:56Z\",\"failedPaymentReason\":\"BankDeclined\"}],\"freeAzureCreditApplied\":{\"currency\":\"jkhmsobua\",\"value\":8.937472},\"invoiceDate\":\"2021-06-19T03:49:14Z\",\"invoicePeriodEndDate\":\"2021-07-27T03:25:21Z\",\"invoicePeriodStartDate\":\"2021-03-07T11:05:38Z\",\"invoiceType\":\"Other\",\"isMonthlyInvoice\":false,\"payments\":[{\"amount\":{\"currency\":\"c\",\"value\":59.074028},\"date\":\"2021-04-27T06:51:32Z\",\"paymentMethodId\":\"w\",\"paymentMethodFamily\":\"None\",\"paymentMethodType\":\"zdoysmzg\",\"paymentType\":\"gdjwuybcppdvuo\"}],\"purchaseOrderNumber\":\"vk\",\"rebillDetails\":{\"invoiceDocumentId\":\"kupbnkcw\",\"creditNoteDocumentId\":\"ylkbdskrpyfrtl\",\"rebillDetails\":{\"invoiceDocumentId\":\"fqzylem\",\"creditNoteDocumentId\":\"hyuxxeike\",\"rebillDetails\":{\"invoiceDocumentId\":\"wrnh\",\"creditNoteDocumentId\":\"fuvvy\",\"rebillDetails\":{}}}},\"status\":\"Due\",\"subscriptionDisplayName\":\"xgfmesxjeqqfynv\",\"subscriptionId\":\"xtan\",\"specialTaxationType\":\"InvoiceLevel\",\"subTotal\":{\"currency\":\"vzhdncqcuwt\",\"value\":44.25586},\"taxAmount\":{\"currency\":\"lnolspvxpi\",\"value\":16.192787},\"totalAmount\":{\"currency\":\"dvatptzkmfvdrkcw\",\"value\":68.58224},\"refundDetails\":{\"requestedOn\":\"2021-12-03T07:08:10Z\",\"approvedOn\":\"2021-03-27T19:08:29Z\",\"completedOn\":\"2021-12-10T13:36:44Z\",\"amountRequested\":{\"currency\":\"dfrzzxirxxkmozkd\",\"value\":20.382553},\"amountRefunded\":{\"currency\":\"kivvpyznjwmd\",\"value\":94.45917},\"rebillInvoiceId\":\"yjbzzws\",\"transactionCount\":952579976,\"refundStatus\":\"Declined\",\"refundOperationId\":\"tvofgx\",\"refundReason\":\"UnclearDocumentation\"}},\"tags\":{\"kubwkdi\":\"csoaxcmepkpxtbxy\",\"wetwwjv\":\"slnbyi\",\"ityantecv\":\"ycygcvgebf\",\"eciexsc\":\"tkgopdjqnsicucq\"},\"id\":\"zhjjlypwgwbycfam\",\"name\":\"ikisppygothi\",\"type\":\"irhhbogxw\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.invoices() - .listByBillingSubscription(null, null, "nrwffzzmxqyjys", "jpy", 3355744504373660268L, 59397306426461440L, - false, "kzmsyezxifjuvhuo", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("csoaxcmepkpxtbxy", response.iterator().next().tags().get("kubwkdi")); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/MoveBillingSubscriptionRequestTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/MoveBillingSubscriptionRequestTests.java deleted file mode 100644 index feed80902592..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/MoveBillingSubscriptionRequestTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.MoveBillingSubscriptionRequest; -import org.junit.jupiter.api.Assertions; - -public final class MoveBillingSubscriptionRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MoveBillingSubscriptionRequest model = BinaryData.fromString( - "{\"destinationInvoiceSectionId\":\"rldefxrdcox\",\"destinationEnrollmentAccountId\":\"kkjanurnnqbnqbp\"}") - .toObject(MoveBillingSubscriptionRequest.class); - Assertions.assertEquals("rldefxrdcox", model.destinationInvoiceSectionId()); - Assertions.assertEquals("kkjanurnnqbnqbp", model.destinationEnrollmentAccountId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MoveBillingSubscriptionRequest model - = new MoveBillingSubscriptionRequest().withDestinationInvoiceSectionId("rldefxrdcox") - .withDestinationEnrollmentAccountId("kkjanurnnqbnqbp"); - model = BinaryData.fromObject(model).toObject(MoveBillingSubscriptionRequest.class); - Assertions.assertEquals("rldefxrdcox", model.destinationInvoiceSectionId()); - Assertions.assertEquals("kkjanurnnqbnqbp", model.destinationEnrollmentAccountId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/MoveProductRequestTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/MoveProductRequestTests.java deleted file mode 100644 index 6237b583ecd1..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/MoveProductRequestTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.MoveProductRequest; -import org.junit.jupiter.api.Assertions; - -public final class MoveProductRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - MoveProductRequest model = BinaryData.fromString("{\"destinationInvoiceSectionId\":\"snuudtelvhyibdr\"}") - .toObject(MoveProductRequest.class); - Assertions.assertEquals("snuudtelvhyibdr", model.destinationInvoiceSectionId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - MoveProductRequest model = new MoveProductRequest().withDestinationInvoiceSectionId("snuudtelvhyibdr"); - model = BinaryData.fromObject(model).toObject(MoveProductRequest.class); - Assertions.assertEquals("snuudtelvhyibdr", model.destinationInvoiceSectionId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/NextBillingCycleDetailsTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/NextBillingCycleDetailsTests.java deleted file mode 100644 index a2654da43b91..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/NextBillingCycleDetailsTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.NextBillingCycleDetails; - -public final class NextBillingCycleDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - NextBillingCycleDetails model - = BinaryData.fromString("{\"billingFrequency\":\"k\"}").toObject(NextBillingCycleDetails.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - NextBillingCycleDetails model = new NextBillingCycleDetails(); - model = BinaryData.fromObject(model).toObject(NextBillingCycleDetails.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/OperationDisplayTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/OperationDisplayTests.java deleted file mode 100644 index b990e4c3eb53..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/OperationDisplayTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.OperationDisplay; - -public final class OperationDisplayTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationDisplay model = BinaryData.fromString( - "{\"description\":\"nhj\",\"operation\":\"dyznfajsvks\",\"provider\":\"qozzkivyhjrliizj\",\"resource\":\"lqfhefkwabs\"}") - .toObject(OperationDisplay.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationDisplay model = new OperationDisplay(); - model = BinaryData.fromObject(model).toObject(OperationDisplay.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/OperationInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/OperationInnerTests.java deleted file mode 100644 index bdbb626ef550..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/OperationInnerTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.OperationInner; -import com.azure.resourcemanager.billing.models.OperationDisplay; - -public final class OperationInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationInner model = BinaryData.fromString( - "{\"name\":\"yvp\",\"isDataAction\":false,\"display\":{\"description\":\"pnqn\",\"operation\":\"w\",\"provider\":\"edenrexkxbhxv\",\"resource\":\"nul\"}}") - .toObject(OperationInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationInner model = new OperationInner().withDisplay(new OperationDisplay()); - model = BinaryData.fromObject(model).toObject(OperationInner.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/OperationListResultTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/OperationListResultTests.java deleted file mode 100644 index f10927003463..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/OperationListResultTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.OperationListResult; - -public final class OperationListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - OperationListResult model = BinaryData.fromString( - "{\"nextLink\":\"hdjzqdcadwvpsoz\",\"value\":[{\"name\":\"jriyb\",\"isDataAction\":false,\"display\":{\"description\":\"pnx\",\"operation\":\"v\",\"provider\":\"jkgv\",\"resource\":\"mxaursqftibtyi\"}}]}") - .toObject(OperationListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - OperationListResult model = new OperationListResult(); - model = BinaryData.fromObject(model).toObject(OperationListResult.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/OperationsListMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/OperationsListMockTests.java deleted file mode 100644 index f0b8ceec895e..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/OperationsListMockTests.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.Operation; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class OperationsListMockTests { - @Test - public void testList() throws Exception { - String responseStr - = "{\"value\":[{\"name\":\"gtejtyx\",\"isDataAction\":true,\"display\":{\"description\":\"kjrqdt\",\"operation\":\"caoc\",\"provider\":\"uxqnkicwmr\",\"resource\":\"iynjcvewlrjrnakt\"}}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ParticipantTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ParticipantTests.java deleted file mode 100644 index 1c946350936e..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ParticipantTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.Participant; - -public final class ParticipantTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Participant model = BinaryData - .fromString("{\"email\":\"odepoogin\",\"status\":\"amiheognarxz\",\"statusDate\":\"2021-07-04T09:54:35Z\"}") - .toObject(Participant.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Participant model = new Participant(); - model = BinaryData.fromObject(model).toObject(Participant.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PartnerInitiateTransferPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PartnerInitiateTransferPropertiesTests.java deleted file mode 100644 index 971a7878e5a3..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PartnerInitiateTransferPropertiesTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.PartnerInitiateTransferProperties; -import org.junit.jupiter.api.Assertions; - -public final class PartnerInitiateTransferPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PartnerInitiateTransferProperties model - = BinaryData.fromString("{\"recipientEmailId\":\"xvl\",\"resellerId\":\"rgkrfi\"}") - .toObject(PartnerInitiateTransferProperties.class); - Assertions.assertEquals("xvl", model.recipientEmailId()); - Assertions.assertEquals("rgkrfi", model.resellerId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PartnerInitiateTransferProperties model - = new PartnerInitiateTransferProperties().withRecipientEmailId("xvl").withResellerId("rgkrfi"); - model = BinaryData.fromObject(model).toObject(PartnerInitiateTransferProperties.class); - Assertions.assertEquals("xvl", model.recipientEmailId()); - Assertions.assertEquals("rgkrfi", model.resellerId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PartnerInitiateTransferRequestTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PartnerInitiateTransferRequestTests.java deleted file mode 100644 index ba2788ec2835..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PartnerInitiateTransferRequestTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.PartnerInitiateTransferRequest; -import org.junit.jupiter.api.Assertions; - -public final class PartnerInitiateTransferRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PartnerInitiateTransferRequest model = BinaryData - .fromString("{\"properties\":{\"recipientEmailId\":\"jjmztnlmsoodtmv\",\"resellerId\":\"dhdyswcrptveaj\"}}") - .toObject(PartnerInitiateTransferRequest.class); - Assertions.assertEquals("jjmztnlmsoodtmv", model.recipientEmailId()); - Assertions.assertEquals("dhdyswcrptveaj", model.resellerId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PartnerInitiateTransferRequest model - = new PartnerInitiateTransferRequest().withRecipientEmailId("jjmztnlmsoodtmv") - .withResellerId("dhdyswcrptveaj"); - model = BinaryData.fromObject(model).toObject(PartnerInitiateTransferRequest.class); - Assertions.assertEquals("jjmztnlmsoodtmv", model.recipientEmailId()); - Assertions.assertEquals("dhdyswcrptveaj", model.resellerId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PartnerTransferDetailsListResultTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PartnerTransferDetailsListResultTests.java deleted file mode 100644 index 1229a10a7be5..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PartnerTransferDetailsListResultTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.PartnerTransferDetailsListResult; - -public final class PartnerTransferDetailsListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PartnerTransferDetailsListResult model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"expirationTime\":\"2021-02-15T16:08:24Z\",\"transferStatus\":\"Declined\",\"recipientEmailId\":\"uqhrlmcskykp\",\"initiatorCustomerType\":\"Partner\",\"initiatorEmailId\":\"ixcnpcf\",\"resellerId\":\"kpyyc\",\"resellerName\":\"wmpjprd\",\"canceledBy\":\"rpcfpcfjfwzl\",\"detailedTransferStatus\":[{\"productType\":\"AzureSubscription\",\"productId\":\"yep\",\"productName\":\"amnni\",\"skuDescription\":\"diawpzxkzr\",\"transferStatus\":\"InProgress\",\"errorDetails\":{}},{\"productType\":\"SavingsPlan\",\"productId\":\"huosgwqpsqaz\",\"productName\":\"qodvqgcnbhcbmj\",\"skuDescription\":\"ti\",\"transferStatus\":\"NotStarted\",\"errorDetails\":{}}]},\"tags\":{\"jrhskbwgmjgrul\":\"sxjmfmeftvhkmoo\",\"tpfdzxcouzfwofwa\":\"fogxhcxnw\",\"dtzxsoe\":\"ukz\",\"isnionetbzdrdpue\":\"nlwglihezomucmq\"},\"id\":\"kgtlzl\",\"name\":\"trlxcznnhzkbn\",\"type\":\"mxlxmwtygeq\"},{\"properties\":{\"expirationTime\":\"2021-08-05T00:42:02Z\",\"transferStatus\":\"InProgress\",\"recipientEmailId\":\"cahfsgbjmlreesr\",\"initiatorCustomerType\":\"Partner\",\"initiatorEmailId\":\"zvlcwlisolntfxxc\",\"resellerId\":\"mipfjw\",\"resellerName\":\"ygizmshxx\",\"canceledBy\":\"iz\",\"detailedTransferStatus\":[{\"productType\":\"AzureSubscription\",\"productId\":\"gsk\",\"productName\":\"o\",\"skuDescription\":\"dzjs\",\"transferStatus\":\"Completed\",\"errorDetails\":{}},{\"productType\":\"Department\",\"productId\":\"qmqipaydhfnzoc\",\"productName\":\"tfshksnyzm\",\"skuDescription\":\"amwbwmbnlslcef\",\"transferStatus\":\"NotStarted\",\"errorDetails\":{}}]},\"tags\":{\"lpfliwoyn\":\"tkvi\",\"ladpcmhjha\":\"uuzhw\"},\"id\":\"ybkekym\",\"name\":\"fztsi\",\"type\":\"sc\"},{\"properties\":{\"expirationTime\":\"2021-11-19T13:37:44Z\",\"transferStatus\":\"CompletedWithErrors\",\"recipientEmailId\":\"hfym\",\"initiatorCustomerType\":\"EA\",\"initiatorEmailId\":\"h\",\"resellerId\":\"seuugcig\",\"resellerName\":\"ogsmgbvmtd\",\"canceledBy\":\"qbe\",\"detailedTransferStatus\":[{\"productType\":\"Department\",\"productId\":\"glab\",\"productName\":\"kbiwznhtfgfic\",\"skuDescription\":\"yhizpaczmu\",\"transferStatus\":\"Failed\",\"errorDetails\":{}},{\"productType\":\"Department\",\"productId\":\"hokhoitwhrjsdmm\",\"productName\":\"dnckidbjpglhz\",\"skuDescription\":\"xzbawkikc\",\"transferStatus\":\"Failed\",\"errorDetails\":{}}]},\"tags\":{\"jey\":\"sd\",\"cfiwhagxsurejq\":\"qxded\",\"g\":\"shzz\",\"xiqqzjkoxdupna\":\"ll\"},\"id\":\"lrouigdmfiv\",\"name\":\"qterdqq\",\"type\":\"gd\"}],\"nextLink\":\"kghpcv\"}") - .toObject(PartnerTransferDetailsListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PartnerTransferDetailsListResult model = new PartnerTransferDetailsListResult(); - model = BinaryData.fromObject(model).toObject(PartnerTransferDetailsListResult.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PatchModelTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PatchModelTests.java deleted file mode 100644 index a4e860e79138..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PatchModelTests.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.AppliedScopeType; -import com.azure.resourcemanager.billing.models.InstanceFlexibility; -import com.azure.resourcemanager.billing.models.PatchModel; -import com.azure.resourcemanager.billing.models.ReservationAppliedScopeProperties; -import com.azure.resourcemanager.billing.models.ReservationBillingPlan; -import com.azure.resourcemanager.billing.models.ReservationPurchaseRequest; -import com.azure.resourcemanager.billing.models.ReservationSkuProperty; -import com.azure.resourcemanager.billing.models.SkuName; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class PatchModelTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PatchModel model = BinaryData.fromString( - "{\"properties\":{\"appliedScopeType\":\"ManagementGroup\",\"appliedScopeProperties\":{\"tenantId\":\"tesubzpvp\",\"managementGroupId\":\"ylytcovqseusr\",\"subscriptionId\":\"bdxzfxnxmlbmu\",\"resourceGroupId\":\"wkjmdihd\",\"displayName\":\"yyzlwhbwzjnu\"},\"instanceFlexibility\":\"Off\",\"displayName\":\"gmdq\",\"renew\":false,\"renewProperties\":{\"purchaseProperties\":{\"sku\":{\"name\":\"ftedzuubjtvgjsx\"},\"location\":\"yj\",\"properties\":{\"reservedResourceType\":\"vdpwwobtdphti\",\"billingScopeId\":\"ffofwan\",\"term\":\"k\",\"billingPlan\":\"Monthly\",\"quantity\":187296293,\"displayName\":\"zcgwdfriw\",\"appliedScopeType\":\"Single\",\"appliedScopes\":[\"ozokscvglli\"],\"appliedScopeProperties\":{\"tenantId\":\"byfg\",\"managementGroupId\":\"wqkjvx\",\"subscriptionId\":\"wpxsoo\",\"resourceGroupId\":\"txlcsk\",\"displayName\":\"e\"},\"renew\":true,\"reservedResourceProperties\":{\"instanceFlexibility\":\"On\"},\"instanceFlexibility\":\"On\",\"reviewDateTime\":\"2021-09-19T08:34:05Z\"}}},\"reviewDateTime\":\"2021-10-03T18:15:14Z\"},\"sku\":{\"name\":\"gubsrtmdylpe\"},\"tags\":{\"cmfpfbodet\":\"lttjzgcz\",\"muqkevzgjypanhx\":\"esrgvtshuvftwai\",\"wot\":\"pdxxzetwwz\",\"fhglhrfo\":\"xl\"}}") - .toObject(PatchModel.class); - Assertions.assertEquals("lttjzgcz", model.tags().get("cmfpfbodet")); - Assertions.assertEquals(AppliedScopeType.MANAGEMENT_GROUP, model.appliedScopeType()); - Assertions.assertEquals("tesubzpvp", model.appliedScopeProperties().tenantId()); - Assertions.assertEquals("ylytcovqseusr", model.appliedScopeProperties().managementGroupId()); - Assertions.assertEquals("bdxzfxnxmlbmu", model.appliedScopeProperties().subscriptionId()); - Assertions.assertEquals("wkjmdihd", model.appliedScopeProperties().resourceGroupId()); - Assertions.assertEquals("yyzlwhbwzjnu", model.appliedScopeProperties().displayName()); - Assertions.assertEquals(InstanceFlexibility.OFF, model.instanceFlexibility()); - Assertions.assertEquals("gmdq", model.displayName()); - Assertions.assertEquals(false, model.renew()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-03T18:15:14Z"), model.reviewDateTime()); - Assertions.assertEquals("ftedzuubjtvgjsx", model.purchaseProperties().sku().name()); - Assertions.assertEquals("yj", model.purchaseProperties().location()); - Assertions.assertEquals(ReservationBillingPlan.MONTHLY, model.purchaseProperties().billingPlan()); - Assertions.assertEquals(187296293, model.purchaseProperties().quantity()); - Assertions.assertEquals("zcgwdfriw", model.purchaseProperties().displayName()); - Assertions.assertEquals(AppliedScopeType.SINGLE, model.purchaseProperties().appliedScopeType()); - Assertions.assertEquals("ozokscvglli", model.purchaseProperties().appliedScopes().get(0)); - Assertions.assertEquals("byfg", model.purchaseProperties().appliedScopeProperties().tenantId()); - Assertions.assertEquals("wqkjvx", model.purchaseProperties().appliedScopeProperties().managementGroupId()); - Assertions.assertEquals("wpxsoo", model.purchaseProperties().appliedScopeProperties().subscriptionId()); - Assertions.assertEquals("txlcsk", model.purchaseProperties().appliedScopeProperties().resourceGroupId()); - Assertions.assertEquals("e", model.purchaseProperties().appliedScopeProperties().displayName()); - Assertions.assertEquals(true, model.purchaseProperties().renew()); - Assertions.assertEquals(InstanceFlexibility.ON, model.purchaseProperties().instanceFlexibility()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-19T08:34:05Z"), - model.purchaseProperties().reviewDateTime()); - Assertions.assertEquals(InstanceFlexibility.ON, - model.purchaseProperties().instanceFlexibilityReservedResourcePropertiesInstanceFlexibility()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PatchModel model = new PatchModel().withSku(new ReservationSkuProperty()) - .withTags(mapOf("cmfpfbodet", "lttjzgcz", "muqkevzgjypanhx", "esrgvtshuvftwai", "wot", "pdxxzetwwz", - "fhglhrfo", "xl")) - .withAppliedScopeType(AppliedScopeType.MANAGEMENT_GROUP) - .withAppliedScopeProperties(new ReservationAppliedScopeProperties().withTenantId("tesubzpvp") - .withManagementGroupId("ylytcovqseusr") - .withSubscriptionId("bdxzfxnxmlbmu") - .withResourceGroupId("wkjmdihd") - .withDisplayName("yyzlwhbwzjnu")) - .withInstanceFlexibility(InstanceFlexibility.OFF) - .withDisplayName("gmdq") - .withRenew(false) - .withReviewDateTime(OffsetDateTime.parse("2021-10-03T18:15:14Z")) - .withPurchaseProperties(new ReservationPurchaseRequest().withSku(new SkuName().withName("ftedzuubjtvgjsx")) - .withLocation("yj") - .withBillingPlan(ReservationBillingPlan.MONTHLY) - .withQuantity(187296293) - .withDisplayName("zcgwdfriw") - .withAppliedScopeType(AppliedScopeType.SINGLE) - .withAppliedScopes(Arrays.asList("ozokscvglli")) - .withAppliedScopeProperties(new ReservationAppliedScopeProperties().withTenantId("byfg") - .withManagementGroupId("wqkjvx") - .withSubscriptionId("wpxsoo") - .withResourceGroupId("txlcsk") - .withDisplayName("e")) - .withRenew(true) - .withInstanceFlexibility(InstanceFlexibility.ON) - .withReviewDateTime(OffsetDateTime.parse("2021-09-19T08:34:05Z")) - .withInstanceFlexibilityReservedResourcePropertiesInstanceFlexibility(InstanceFlexibility.ON)); - model = BinaryData.fromObject(model).toObject(PatchModel.class); - Assertions.assertEquals("lttjzgcz", model.tags().get("cmfpfbodet")); - Assertions.assertEquals(AppliedScopeType.MANAGEMENT_GROUP, model.appliedScopeType()); - Assertions.assertEquals("tesubzpvp", model.appliedScopeProperties().tenantId()); - Assertions.assertEquals("ylytcovqseusr", model.appliedScopeProperties().managementGroupId()); - Assertions.assertEquals("bdxzfxnxmlbmu", model.appliedScopeProperties().subscriptionId()); - Assertions.assertEquals("wkjmdihd", model.appliedScopeProperties().resourceGroupId()); - Assertions.assertEquals("yyzlwhbwzjnu", model.appliedScopeProperties().displayName()); - Assertions.assertEquals(InstanceFlexibility.OFF, model.instanceFlexibility()); - Assertions.assertEquals("gmdq", model.displayName()); - Assertions.assertEquals(false, model.renew()); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-03T18:15:14Z"), model.reviewDateTime()); - Assertions.assertEquals("ftedzuubjtvgjsx", model.purchaseProperties().sku().name()); - Assertions.assertEquals("yj", model.purchaseProperties().location()); - Assertions.assertEquals(ReservationBillingPlan.MONTHLY, model.purchaseProperties().billingPlan()); - Assertions.assertEquals(187296293, model.purchaseProperties().quantity()); - Assertions.assertEquals("zcgwdfriw", model.purchaseProperties().displayName()); - Assertions.assertEquals(AppliedScopeType.SINGLE, model.purchaseProperties().appliedScopeType()); - Assertions.assertEquals("ozokscvglli", model.purchaseProperties().appliedScopes().get(0)); - Assertions.assertEquals("byfg", model.purchaseProperties().appliedScopeProperties().tenantId()); - Assertions.assertEquals("wqkjvx", model.purchaseProperties().appliedScopeProperties().managementGroupId()); - Assertions.assertEquals("wpxsoo", model.purchaseProperties().appliedScopeProperties().subscriptionId()); - Assertions.assertEquals("txlcsk", model.purchaseProperties().appliedScopeProperties().resourceGroupId()); - Assertions.assertEquals("e", model.purchaseProperties().appliedScopeProperties().displayName()); - Assertions.assertEquals(true, model.purchaseProperties().renew()); - Assertions.assertEquals(InstanceFlexibility.ON, model.purchaseProperties().instanceFlexibility()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-19T08:34:05Z"), - model.purchaseProperties().reviewDateTime()); - Assertions.assertEquals(InstanceFlexibility.ON, - model.purchaseProperties().instanceFlexibilityReservedResourcePropertiesInstanceFlexibility()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PatchPropertiesRenewPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PatchPropertiesRenewPropertiesTests.java deleted file mode 100644 index 5cac2c4ecddb..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PatchPropertiesRenewPropertiesTests.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.PatchPropertiesRenewProperties; -import com.azure.resourcemanager.billing.models.AppliedScopeType; -import com.azure.resourcemanager.billing.models.InstanceFlexibility; -import com.azure.resourcemanager.billing.models.ReservationAppliedScopeProperties; -import com.azure.resourcemanager.billing.models.ReservationBillingPlan; -import com.azure.resourcemanager.billing.models.ReservationPurchaseRequest; -import com.azure.resourcemanager.billing.models.SkuName; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class PatchPropertiesRenewPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PatchPropertiesRenewProperties model = BinaryData.fromString( - "{\"purchaseProperties\":{\"sku\":{\"name\":\"dtsdfjy\"},\"location\":\"socwiqbuout\",\"properties\":{\"reservedResourceType\":\"zgleofjsbg\",\"billingScopeId\":\"wzvdajfwnncfm\",\"term\":\"iqgjjrlhiql\",\"billingPlan\":\"Monthly\",\"quantity\":354836266,\"displayName\":\"ougu\",\"appliedScopeType\":\"ManagementGroup\",\"appliedScopes\":[\"pg\",\"ttbas\"],\"appliedScopeProperties\":{\"tenantId\":\"ap\",\"managementGroupId\":\"n\",\"subscriptionId\":\"eaqbkixv\",\"resourceGroupId\":\"wy\",\"displayName\":\"bb\"},\"renew\":false,\"reservedResourceProperties\":{\"instanceFlexibility\":\"Off\"},\"instanceFlexibility\":\"Off\",\"reviewDateTime\":\"2021-07-09T19:26:55Z\"}}}") - .toObject(PatchPropertiesRenewProperties.class); - Assertions.assertEquals("dtsdfjy", model.purchaseProperties().sku().name()); - Assertions.assertEquals("socwiqbuout", model.purchaseProperties().location()); - Assertions.assertEquals(ReservationBillingPlan.MONTHLY, model.purchaseProperties().billingPlan()); - Assertions.assertEquals(354836266, model.purchaseProperties().quantity()); - Assertions.assertEquals("ougu", model.purchaseProperties().displayName()); - Assertions.assertEquals(AppliedScopeType.MANAGEMENT_GROUP, model.purchaseProperties().appliedScopeType()); - Assertions.assertEquals("pg", model.purchaseProperties().appliedScopes().get(0)); - Assertions.assertEquals("ap", model.purchaseProperties().appliedScopeProperties().tenantId()); - Assertions.assertEquals("n", model.purchaseProperties().appliedScopeProperties().managementGroupId()); - Assertions.assertEquals("eaqbkixv", model.purchaseProperties().appliedScopeProperties().subscriptionId()); - Assertions.assertEquals("wy", model.purchaseProperties().appliedScopeProperties().resourceGroupId()); - Assertions.assertEquals("bb", model.purchaseProperties().appliedScopeProperties().displayName()); - Assertions.assertEquals(false, model.purchaseProperties().renew()); - Assertions.assertEquals(InstanceFlexibility.OFF, model.purchaseProperties().instanceFlexibility()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-09T19:26:55Z"), - model.purchaseProperties().reviewDateTime()); - Assertions.assertEquals(InstanceFlexibility.OFF, - model.purchaseProperties().instanceFlexibilityReservedResourcePropertiesInstanceFlexibility()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PatchPropertiesRenewProperties model = new PatchPropertiesRenewProperties() - .withPurchaseProperties(new ReservationPurchaseRequest().withSku(new SkuName().withName("dtsdfjy")) - .withLocation("socwiqbuout") - .withBillingPlan(ReservationBillingPlan.MONTHLY) - .withQuantity(354836266) - .withDisplayName("ougu") - .withAppliedScopeType(AppliedScopeType.MANAGEMENT_GROUP) - .withAppliedScopes(Arrays.asList("pg", "ttbas")) - .withAppliedScopeProperties(new ReservationAppliedScopeProperties().withTenantId("ap") - .withManagementGroupId("n") - .withSubscriptionId("eaqbkixv") - .withResourceGroupId("wy") - .withDisplayName("bb")) - .withRenew(false) - .withInstanceFlexibility(InstanceFlexibility.OFF) - .withReviewDateTime(OffsetDateTime.parse("2021-07-09T19:26:55Z")) - .withInstanceFlexibilityReservedResourcePropertiesInstanceFlexibility(InstanceFlexibility.OFF)); - model = BinaryData.fromObject(model).toObject(PatchPropertiesRenewProperties.class); - Assertions.assertEquals("dtsdfjy", model.purchaseProperties().sku().name()); - Assertions.assertEquals("socwiqbuout", model.purchaseProperties().location()); - Assertions.assertEquals(ReservationBillingPlan.MONTHLY, model.purchaseProperties().billingPlan()); - Assertions.assertEquals(354836266, model.purchaseProperties().quantity()); - Assertions.assertEquals("ougu", model.purchaseProperties().displayName()); - Assertions.assertEquals(AppliedScopeType.MANAGEMENT_GROUP, model.purchaseProperties().appliedScopeType()); - Assertions.assertEquals("pg", model.purchaseProperties().appliedScopes().get(0)); - Assertions.assertEquals("ap", model.purchaseProperties().appliedScopeProperties().tenantId()); - Assertions.assertEquals("n", model.purchaseProperties().appliedScopeProperties().managementGroupId()); - Assertions.assertEquals("eaqbkixv", model.purchaseProperties().appliedScopeProperties().subscriptionId()); - Assertions.assertEquals("wy", model.purchaseProperties().appliedScopeProperties().resourceGroupId()); - Assertions.assertEquals("bb", model.purchaseProperties().appliedScopeProperties().displayName()); - Assertions.assertEquals(false, model.purchaseProperties().renew()); - Assertions.assertEquals(InstanceFlexibility.OFF, model.purchaseProperties().instanceFlexibility()); - Assertions.assertEquals(OffsetDateTime.parse("2021-07-09T19:26:55Z"), - model.purchaseProperties().reviewDateTime()); - Assertions.assertEquals(InstanceFlexibility.OFF, - model.purchaseProperties().instanceFlexibilityReservedResourcePropertiesInstanceFlexibility()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PatchPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PatchPropertiesTests.java deleted file mode 100644 index 8a76b05bb5f2..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PatchPropertiesTests.java +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.PatchProperties; -import com.azure.resourcemanager.billing.models.AppliedScopeType; -import com.azure.resourcemanager.billing.models.InstanceFlexibility; -import com.azure.resourcemanager.billing.models.ReservationAppliedScopeProperties; -import com.azure.resourcemanager.billing.models.ReservationBillingPlan; -import com.azure.resourcemanager.billing.models.ReservationPurchaseRequest; -import com.azure.resourcemanager.billing.models.SkuName; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class PatchPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PatchProperties model = BinaryData.fromString( - "{\"appliedScopeType\":\"Shared\",\"appliedScopeProperties\":{\"tenantId\":\"rsnhpcs\",\"managementGroupId\":\"qxovppqibukk\",\"subscriptionId\":\"zrlrmlccmetjs\",\"resourceGroupId\":\"ivfqbqnasdsy\",\"displayName\":\"zsieuscplhyvd\"},\"instanceFlexibility\":\"Off\",\"displayName\":\"zkxitd\",\"renew\":true,\"renewProperties\":{\"purchaseProperties\":{\"sku\":{\"name\":\"olrupjovm\"},\"location\":\"sayebra\",\"properties\":{\"reservedResourceType\":\"lpzbtzuykykipf\",\"billingScopeId\":\"yepfn\",\"term\":\"mbezacfpztg\",\"billingPlan\":\"Monthly\",\"quantity\":903703732,\"displayName\":\"jga\",\"appliedScopeType\":\"Single\",\"appliedScopes\":[\"gkppgkqzkcyzmf\",\"ngdyfcixrhlcq\",\"hoe\",\"goiutgw\"],\"appliedScopeProperties\":{\"tenantId\":\"a\",\"managementGroupId\":\"qha\",\"subscriptionId\":\"ntacih\",\"resourceGroupId\":\"ogmipnmliqmvl\",\"displayName\":\"i\"},\"renew\":false,\"reservedResourceProperties\":{\"instanceFlexibility\":\"Off\"},\"instanceFlexibility\":\"On\",\"reviewDateTime\":\"2021-02-19T08:53:13Z\"}}},\"reviewDateTime\":\"2021-02-11T08:57:44Z\"}") - .toObject(PatchProperties.class); - Assertions.assertEquals(AppliedScopeType.SHARED, model.appliedScopeType()); - Assertions.assertEquals("rsnhpcs", model.appliedScopeProperties().tenantId()); - Assertions.assertEquals("qxovppqibukk", model.appliedScopeProperties().managementGroupId()); - Assertions.assertEquals("zrlrmlccmetjs", model.appliedScopeProperties().subscriptionId()); - Assertions.assertEquals("ivfqbqnasdsy", model.appliedScopeProperties().resourceGroupId()); - Assertions.assertEquals("zsieuscplhyvd", model.appliedScopeProperties().displayName()); - Assertions.assertEquals(InstanceFlexibility.OFF, model.instanceFlexibility()); - Assertions.assertEquals("zkxitd", model.displayName()); - Assertions.assertEquals(true, model.renew()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-11T08:57:44Z"), model.reviewDateTime()); - Assertions.assertEquals("olrupjovm", model.purchaseProperties().sku().name()); - Assertions.assertEquals("sayebra", model.purchaseProperties().location()); - Assertions.assertEquals(ReservationBillingPlan.MONTHLY, model.purchaseProperties().billingPlan()); - Assertions.assertEquals(903703732, model.purchaseProperties().quantity()); - Assertions.assertEquals("jga", model.purchaseProperties().displayName()); - Assertions.assertEquals(AppliedScopeType.SINGLE, model.purchaseProperties().appliedScopeType()); - Assertions.assertEquals("gkppgkqzkcyzmf", model.purchaseProperties().appliedScopes().get(0)); - Assertions.assertEquals("a", model.purchaseProperties().appliedScopeProperties().tenantId()); - Assertions.assertEquals("qha", model.purchaseProperties().appliedScopeProperties().managementGroupId()); - Assertions.assertEquals("ntacih", model.purchaseProperties().appliedScopeProperties().subscriptionId()); - Assertions.assertEquals("ogmipnmliqmvl", model.purchaseProperties().appliedScopeProperties().resourceGroupId()); - Assertions.assertEquals("i", model.purchaseProperties().appliedScopeProperties().displayName()); - Assertions.assertEquals(false, model.purchaseProperties().renew()); - Assertions.assertEquals(InstanceFlexibility.ON, model.purchaseProperties().instanceFlexibility()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-19T08:53:13Z"), - model.purchaseProperties().reviewDateTime()); - Assertions.assertEquals(InstanceFlexibility.OFF, - model.purchaseProperties().instanceFlexibilityReservedResourcePropertiesInstanceFlexibility()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PatchProperties model = new PatchProperties().withAppliedScopeType(AppliedScopeType.SHARED) - .withAppliedScopeProperties(new ReservationAppliedScopeProperties().withTenantId("rsnhpcs") - .withManagementGroupId("qxovppqibukk") - .withSubscriptionId("zrlrmlccmetjs") - .withResourceGroupId("ivfqbqnasdsy") - .withDisplayName("zsieuscplhyvd")) - .withInstanceFlexibility(InstanceFlexibility.OFF) - .withDisplayName("zkxitd") - .withRenew(true) - .withReviewDateTime(OffsetDateTime.parse("2021-02-11T08:57:44Z")) - .withPurchaseProperties(new ReservationPurchaseRequest().withSku(new SkuName().withName("olrupjovm")) - .withLocation("sayebra") - .withBillingPlan(ReservationBillingPlan.MONTHLY) - .withQuantity(903703732) - .withDisplayName("jga") - .withAppliedScopeType(AppliedScopeType.SINGLE) - .withAppliedScopes(Arrays.asList("gkppgkqzkcyzmf", "ngdyfcixrhlcq", "hoe", "goiutgw")) - .withAppliedScopeProperties(new ReservationAppliedScopeProperties().withTenantId("a") - .withManagementGroupId("qha") - .withSubscriptionId("ntacih") - .withResourceGroupId("ogmipnmliqmvl") - .withDisplayName("i")) - .withRenew(false) - .withInstanceFlexibility(InstanceFlexibility.ON) - .withReviewDateTime(OffsetDateTime.parse("2021-02-19T08:53:13Z")) - .withInstanceFlexibilityReservedResourcePropertiesInstanceFlexibility(InstanceFlexibility.OFF)); - model = BinaryData.fromObject(model).toObject(PatchProperties.class); - Assertions.assertEquals(AppliedScopeType.SHARED, model.appliedScopeType()); - Assertions.assertEquals("rsnhpcs", model.appliedScopeProperties().tenantId()); - Assertions.assertEquals("qxovppqibukk", model.appliedScopeProperties().managementGroupId()); - Assertions.assertEquals("zrlrmlccmetjs", model.appliedScopeProperties().subscriptionId()); - Assertions.assertEquals("ivfqbqnasdsy", model.appliedScopeProperties().resourceGroupId()); - Assertions.assertEquals("zsieuscplhyvd", model.appliedScopeProperties().displayName()); - Assertions.assertEquals(InstanceFlexibility.OFF, model.instanceFlexibility()); - Assertions.assertEquals("zkxitd", model.displayName()); - Assertions.assertEquals(true, model.renew()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-11T08:57:44Z"), model.reviewDateTime()); - Assertions.assertEquals("olrupjovm", model.purchaseProperties().sku().name()); - Assertions.assertEquals("sayebra", model.purchaseProperties().location()); - Assertions.assertEquals(ReservationBillingPlan.MONTHLY, model.purchaseProperties().billingPlan()); - Assertions.assertEquals(903703732, model.purchaseProperties().quantity()); - Assertions.assertEquals("jga", model.purchaseProperties().displayName()); - Assertions.assertEquals(AppliedScopeType.SINGLE, model.purchaseProperties().appliedScopeType()); - Assertions.assertEquals("gkppgkqzkcyzmf", model.purchaseProperties().appliedScopes().get(0)); - Assertions.assertEquals("a", model.purchaseProperties().appliedScopeProperties().tenantId()); - Assertions.assertEquals("qha", model.purchaseProperties().appliedScopeProperties().managementGroupId()); - Assertions.assertEquals("ntacih", model.purchaseProperties().appliedScopeProperties().subscriptionId()); - Assertions.assertEquals("ogmipnmliqmvl", model.purchaseProperties().appliedScopeProperties().resourceGroupId()); - Assertions.assertEquals("i", model.purchaseProperties().appliedScopeProperties().displayName()); - Assertions.assertEquals(false, model.purchaseProperties().renew()); - Assertions.assertEquals(InstanceFlexibility.ON, model.purchaseProperties().instanceFlexibility()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-19T08:53:13Z"), - model.purchaseProperties().reviewDateTime()); - Assertions.assertEquals(InstanceFlexibility.OFF, - model.purchaseProperties().instanceFlexibilityReservedResourcePropertiesInstanceFlexibility()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentAmountTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentAmountTests.java deleted file mode 100644 index c4e250d47419..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentAmountTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.PaymentAmount; - -public final class PaymentAmountTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PaymentAmount model - = BinaryData.fromString("{\"currency\":\"hqfgqkayejsx\",\"value\":82.51514}").toObject(PaymentAmount.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PaymentAmount model = new PaymentAmount(); - model = BinaryData.fromObject(model).toObject(PaymentAmount.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodInnerTests.java deleted file mode 100644 index 1f47c3dded44..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodInnerTests.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.PaymentMethodInner; -import com.azure.resourcemanager.billing.models.PaymentMethodFamily; -import com.azure.resourcemanager.billing.models.PaymentMethodLogo; -import com.azure.resourcemanager.billing.models.PaymentMethodStatus; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class PaymentMethodInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PaymentMethodInner model = BinaryData.fromString( - "{\"properties\":{\"id\":\"iymqr\",\"accountHolderName\":\"guhfupe\",\"displayName\":\"svvoqsbpkflanfk\",\"expiration\":\"syaowuzowp\",\"family\":\"Credits\",\"lastFourDigits\":\"kc\",\"logos\":[{\"mimeType\":\"kxrzt\",\"url\":\"chlutixmqru\"},{\"mimeType\":\"izcbfzmcrunfhiuc\",\"url\":\"fbcpaqktkrumzu\"},{\"mimeType\":\"kyzbfvxovqkxiux\",\"url\":\"gvqrnhyhlwcj\"},{\"mimeType\":\"ggjh\",\"url\":\"bxrqrkijp\"}],\"paymentMethodType\":\"qlsdxeqztvxwmw\",\"status\":\"active\"},\"tags\":{\"wwa\":\"en\",\"ojhtollhs\":\"ecleqioulndhzyo\"},\"id\":\"dm\",\"name\":\"tzlnglxpn\",\"type\":\"vyoanfbcswqagywv\"}") - .toObject(PaymentMethodInner.class); - Assertions.assertEquals("en", model.tags().get("wwa")); - Assertions.assertEquals(PaymentMethodFamily.CREDITS, model.family()); - Assertions.assertEquals(PaymentMethodStatus.ACTIVE, model.status()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PaymentMethodInner model = new PaymentMethodInner().withTags(mapOf("wwa", "en", "ojhtollhs", "ecleqioulndhzyo")) - .withFamily(PaymentMethodFamily.CREDITS) - .withLogos(Arrays.asList(new PaymentMethodLogo(), new PaymentMethodLogo(), new PaymentMethodLogo(), - new PaymentMethodLogo())) - .withStatus(PaymentMethodStatus.ACTIVE); - model = BinaryData.fromObject(model).toObject(PaymentMethodInner.class); - Assertions.assertEquals("en", model.tags().get("wwa")); - Assertions.assertEquals(PaymentMethodFamily.CREDITS, model.family()); - Assertions.assertEquals(PaymentMethodStatus.ACTIVE, model.status()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodLinkInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodLinkInnerTests.java deleted file mode 100644 index fb9b737146bf..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodLinkInnerTests.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.PaymentMethodLinkInner; -import com.azure.resourcemanager.billing.fluent.models.PaymentMethodProperties; -import com.azure.resourcemanager.billing.models.PaymentMethodFamily; -import com.azure.resourcemanager.billing.models.PaymentMethodLogo; -import com.azure.resourcemanager.billing.models.PaymentMethodStatus; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class PaymentMethodLinkInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PaymentMethodLinkInner model = BinaryData.fromString( - "{\"properties\":{\"accountHolderName\":\"efcpczshn\",\"displayName\":\"nda\",\"expiration\":\"upfkhuytuszxhmtv\",\"family\":\"None\",\"lastFourDigits\":\"w\",\"logos\":[{\"mimeType\":\"vzwydwtthaokgks\",\"url\":\"i\"},{\"mimeType\":\"sshajqfukpee\",\"url\":\"geumil\"},{\"mimeType\":\"uitrdexyiono\",\"url\":\"inbd\"}],\"paymentMethod\":{\"id\":\"xcwqqrsmpc\",\"accountHolderName\":\"prtug\",\"displayName\":\"bzbcyksiv\",\"expiration\":\"ogd\",\"family\":\"CheckWire\",\"lastFourDigits\":\"cmkrftsjcwjj\",\"logos\":[{\"mimeType\":\"bawvif\",\"url\":\"kecifhocjxwklo\"},{\"mimeType\":\"rvtxvcmufunlc\",\"url\":\"xvi\"},{\"mimeType\":\"eyngjg\",\"url\":\"quv\"}],\"paymentMethodType\":\"gglpmcrdcuelj\",\"status\":\"active\"},\"paymentMethodId\":\"xmfqryarvsxzqbg\",\"paymentMethodType\":\"jkayspthzo\",\"status\":\"active\"},\"tags\":{\"djxyxgbkkqvjcteo\":\"mjtgblioskkfmkm\",\"pxvjnzd\":\"dlrslskk\"},\"id\":\"o\",\"name\":\"ojhpcnabxzfsn\",\"type\":\"gyte\"}") - .toObject(PaymentMethodLinkInner.class); - Assertions.assertEquals("mjtgblioskkfmkm", model.tags().get("djxyxgbkkqvjcteo")); - Assertions.assertEquals(PaymentMethodFamily.CHECK_WIRE, model.paymentMethod().family()); - Assertions.assertEquals(PaymentMethodStatus.ACTIVE, model.paymentMethod().status()); - Assertions.assertEquals("xmfqryarvsxzqbg", model.paymentMethodId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PaymentMethodLinkInner model - = new PaymentMethodLinkInner().withTags(mapOf("djxyxgbkkqvjcteo", "mjtgblioskkfmkm", "pxvjnzd", "dlrslskk")) - .withPaymentMethod(new PaymentMethodProperties().withFamily(PaymentMethodFamily.CHECK_WIRE) - .withLogos(Arrays.asList(new PaymentMethodLogo(), new PaymentMethodLogo(), new PaymentMethodLogo())) - .withStatus(PaymentMethodStatus.ACTIVE)) - .withPaymentMethodId("xmfqryarvsxzqbg"); - model = BinaryData.fromObject(model).toObject(PaymentMethodLinkInner.class); - Assertions.assertEquals("mjtgblioskkfmkm", model.tags().get("djxyxgbkkqvjcteo")); - Assertions.assertEquals(PaymentMethodFamily.CHECK_WIRE, model.paymentMethod().family()); - Assertions.assertEquals(PaymentMethodStatus.ACTIVE, model.paymentMethod().status()); - Assertions.assertEquals("xmfqryarvsxzqbg", model.paymentMethodId()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodLinkPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodLinkPropertiesTests.java deleted file mode 100644 index 4a391241e124..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodLinkPropertiesTests.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.PaymentMethodLinkProperties; -import com.azure.resourcemanager.billing.fluent.models.PaymentMethodProperties; -import com.azure.resourcemanager.billing.models.PaymentMethodFamily; -import com.azure.resourcemanager.billing.models.PaymentMethodLogo; -import com.azure.resourcemanager.billing.models.PaymentMethodStatus; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class PaymentMethodLinkPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PaymentMethodLinkProperties model = BinaryData.fromString( - "{\"accountHolderName\":\"zilmhivzkww\",\"displayName\":\"cknrzda\",\"expiration\":\"skzptjxulweucyr\",\"family\":\"Credits\",\"lastFourDigits\":\"lehmcgcjeinueho\",\"logos\":[{\"mimeType\":\"fejvqn\",\"url\":\"mbqdabzfivfo\"},{\"mimeType\":\"ysthhza\",\"url\":\"fwy\"},{\"mimeType\":\"lhgenuzejgvkv\",\"url\":\"aqszllrzl\"},{\"mimeType\":\"mdqgmihzpimcqr\",\"url\":\"xtminklogxsvtzar\"}],\"paymentMethod\":{\"id\":\"qnsqktcmb\",\"accountHolderName\":\"zzoslpkyb\",\"displayName\":\"lwkzpgajsqjcem\",\"expiration\":\"mfuvqarwzxuqr\",\"family\":\"None\",\"lastFourDigits\":\"immbwxsfgtdm\",\"logos\":[{\"mimeType\":\"kraokq\",\"url\":\"ud\"}],\"paymentMethodType\":\"waokbavlytta\",\"status\":\"inactive\"},\"paymentMethodId\":\"frkebsmhpd\",\"paymentMethodType\":\"dig\",\"status\":\"inactive\"}") - .toObject(PaymentMethodLinkProperties.class); - Assertions.assertEquals(PaymentMethodFamily.NONE, model.paymentMethod().family()); - Assertions.assertEquals(PaymentMethodStatus.INACTIVE, model.paymentMethod().status()); - Assertions.assertEquals("frkebsmhpd", model.paymentMethodId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PaymentMethodLinkProperties model = new PaymentMethodLinkProperties() - .withPaymentMethod(new PaymentMethodProperties().withFamily(PaymentMethodFamily.NONE) - .withLogos(Arrays.asList(new PaymentMethodLogo())) - .withStatus(PaymentMethodStatus.INACTIVE)) - .withPaymentMethodId("frkebsmhpd"); - model = BinaryData.fromObject(model).toObject(PaymentMethodLinkProperties.class); - Assertions.assertEquals(PaymentMethodFamily.NONE, model.paymentMethod().family()); - Assertions.assertEquals(PaymentMethodStatus.INACTIVE, model.paymentMethod().status()); - Assertions.assertEquals("frkebsmhpd", model.paymentMethodId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodLinksListResultTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodLinksListResultTests.java deleted file mode 100644 index 2f506f74dd3f..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodLinksListResultTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.PaymentMethodLinksListResult; - -public final class PaymentMethodLinksListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PaymentMethodLinksListResult model = BinaryData.fromString( - "{\"nextLink\":\"ron\",\"value\":[{\"properties\":{\"accountHolderName\":\"nlqxsjxtele\",\"displayName\":\"vuqbozoo\",\"expiration\":\"qocarkuzlbc\",\"family\":\"DirectDebit\",\"lastFourDigits\":\"snxawqyt\",\"logos\":[{\"mimeType\":\"yzm\",\"url\":\"kzexnx\"}],\"paymentMethod\":{\"id\":\"kywymxgaabj\",\"accountHolderName\":\"tfohf\",\"displayName\":\"gzvkiwrsiwdyj\",\"expiration\":\"rykcrraueekcsue\",\"family\":\"None\",\"lastFourDigits\":\"dac\",\"logos\":[{},{},{}],\"paymentMethodType\":\"ydl\",\"status\":\"active\"},\"paymentMethodId\":\"wmhmptyrilkfbnr\",\"paymentMethodType\":\"xvztpbnfnqtxj\",\"status\":\"active\"},\"tags\":{\"zygleexahvm\":\"swbnfddepldwqjns\",\"sjjzyvoaqajuveh\":\"whsbrcary\"},\"id\":\"tdmkrrbhmpful\",\"name\":\"be\",\"type\":\"gybpmfb\"},{\"properties\":{\"accountHolderName\":\"unmpzkrvfyifkdsc\",\"displayName\":\"zvfictnk\",\"expiration\":\"wgcwnp\",\"family\":\"None\",\"lastFourDigits\":\"fyrtogmhmjp\",\"logos\":[{\"mimeType\":\"fp\",\"url\":\"wtyg\"}],\"paymentMethod\":{\"id\":\"wmseharxifvqn\",\"accountHolderName\":\"tmbpjp\",\"displayName\":\"vwjhrsidqpxlbt\",\"expiration\":\"kft\",\"family\":\"None\",\"lastFourDigits\":\"wmykyutry\",\"logos\":[{},{}],\"paymentMethodType\":\"fj\",\"status\":\"active\"},\"paymentMethodId\":\"vjqdvdwkq\",\"paymentMethodType\":\"drlefgnaavuag\",\"status\":\"inactive\"},\"tags\":{\"hduyeuyldph\":\"outnpdctuhspfefy\"},\"id\":\"ybkcgsuthhllnmwy\",\"name\":\"efxexlf\",\"type\":\"i\"},{\"properties\":{\"accountHolderName\":\"tjrrlkmds\",\"displayName\":\"hh\",\"expiration\":\"lajfoxcxscvslxlh\",\"family\":\"EWallet\",\"lastFourDigits\":\"rmukmyjmkxett\",\"logos\":[{\"mimeType\":\"jfkqidn\",\"url\":\"o\"},{\"mimeType\":\"jhqxc\",\"url\":\"htkbtnq\"},{\"mimeType\":\"ngldmbiipsn\",\"url\":\"wl\"}],\"paymentMethod\":{\"id\":\"nxhhl\",\"accountHolderName\":\"ricctkwmuqqoa\",\"displayName\":\"eiyglesrwvaexhdc\",\"expiration\":\"ceqnkbrupobehd\",\"family\":\"DirectDebit\",\"lastFourDigits\":\"acvumepj\",\"logos\":[{},{}],\"paymentMethodType\":\"nzpphepife\",\"status\":\"active\"},\"paymentMethodId\":\"i\",\"paymentMethodType\":\"cjclykcgxv\",\"status\":\"active\"},\"tags\":{\"cpunettepdjx\":\"czuod\",\"uiylpc\":\"eskoy\",\"vesk\":\"aewse\"},\"id\":\"egqphrgfnzhctm\",\"name\":\"tsghpbcbcp\",\"type\":\"arpzeqacdldtzm\"}]}") - .toObject(PaymentMethodLinksListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PaymentMethodLinksListResult model = new PaymentMethodLinksListResult(); - model = BinaryData.fromObject(model).toObject(PaymentMethodLinksListResult.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodLogoTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodLogoTests.java deleted file mode 100644 index 377157ca6de0..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodLogoTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.PaymentMethodLogo; - -public final class PaymentMethodLogoTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PaymentMethodLogo model = BinaryData.fromString("{\"mimeType\":\"ekscbctnanqimwbz\",\"url\":\"dcldpkawnsnl\"}") - .toObject(PaymentMethodLogo.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PaymentMethodLogo model = new PaymentMethodLogo(); - model = BinaryData.fromObject(model).toObject(PaymentMethodLogo.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodPropertiesTests.java deleted file mode 100644 index 4cbe4d4e42fb..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodPropertiesTests.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.PaymentMethodProperties; -import com.azure.resourcemanager.billing.models.PaymentMethodFamily; -import com.azure.resourcemanager.billing.models.PaymentMethodLogo; -import com.azure.resourcemanager.billing.models.PaymentMethodStatus; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class PaymentMethodPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PaymentMethodProperties model = BinaryData.fromString( - "{\"id\":\"mouxwksqmudmfco\",\"accountHolderName\":\"icziuswswjrkb\",\"displayName\":\"jhbtqq\",\"expiration\":\"fs\",\"family\":\"None\",\"lastFourDigits\":\"wbivqvogfuyzwvbh\",\"logos\":[{\"mimeType\":\"yqe\",\"url\":\"ood\"}],\"paymentMethodType\":\"kcdrdaasaxxobsm\",\"status\":\"inactive\"}") - .toObject(PaymentMethodProperties.class); - Assertions.assertEquals(PaymentMethodFamily.NONE, model.family()); - Assertions.assertEquals(PaymentMethodStatus.INACTIVE, model.status()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PaymentMethodProperties model = new PaymentMethodProperties().withFamily(PaymentMethodFamily.NONE) - .withLogos(Arrays.asList(new PaymentMethodLogo())) - .withStatus(PaymentMethodStatus.INACTIVE); - model = BinaryData.fromObject(model).toObject(PaymentMethodProperties.class); - Assertions.assertEquals(PaymentMethodFamily.NONE, model.family()); - Assertions.assertEquals(PaymentMethodStatus.INACTIVE, model.status()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsDeleteByUserWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsDeleteByUserWithResponseMockTests.java deleted file mode 100644 index 431b3ff448d0..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsDeleteByUserWithResponseMockTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class PaymentMethodsDeleteByUserWithResponseMockTests { - @Test - public void testDeleteByUserWithResponse() throws Exception { - String responseStr = "{}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - manager.paymentMethods().deleteByUserWithResponse("anzolqqpanzpzmo", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsGetByBillingAccountWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsGetByBillingAccountWithResponseMockTests.java deleted file mode 100644 index 4aac826c4ce7..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsGetByBillingAccountWithResponseMockTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.PaymentMethod; -import com.azure.resourcemanager.billing.models.PaymentMethodFamily; -import com.azure.resourcemanager.billing.models.PaymentMethodStatus; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class PaymentMethodsGetByBillingAccountWithResponseMockTests { - @Test - public void testGetByBillingAccountWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"id\":\"izznkrarjii\",\"accountHolderName\":\"bychcwhl\",\"displayName\":\"z\",\"expiration\":\"rlfcmeyxypx\",\"family\":\"None\",\"lastFourDigits\":\"t\",\"logos\":[{\"mimeType\":\"zcvetpdezebvtkgz\",\"url\":\"adfh\"}],\"paymentMethodType\":\"ilnhkcxuou\",\"status\":\"inactive\"},\"tags\":{\"diydwklkuamxho\":\"ogcvazozovnyofts\",\"gmkztwzlwellh\":\"tnqeonyizqdw\",\"vrfuzedudkt\":\"ppf\"},\"id\":\"vw\",\"name\":\"tfvjvumimbc\",\"type\":\"lhycluounvr\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PaymentMethod response = manager.paymentMethods() - .getByBillingAccountWithResponse("azwkcohjxo", "mmvuamorhkneuuu", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("ogcvazozovnyofts", response.tags().get("diydwklkuamxho")); - Assertions.assertEquals(PaymentMethodFamily.NONE, response.family()); - Assertions.assertEquals(PaymentMethodStatus.INACTIVE, response.status()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsGetByBillingProfileWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsGetByBillingProfileWithResponseMockTests.java deleted file mode 100644 index 7df4806e8c1b..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsGetByBillingProfileWithResponseMockTests.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.PaymentMethodFamily; -import com.azure.resourcemanager.billing.models.PaymentMethodLink; -import com.azure.resourcemanager.billing.models.PaymentMethodStatus; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class PaymentMethodsGetByBillingProfileWithResponseMockTests { - @Test - public void testGetByBillingProfileWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"accountHolderName\":\"xvrutjitu\",\"displayName\":\"knarscxnk\",\"expiration\":\"jinzosxrsmvnnjwn\",\"family\":\"TaskOrder\",\"lastFourDigits\":\"ezwwqchxowpp\",\"logos\":[{\"mimeType\":\"actoqqehn\",\"url\":\"rrgnvuolvptv\"},{\"mimeType\":\"bkizebbrw\",\"url\":\"eq\"},{\"mimeType\":\"soiqge\",\"url\":\"g\"},{\"mimeType\":\"wyxbwuamoaopqq\",\"url\":\"jre\"}],\"paymentMethod\":{\"id\":\"chengmxpjkuq\",\"accountHolderName\":\"gro\",\"displayName\":\"xsqdzyyalrx\",\"expiration\":\"qpqfw\",\"family\":\"Credits\",\"lastFourDigits\":\"jkbaxvus\",\"logos\":[{\"mimeType\":\"ipggtahxb\",\"url\":\"bipldzip\"},{\"mimeType\":\"ifefznx\",\"url\":\"ey\"}],\"paymentMethodType\":\"vritjjhqvypqgncg\",\"status\":\"inactive\"},\"paymentMethodId\":\"tkafcnfitpu\",\"paymentMethodType\":\"ykdwyjd\",\"status\":\"inactive\"},\"tags\":{\"yngoudclri\":\"awj\"},\"id\":\"lynxbdisjeovg\",\"name\":\"fhchgjo\",\"type\":\"rhdibzvp\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PaymentMethodLink response = manager.paymentMethods() - .getByBillingProfileWithResponse("cwubtegoachojit", "aqqfrgiplxr", "fbsbkvfkvdbbpo", - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("awj", response.tags().get("yngoudclri")); - Assertions.assertEquals(PaymentMethodFamily.CREDITS, response.paymentMethod().family()); - Assertions.assertEquals(PaymentMethodStatus.INACTIVE, response.paymentMethod().status()); - Assertions.assertEquals("tkafcnfitpu", response.paymentMethodId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsGetByUserWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsGetByUserWithResponseMockTests.java deleted file mode 100644 index 3c2f90bae69f..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsGetByUserWithResponseMockTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.PaymentMethod; -import com.azure.resourcemanager.billing.models.PaymentMethodFamily; -import com.azure.resourcemanager.billing.models.PaymentMethodStatus; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class PaymentMethodsGetByUserWithResponseMockTests { - @Test - public void testGetByUserWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"id\":\"wisqfif\",\"accountHolderName\":\"tqvypki\",\"displayName\":\"ouezbc\",\"expiration\":\"msc\",\"family\":\"CheckWire\",\"lastFourDigits\":\"aehllwqmraihe\",\"logos\":[{\"mimeType\":\"zlgcliaj\",\"url\":\"xvih\"},{\"mimeType\":\"r\",\"url\":\"oxexvt\"},{\"mimeType\":\"hsymgkirfzvtzrqo\",\"url\":\"ipmuufsekzspu\"}],\"paymentMethodType\":\"wpkpejfszwrqms\",\"status\":\"active\"},\"tags\":{\"cnzfajpt\":\"fw\",\"afjcdccqjaefrzq\":\"hwrnwrakap\"},\"id\":\"tgggidrx\",\"name\":\"ykjchz\",\"type\":\"zwcpqkpgbs\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PaymentMethod response = manager.paymentMethods() - .getByUserWithResponse("upqlusxkzdnot", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("fw", response.tags().get("cnzfajpt")); - Assertions.assertEquals(PaymentMethodFamily.CHECK_WIRE, response.family()); - Assertions.assertEquals(PaymentMethodStatus.ACTIVE, response.status()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsListByBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsListByBillingAccountMockTests.java deleted file mode 100644 index 899973fc6069..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsListByBillingAccountMockTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.PaymentMethod; -import com.azure.resourcemanager.billing.models.PaymentMethodFamily; -import com.azure.resourcemanager.billing.models.PaymentMethodStatus; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class PaymentMethodsListByBillingAccountMockTests { - @Test - public void testListByBillingAccount() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"id\":\"njbbhwsfllzy\",\"accountHolderName\":\"pj\",\"displayName\":\"slpbyejsgbpjjnbl\",\"expiration\":\"ak\",\"family\":\"None\",\"lastFourDigits\":\"bddnddctkjcqhx\",\"logos\":[{\"mimeType\":\"tqilsbabqtjchxsf\",\"url\":\"yleiyemjipszekd\"},{\"mimeType\":\"wcspfhrndqymlos\",\"url\":\"gsdqnqqzqdvg\"},{\"mimeType\":\"mtkg\",\"url\":\"nyaarwphbuzmvjil\"},{\"mimeType\":\"bmfkctpa\",\"url\":\"hrjwyxduwimwnuvj\"}],\"paymentMethodType\":\"wpfxi\",\"status\":\"active\"},\"tags\":{\"yjdbc\":\"njtksw\",\"dkcbpkig\":\"nsojtm\",\"dwgussctnppxxeys\":\"vvaitkce\",\"zmvnbckls\":\"enfwugonysemun\"},\"id\":\"uuksvfsukpkiea\",\"name\":\"bckpnn\",\"type\":\"nrcezto\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response - = manager.paymentMethods().listByBillingAccount("jytmeouiuvkc", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("njtksw", response.iterator().next().tags().get("yjdbc")); - Assertions.assertEquals(PaymentMethodFamily.NONE, response.iterator().next().family()); - Assertions.assertEquals(PaymentMethodStatus.ACTIVE, response.iterator().next().status()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsListByBillingProfileMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsListByBillingProfileMockTests.java deleted file mode 100644 index 2c07d5543200..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsListByBillingProfileMockTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.PaymentMethodFamily; -import com.azure.resourcemanager.billing.models.PaymentMethodLink; -import com.azure.resourcemanager.billing.models.PaymentMethodStatus; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class PaymentMethodsListByBillingProfileMockTests { - @Test - public void testListByBillingProfile() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"accountHolderName\":\"edvbrbdujpsh\",\"displayName\":\"zivrycyulwzjo\",\"expiration\":\"sgmkkelesb\",\"family\":\"DirectDebit\",\"lastFourDigits\":\"ocybrlwdmpsdf\",\"logos\":[{\"mimeType\":\"ktnhyylipvqpqu\",\"url\":\"xnpoaer\"},{\"mimeType\":\"wfhl\",\"url\":\"lzlmpiprl\"},{\"mimeType\":\"q\",\"url\":\"mnwyhqlybm\"},{\"mimeType\":\"xusmkpa\",\"url\":\"pwpbnjc\"}],\"paymentMethod\":{\"id\":\"tun\",\"accountHolderName\":\"mysv\",\"displayName\":\"dllbw\",\"expiration\":\"vhbzypmmyrg\",\"family\":\"DirectDebit\",\"lastFourDigits\":\"uzohihqlwyq\",\"logos\":[{\"mimeType\":\"tltlmczcxouane\",\"url\":\"pgqztakovsl\"},{\"mimeType\":\"pvdmtfcstucmi\",\"url\":\"dsnuqqgsqit\"}],\"paymentMethodType\":\"ttkasxjkclzqpas\",\"status\":\"active\"},\"paymentMethodId\":\"tbh\",\"paymentMethodType\":\"hkijqg\",\"status\":\"active\"},\"tags\":{\"zvj\":\"xrqiwxeppuhkizoa\",\"vfbmxzobpg\":\"vob\",\"lkpajio\":\"s\"},\"id\":\"byil\",\"name\":\"dbbxmeu\",\"type\":\"x\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.paymentMethods() - .listByBillingProfile("opiglahheq", "chhrrxmcztrqnua", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("xrqiwxeppuhkizoa", response.iterator().next().tags().get("zvj")); - Assertions.assertEquals(PaymentMethodFamily.DIRECT_DEBIT, response.iterator().next().paymentMethod().family()); - Assertions.assertEquals(PaymentMethodStatus.ACTIVE, response.iterator().next().paymentMethod().status()); - Assertions.assertEquals("tbh", response.iterator().next().paymentMethodId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsListByUserMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsListByUserMockTests.java deleted file mode 100644 index d0c7883c97ee..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsListByUserMockTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.PaymentMethod; -import com.azure.resourcemanager.billing.models.PaymentMethodFamily; -import com.azure.resourcemanager.billing.models.PaymentMethodStatus; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class PaymentMethodsListByUserMockTests { - @Test - public void testListByUser() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"id\":\"n\",\"accountHolderName\":\"za\",\"displayName\":\"vcze\",\"expiration\":\"ewcrblksddb\",\"family\":\"DirectDebit\",\"lastFourDigits\":\"jhoezjikwsu\",\"logos\":[{\"mimeType\":\"xtx\",\"url\":\"ypdcgx\"},{\"mimeType\":\"bwvuwbbzcmp\",\"url\":\"msg\"},{\"mimeType\":\"ksmrgjfyfmj\",\"url\":\"ctybhsg\"}],\"paymentMethodType\":\"umkts\",\"status\":\"inactive\"},\"tags\":{\"mawxrg\":\"ncxje\",\"wwkhiyubykxzcvut\":\"tynqbhhfhi\"},\"id\":\"ih\",\"name\":\"srj\",\"type\":\"pvojw\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.paymentMethods().listByUser(com.azure.core.util.Context.NONE); - - Assertions.assertEquals("ncxje", response.iterator().next().tags().get("mawxrg")); - Assertions.assertEquals(PaymentMethodFamily.DIRECT_DEBIT, response.iterator().next().family()); - Assertions.assertEquals(PaymentMethodStatus.INACTIVE, response.iterator().next().status()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsListResultTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsListResultTests.java deleted file mode 100644 index 4c38778d9727..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentMethodsListResultTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.PaymentMethodsListResult; - -public final class PaymentMethodsListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PaymentMethodsListResult model = BinaryData.fromString( - "{\"nextLink\":\"yjvzukosr\",\"value\":[{\"properties\":{\"id\":\"zm\",\"accountHolderName\":\"k\",\"displayName\":\"wsxvjab\",\"expiration\":\"qa\",\"family\":\"EWallet\",\"lastFourDigits\":\"y\",\"logos\":[{\"mimeType\":\"dndoabhjxw\",\"url\":\"weuipmpvksmi\"}],\"paymentMethodType\":\"sqxtltclkrdpq\",\"status\":\"inactive\"},\"tags\":{\"fcmfcn\":\"frakkldgrc\",\"elnzqgxxgfbbmt\":\"jajqmatxjt\"},\"id\":\"qagynoipr\",\"name\":\"zcalincryq\",\"type\":\"zxaqzibm\"}]}") - .toObject(PaymentMethodsListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PaymentMethodsListResult model = new PaymentMethodsListResult(); - model = BinaryData.fromObject(model).toObject(PaymentMethodsListResult.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentOnAccountAmountTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentOnAccountAmountTests.java deleted file mode 100644 index dc83672ecdfa..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentOnAccountAmountTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.PaymentOnAccountAmount; - -public final class PaymentOnAccountAmountTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PaymentOnAccountAmount model = BinaryData.fromString("{\"currency\":\"hajdeyeamdpha\",\"value\":99.485886}") - .toObject(PaymentOnAccountAmount.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PaymentOnAccountAmount model = new PaymentOnAccountAmount(); - model = BinaryData.fromObject(model).toObject(PaymentOnAccountAmount.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentOnAccountTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentOnAccountTests.java deleted file mode 100644 index 14b7eed50cfa..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentOnAccountTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.PaymentOnAccount; -import com.azure.resourcemanager.billing.models.PaymentOnAccountAmount; - -public final class PaymentOnAccountTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PaymentOnAccount model = BinaryData.fromString( - "{\"amount\":{\"currency\":\"z\",\"value\":4.9401464},\"billingProfileId\":\"gukgjnpiucgygevq\",\"billingProfileDisplayName\":\"typmrbpizcdrqjsd\",\"invoiceId\":\"dnfyhxdeoejzicwi\",\"invoiceName\":\"jttgzf\",\"date\":\"2021-03-25T08:46:02Z\",\"paymentMethodType\":\"None\"}") - .toObject(PaymentOnAccount.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PaymentOnAccount model = new PaymentOnAccount().withAmount(new PaymentOnAccountAmount()); - model = BinaryData.fromObject(model).toObject(PaymentOnAccount.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentTermTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentTermTests.java deleted file mode 100644 index 2a30b97ebc3e..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentTermTests.java +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.PaymentTerm; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class PaymentTermTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PaymentTerm model = BinaryData.fromString( - "{\"term\":\"ow\",\"startDate\":\"2021-05-13T18:46:16Z\",\"endDate\":\"2021-01-01T20:18:45Z\",\"isDefault\":true}") - .toObject(PaymentTerm.class); - Assertions.assertEquals("ow", model.term()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-13T18:46:16Z"), model.startDate()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-01T20:18:45Z"), model.endDate()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PaymentTerm model = new PaymentTerm().withTerm("ow") - .withStartDate(OffsetDateTime.parse("2021-05-13T18:46:16Z")) - .withEndDate(OffsetDateTime.parse("2021-01-01T20:18:45Z")); - model = BinaryData.fromObject(model).toObject(PaymentTerm.class); - Assertions.assertEquals("ow", model.term()); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-13T18:46:16Z"), model.startDate()); - Assertions.assertEquals(OffsetDateTime.parse("2021-01-01T20:18:45Z"), model.endDate()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentTests.java deleted file mode 100644 index 4b6b963bdbdb..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PaymentTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.Payment; -import com.azure.resourcemanager.billing.models.PaymentAmount; - -public final class PaymentTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Payment model = BinaryData.fromString( - "{\"amount\":{\"currency\":\"zhzzwvywrg\",\"value\":79.30035},\"date\":\"2021-05-11T05:41:26Z\",\"paymentMethodId\":\"rpxncaki\",\"paymentMethodFamily\":\"CheckWire\",\"paymentMethodType\":\"djrkclamggl\",\"paymentType\":\"mfejdoqeykglty\"}") - .toObject(Payment.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Payment model = new Payment().withAmount(new PaymentAmount()); - model = BinaryData.fromObject(model).toObject(Payment.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesCreateOrUpdateByBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesCreateOrUpdateByBillingAccountMockTests.java deleted file mode 100644 index 1d6956283f12..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesCreateOrUpdateByBillingAccountMockTests.java +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.fluent.models.BillingAccountPolicyInner; -import com.azure.resourcemanager.billing.models.BillingAccountPolicy; -import com.azure.resourcemanager.billing.models.BillingAccountPolicyProperties; -import com.azure.resourcemanager.billing.models.BillingAccountPolicyPropertiesEnterpriseAgreementPolicies; -import com.azure.resourcemanager.billing.models.EnrollmentAccountOwnerViewCharges; -import com.azure.resourcemanager.billing.models.EnrollmentAuthLevelState; -import com.azure.resourcemanager.billing.models.EnrollmentDepartmentAdminViewCharges; -import com.azure.resourcemanager.billing.models.MarketplacePurchasesPolicy; -import com.azure.resourcemanager.billing.models.PolicySummary; -import com.azure.resourcemanager.billing.models.PolicyType; -import com.azure.resourcemanager.billing.models.ReservationPurchasesPolicy; -import com.azure.resourcemanager.billing.models.SavingsPlanPurchasesPolicy; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class PoliciesCreateOrUpdateByBillingAccountMockTests { - @Test - public void testCreateOrUpdateByBillingAccount() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"enterpriseAgreementPolicies\":{\"authenticationType\":\"Other\",\"accountOwnerViewCharges\":\"Disabled\",\"departmentAdminViewCharges\":\"Other\"},\"marketplacePurchases\":\"AllAllowed\",\"reservationPurchases\":\"Allowed\",\"savingsPlanPurchases\":\"Other\",\"policies\":[{\"name\":\"rfmcjjxx\",\"value\":\"dwmjurtnolzio\",\"policyType\":\"UserControlled\",\"scope\":\"ukeplfwykr\"},{\"name\":\"jenpsff\",\"value\":\"zefajgb\",\"policyType\":\"Other\",\"scope\":\"p\"}]},\"tags\":{\"xfnzcev\":\"h\",\"yd\":\"bie\",\"rvdszrizpejhy\":\"jdkzfkneckv\",\"itykzyirjui\":\"zzxqtcgswmhzci\"},\"id\":\"nfu\",\"name\":\"htzgxsyiwmopkudh\",\"type\":\"ztbwzjbqzq\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingAccountPolicy response = manager.policies() - .createOrUpdateByBillingAccount("vspknxraidjeddn", - new BillingAccountPolicyInner().withTags(mapOf("bzmyov", "hvp", "mfsh", "xstxsfztlvs")) - .withProperties(new BillingAccountPolicyProperties() - .withEnterpriseAgreementPolicies(new BillingAccountPolicyPropertiesEnterpriseAgreementPolicies() - .withAuthenticationType(EnrollmentAuthLevelState.OTHER) - .withAccountOwnerViewCharges(EnrollmentAccountOwnerViewCharges.DISABLED) - .withDepartmentAdminViewCharges(EnrollmentDepartmentAdminViewCharges.OTHER)) - .withMarketplacePurchases(MarketplacePurchasesPolicy.NOT_ALLOWED) - .withReservationPurchases(ReservationPurchasesPolicy.DISABLED) - .withSavingsPlanPurchases(SavingsPlanPurchasesPolicy.DISABLED) - .withPolicies(Arrays.asList( - new PolicySummary().withName("uckojqoxpwdh") - .withValue("dosqvdoy") - .withPolicyType(PolicyType.SYSTEM_CONTROLLED) - .withScope("xushml"), - new PolicySummary().withName("h") - .withValue("ptvk") - .withPolicyType(PolicyType.SYSTEM_CONTROLLED) - .withScope("nt"), - new PolicySummary().withName("zee") - .withValue("pggsyeydctjne") - .withPolicyType(PolicyType.SYSTEM_CONTROLLED) - .withScope("tlzbwbyvjisp")))), - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("h", response.tags().get("xfnzcev")); - Assertions.assertEquals(EnrollmentAuthLevelState.OTHER, - response.properties().enterpriseAgreementPolicies().authenticationType()); - Assertions.assertEquals(EnrollmentAccountOwnerViewCharges.DISABLED, - response.properties().enterpriseAgreementPolicies().accountOwnerViewCharges()); - Assertions.assertEquals(EnrollmentDepartmentAdminViewCharges.OTHER, - response.properties().enterpriseAgreementPolicies().departmentAdminViewCharges()); - Assertions.assertEquals(MarketplacePurchasesPolicy.ALL_ALLOWED, response.properties().marketplacePurchases()); - Assertions.assertEquals(ReservationPurchasesPolicy.ALLOWED, response.properties().reservationPurchases()); - Assertions.assertEquals(SavingsPlanPurchasesPolicy.OTHER, response.properties().savingsPlanPurchases()); - Assertions.assertEquals("rfmcjjxx", response.properties().policies().get(0).name()); - Assertions.assertEquals("dwmjurtnolzio", response.properties().policies().get(0).value()); - Assertions.assertEquals(PolicyType.USER_CONTROLLED, response.properties().policies().get(0).policyType()); - Assertions.assertEquals("ukeplfwykr", response.properties().policies().get(0).scope()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesCreateOrUpdateByBillingProfileMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesCreateOrUpdateByBillingProfileMockTests.java deleted file mode 100644 index 6ffc04bdee00..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesCreateOrUpdateByBillingProfileMockTests.java +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.fluent.models.BillingProfilePolicyInner; -import com.azure.resourcemanager.billing.models.BillingProfilePolicy; -import com.azure.resourcemanager.billing.models.BillingProfilePolicyProperties; -import com.azure.resourcemanager.billing.models.BillingProfilePolicyPropertiesEnterpriseAgreementPolicies; -import com.azure.resourcemanager.billing.models.EnrollmentAccountOwnerViewCharges; -import com.azure.resourcemanager.billing.models.EnrollmentAuthLevelState; -import com.azure.resourcemanager.billing.models.EnrollmentDepartmentAdminViewCharges; -import com.azure.resourcemanager.billing.models.InvoiceSectionLabelManagementPolicy; -import com.azure.resourcemanager.billing.models.MarketplacePurchasesPolicy; -import com.azure.resourcemanager.billing.models.PolicySummary; -import com.azure.resourcemanager.billing.models.PolicyType; -import com.azure.resourcemanager.billing.models.ReservationPurchasesPolicy; -import com.azure.resourcemanager.billing.models.SavingsPlanPurchasesPolicy; -import com.azure.resourcemanager.billing.models.ViewChargesPolicy; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class PoliciesCreateOrUpdateByBillingProfileMockTests { - @Test - public void testCreateOrUpdateByBillingProfile() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"enterpriseAgreementPolicies\":{\"authenticationType\":\"OrganizationalAccountOnly\",\"accountOwnerViewCharges\":\"Other\",\"departmentAdminViewCharges\":\"Disabled\"},\"invoiceSectionLabelManagement\":\"Other\",\"marketplacePurchases\":\"OnlyFreeAllowed\",\"reservationPurchases\":\"Allowed\",\"savingsPlanPurchases\":\"Disabled\",\"viewCharges\":\"Other\",\"policies\":[{\"name\":\"cffjhi\",\"value\":\"qzbsq\",\"policyType\":\"Other\",\"scope\":\"io\"}]},\"tags\":{\"dglxppewtlfsw\":\"zsw\",\"vvb\":\"lwnffczwzr\"},\"id\":\"npriyttiqdcjg\",\"name\":\"mcwmqpcwoe\",\"type\":\"jrfrucpefwdxbp\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingProfilePolicy response - = manager.policies() - .createOrUpdateByBillingProfile("ckmzbhxxdxnh", "nnkakqwtozxl", - new BillingProfilePolicyInner() - .withTags(mapOf("szcwwv", "c", "tqxqiqaefu", "xvibivhjryppm", "lkffgyfehjs", "qfcorajdb", "ufx", - "ceuvynhmbz")) - .withProperties(new BillingProfilePolicyProperties() - .withEnterpriseAgreementPolicies( - new BillingProfilePolicyPropertiesEnterpriseAgreementPolicies() - .withAuthenticationType( - EnrollmentAuthLevelState.ORGANIZATIONAL_ACCOUNT_CROSS_TENANT) - .withAccountOwnerViewCharges(EnrollmentAccountOwnerViewCharges.NOT_ALLOWED) - .withDepartmentAdminViewCharges(EnrollmentDepartmentAdminViewCharges.NOT_ALLOWED)) - .withInvoiceSectionLabelManagement(InvoiceSectionLabelManagementPolicy.ALLOWED) - .withMarketplacePurchases(MarketplacePurchasesPolicy.ALL_ALLOWED) - .withReservationPurchases(ReservationPurchasesPolicy.OTHER) - .withSavingsPlanPurchases(SavingsPlanPurchasesPolicy.DISABLED) - .withViewCharges(ViewChargesPolicy.NOT_ALLOWED) - .withPolicies(Arrays.asList( - new PolicySummary().withName("htfm") - .withValue("aknppucfv") - .withPolicyType(PolicyType.USER_CONTROLLED) - .withScope("xcrh"), - new PolicySummary().withName("cnvd") - .withValue("iuxx") - .withPolicyType(PolicyType.OTHER) - .withScope("phyjued"), - new PolicySummary().withName("kpysm") - .withValue("p") - .withPolicyType(PolicyType.OTHER) - .withScope("ssbuzaxmkutho")))), - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("zsw", response.tags().get("dglxppewtlfsw")); - Assertions.assertEquals(EnrollmentAuthLevelState.ORGANIZATIONAL_ACCOUNT_ONLY, - response.properties().enterpriseAgreementPolicies().authenticationType()); - Assertions.assertEquals(EnrollmentAccountOwnerViewCharges.OTHER, - response.properties().enterpriseAgreementPolicies().accountOwnerViewCharges()); - Assertions.assertEquals(EnrollmentDepartmentAdminViewCharges.DISABLED, - response.properties().enterpriseAgreementPolicies().departmentAdminViewCharges()); - Assertions.assertEquals(InvoiceSectionLabelManagementPolicy.OTHER, - response.properties().invoiceSectionLabelManagement()); - Assertions.assertEquals(MarketplacePurchasesPolicy.ONLY_FREE_ALLOWED, - response.properties().marketplacePurchases()); - Assertions.assertEquals(ReservationPurchasesPolicy.ALLOWED, response.properties().reservationPurchases()); - Assertions.assertEquals(SavingsPlanPurchasesPolicy.DISABLED, response.properties().savingsPlanPurchases()); - Assertions.assertEquals(ViewChargesPolicy.OTHER, response.properties().viewCharges()); - Assertions.assertEquals("cffjhi", response.properties().policies().get(0).name()); - Assertions.assertEquals("qzbsq", response.properties().policies().get(0).value()); - Assertions.assertEquals(PolicyType.OTHER, response.properties().policies().get(0).policyType()); - Assertions.assertEquals("io", response.properties().policies().get(0).scope()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesCreateOrUpdateByCustomerAtBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesCreateOrUpdateByCustomerAtBillingAccountMockTests.java deleted file mode 100644 index 87c2094290fa..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesCreateOrUpdateByCustomerAtBillingAccountMockTests.java +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.fluent.models.CustomerPolicyInner; -import com.azure.resourcemanager.billing.models.CustomerPolicy; -import com.azure.resourcemanager.billing.models.CustomerPolicyProperties; -import com.azure.resourcemanager.billing.models.PolicySummary; -import com.azure.resourcemanager.billing.models.PolicyType; -import com.azure.resourcemanager.billing.models.ViewChargesPolicy; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class PoliciesCreateOrUpdateByCustomerAtBillingAccountMockTests { - @Test - public void testCreateOrUpdateByCustomerAtBillingAccount() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"viewCharges\":\"NotAllowed\",\"policies\":[{\"name\":\"ttkprxypxtip\",\"value\":\"bebafiqxomevke\",\"policyType\":\"SystemControlled\",\"scope\":\"vncxtnbutytoaini\"},{\"name\":\"xhzqgbaqvqe\",\"value\":\"ackobkrg\",\"policyType\":\"UserControlled\",\"scope\":\"bxwxlh\"}]},\"tags\":{\"zlgu\":\"hxothfyifju\",\"hmnuzyycqs\":\"smt\",\"amochpwwykfy\":\"yrywdezprycixjg\",\"khmoudmcad\":\"jkztdckwqv\"},\"id\":\"jfuvmjtxwazyvibn\",\"name\":\"ebffkgfiyd\",\"type\":\"rjmwaa\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - CustomerPolicy response - = manager.policies() - .createOrUpdateByCustomerAtBillingAccount("zmfpspaxhfuwygss", "sjcpfepylms", new CustomerPolicyInner() - .withTags(mapOf("qgxbovtj", "z", "fyevhurklow", "dymdypsxkw", "lyoix", "drvzcl", "nqizvsih", "ei")) - .withProperties(new CustomerPolicyProperties().withViewCharges(ViewChargesPolicy.OTHER) - .withPolicies(Arrays.asList( - new PolicySummary().withName("iyzrdjfmmwk") - .withValue("yxyksdel") - .withPolicyType(PolicyType.OTHER) - .withScope("ffvbhtuey"), - new PolicySummary().withName("kxqnwc") - .withValue("qsbncadfapzebjeg") - .withPolicyType(PolicyType.SYSTEM_CONTROLLED) - .withScope("erbyw"), - new PolicySummary().withName("veisjbpzdwhxputk") - .withValue("l") - .withPolicyType(PolicyType.USER_CONTROLLED) - .withScope("vdfeyaevzjqfxf")))), - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("hxothfyifju", response.tags().get("zlgu")); - Assertions.assertEquals(ViewChargesPolicy.NOT_ALLOWED, response.properties().viewCharges()); - Assertions.assertEquals("ttkprxypxtip", response.properties().policies().get(0).name()); - Assertions.assertEquals("bebafiqxomevke", response.properties().policies().get(0).value()); - Assertions.assertEquals(PolicyType.SYSTEM_CONTROLLED, response.properties().policies().get(0).policyType()); - Assertions.assertEquals("vncxtnbutytoaini", response.properties().policies().get(0).scope()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesCreateOrUpdateByCustomerMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesCreateOrUpdateByCustomerMockTests.java deleted file mode 100644 index 091aef27d718..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesCreateOrUpdateByCustomerMockTests.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.fluent.models.CustomerPolicyInner; -import com.azure.resourcemanager.billing.models.CustomerPolicy; -import com.azure.resourcemanager.billing.models.CustomerPolicyProperties; -import com.azure.resourcemanager.billing.models.PolicySummary; -import com.azure.resourcemanager.billing.models.PolicyType; -import com.azure.resourcemanager.billing.models.ViewChargesPolicy; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class PoliciesCreateOrUpdateByCustomerMockTests { - @Test - public void testCreateOrUpdateByCustomer() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"viewCharges\":\"Other\",\"policies\":[{\"name\":\"lbsnlfp\",\"value\":\"jrh\",\"policyType\":\"SystemControlled\",\"scope\":\"orhwuujymyjvkoy\"},{\"name\":\"tourrq\",\"value\":\"hlhz\",\"policyType\":\"Other\",\"scope\":\"emzvqm\"},{\"name\":\"svxbagccvhnoq\",\"value\":\"wepcntqos\",\"policyType\":\"UserControlled\",\"scope\":\"kx\"}]},\"tags\":{\"d\":\"uyygdoi\",\"x\":\"c\",\"enbdqxf\":\"byvbdvgztjtzs\"},\"id\":\"jcngjcdyk\",\"name\":\"pnfvzbvtxgsn\",\"type\":\"sqjjcwggjimlcb\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - CustomerPolicy response = manager.policies() - .createOrUpdateByCustomer("yarqthbjblhefq", "irnxtpzdgy", "lwuiklbjlnbx", - new CustomerPolicyInner() - .withTags(mapOf("efoxlzrijpkb", "bogpb", "zawenrv", "vmzupqkrqeqj", "izvve", "itzdjixkepladoh")) - .withProperties(new CustomerPolicyProperties().withViewCharges(ViewChargesPolicy.OTHER) - .withPolicies(Arrays.asList( - new PolicySummary().withName("gjfhviahoke") - .withValue("madyoctmdauoscc") - .withPolicyType(PolicyType.OTHER) - .withScope("stnt"), - new PolicySummary().withName("teufgdgbzftsbpe") - .withValue("f") - .withPolicyType(PolicyType.USER_CONTROLLED) - .withScope("cdbzoxhoi")))), - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("uyygdoi", response.tags().get("d")); - Assertions.assertEquals(ViewChargesPolicy.OTHER, response.properties().viewCharges()); - Assertions.assertEquals("lbsnlfp", response.properties().policies().get(0).name()); - Assertions.assertEquals("jrh", response.properties().policies().get(0).value()); - Assertions.assertEquals(PolicyType.SYSTEM_CONTROLLED, response.properties().policies().get(0).policyType()); - Assertions.assertEquals("orhwuujymyjvkoy", response.properties().policies().get(0).scope()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesGetByBillingAccountWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesGetByBillingAccountWithResponseMockTests.java deleted file mode 100644 index c1af8a190ef0..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesGetByBillingAccountWithResponseMockTests.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingAccountPolicy; -import com.azure.resourcemanager.billing.models.EnrollmentAccountOwnerViewCharges; -import com.azure.resourcemanager.billing.models.EnrollmentAuthLevelState; -import com.azure.resourcemanager.billing.models.EnrollmentDepartmentAdminViewCharges; -import com.azure.resourcemanager.billing.models.MarketplacePurchasesPolicy; -import com.azure.resourcemanager.billing.models.PolicyType; -import com.azure.resourcemanager.billing.models.ReservationPurchasesPolicy; -import com.azure.resourcemanager.billing.models.SavingsPlanPurchasesPolicy; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class PoliciesGetByBillingAccountWithResponseMockTests { - @Test - public void testGetByBillingAccountWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"ConfirmedBilling\",\"enterpriseAgreementPolicies\":{\"authenticationType\":\"Other\",\"accountOwnerViewCharges\":\"Disabled\",\"departmentAdminViewCharges\":\"Other\"},\"marketplacePurchases\":\"OnlyFreeAllowed\",\"reservationPurchases\":\"Other\",\"savingsPlanPurchases\":\"NotAllowed\",\"policies\":[{\"name\":\"gdfecju\",\"value\":\"yrwvo\",\"policyType\":\"UserControlled\",\"scope\":\"wxbaczypslfqgfwo\"},{\"name\":\"tgpeizuz\",\"value\":\"eouftcj\",\"policyType\":\"SystemControlled\",\"scope\":\"dfomscwlcfcpza\"},{\"name\":\"qbbfgmeqhtngrxfq\",\"value\":\"sewfbllegezvwuwi\",\"policyType\":\"SystemControlled\",\"scope\":\"ggjacmaz\"}]},\"tags\":{\"bzykmdklwbq\":\"gvmiproqp\",\"qqtmpgrzciltwedl\":\"mtwua\",\"lhyiohcjugduogg\":\"pnoeb\"},\"id\":\"zmy\",\"name\":\"guykrpzpmwz\",\"type\":\"lcrzdweb\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingAccountPolicy response = manager.policies() - .getByBillingAccountWithResponse("zrkhptyh", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("gvmiproqp", response.tags().get("bzykmdklwbq")); - Assertions.assertEquals(EnrollmentAuthLevelState.OTHER, - response.properties().enterpriseAgreementPolicies().authenticationType()); - Assertions.assertEquals(EnrollmentAccountOwnerViewCharges.DISABLED, - response.properties().enterpriseAgreementPolicies().accountOwnerViewCharges()); - Assertions.assertEquals(EnrollmentDepartmentAdminViewCharges.OTHER, - response.properties().enterpriseAgreementPolicies().departmentAdminViewCharges()); - Assertions.assertEquals(MarketplacePurchasesPolicy.ONLY_FREE_ALLOWED, - response.properties().marketplacePurchases()); - Assertions.assertEquals(ReservationPurchasesPolicy.OTHER, response.properties().reservationPurchases()); - Assertions.assertEquals(SavingsPlanPurchasesPolicy.NOT_ALLOWED, response.properties().savingsPlanPurchases()); - Assertions.assertEquals("gdfecju", response.properties().policies().get(0).name()); - Assertions.assertEquals("yrwvo", response.properties().policies().get(0).value()); - Assertions.assertEquals(PolicyType.USER_CONTROLLED, response.properties().policies().get(0).policyType()); - Assertions.assertEquals("wxbaczypslfqgfwo", response.properties().policies().get(0).scope()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesGetByBillingProfileWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesGetByBillingProfileWithResponseMockTests.java deleted file mode 100644 index 7784cd2822ba..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesGetByBillingProfileWithResponseMockTests.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.BillingProfilePolicy; -import com.azure.resourcemanager.billing.models.EnrollmentAccountOwnerViewCharges; -import com.azure.resourcemanager.billing.models.EnrollmentAuthLevelState; -import com.azure.resourcemanager.billing.models.EnrollmentDepartmentAdminViewCharges; -import com.azure.resourcemanager.billing.models.InvoiceSectionLabelManagementPolicy; -import com.azure.resourcemanager.billing.models.MarketplacePurchasesPolicy; -import com.azure.resourcemanager.billing.models.PolicyType; -import com.azure.resourcemanager.billing.models.ReservationPurchasesPolicy; -import com.azure.resourcemanager.billing.models.SavingsPlanPurchasesPolicy; -import com.azure.resourcemanager.billing.models.ViewChargesPolicy; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class PoliciesGetByBillingProfileWithResponseMockTests { - @Test - public void testGetByBillingProfileWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Pending\",\"enterpriseAgreementPolicies\":{\"authenticationType\":\"OrganizationalAccountOnly\",\"accountOwnerViewCharges\":\"NotAllowed\",\"departmentAdminViewCharges\":\"Allowed\"},\"invoiceSectionLabelManagement\":\"Allowed\",\"marketplacePurchases\":\"AllAllowed\",\"reservationPurchases\":\"Allowed\",\"savingsPlanPurchases\":\"Disabled\",\"viewCharges\":\"NotAllowed\",\"policies\":[{\"name\":\"fxbiqwgm\",\"value\":\"nwaofnoiphw\",\"policyType\":\"Other\",\"scope\":\"ugxjtuhidjws\"}]},\"tags\":{\"vtymncwjdmjdph\":\"cqenyjwadvfq\",\"jrbnzbemr\":\"f\"},\"id\":\"fimageiqjneprhx\",\"name\":\"ktusrpjmevszbj\",\"type\":\"qktokc\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - BillingProfilePolicy response = manager.policies() - .getByBillingProfileWithResponse("hsfgaxuvaej", "af", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("cqenyjwadvfq", response.tags().get("vtymncwjdmjdph")); - Assertions.assertEquals(EnrollmentAuthLevelState.ORGANIZATIONAL_ACCOUNT_ONLY, - response.properties().enterpriseAgreementPolicies().authenticationType()); - Assertions.assertEquals(EnrollmentAccountOwnerViewCharges.NOT_ALLOWED, - response.properties().enterpriseAgreementPolicies().accountOwnerViewCharges()); - Assertions.assertEquals(EnrollmentDepartmentAdminViewCharges.ALLOWED, - response.properties().enterpriseAgreementPolicies().departmentAdminViewCharges()); - Assertions.assertEquals(InvoiceSectionLabelManagementPolicy.ALLOWED, - response.properties().invoiceSectionLabelManagement()); - Assertions.assertEquals(MarketplacePurchasesPolicy.ALL_ALLOWED, response.properties().marketplacePurchases()); - Assertions.assertEquals(ReservationPurchasesPolicy.ALLOWED, response.properties().reservationPurchases()); - Assertions.assertEquals(SavingsPlanPurchasesPolicy.DISABLED, response.properties().savingsPlanPurchases()); - Assertions.assertEquals(ViewChargesPolicy.NOT_ALLOWED, response.properties().viewCharges()); - Assertions.assertEquals("fxbiqwgm", response.properties().policies().get(0).name()); - Assertions.assertEquals("nwaofnoiphw", response.properties().policies().get(0).value()); - Assertions.assertEquals(PolicyType.OTHER, response.properties().policies().get(0).policyType()); - Assertions.assertEquals("ugxjtuhidjws", response.properties().policies().get(0).scope()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesGetByCustomerAtBillingAccountWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesGetByCustomerAtBillingAccountWithResponseMockTests.java deleted file mode 100644 index 299d699d0179..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesGetByCustomerAtBillingAccountWithResponseMockTests.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.CustomerPolicy; -import com.azure.resourcemanager.billing.models.PolicyType; -import com.azure.resourcemanager.billing.models.ViewChargesPolicy; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class PoliciesGetByCustomerAtBillingAccountWithResponseMockTests { - @Test - public void testGetByCustomerAtBillingAccountWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Canceled\",\"viewCharges\":\"NotAllowed\",\"policies\":[{\"name\":\"qmfwiesh\",\"value\":\"e\",\"policyType\":\"UserControlled\",\"scope\":\"m\"},{\"name\":\"gudvytecuvejlcw\",\"value\":\"ekkjvr\",\"policyType\":\"UserControlled\",\"scope\":\"hoehyir\"},{\"name\":\"redo\",\"value\":\"vqpblqubfpeom\",\"policyType\":\"SystemControlled\",\"scope\":\"heamzlqv\"}]},\"tags\":{\"sythuioixpfgqlw\":\"tsvc\",\"ehuweuitqe\":\"ojwvvqcjrmnverbf\"},\"id\":\"nm\",\"name\":\"igawlojwvrovjvj\",\"type\":\"uypcnbucbejmu\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - CustomerPolicy response = manager.policies() - .getByCustomerAtBillingAccountWithResponse("bsibzmvd", "yoe", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("tsvc", response.tags().get("sythuioixpfgqlw")); - Assertions.assertEquals(ViewChargesPolicy.NOT_ALLOWED, response.properties().viewCharges()); - Assertions.assertEquals("qmfwiesh", response.properties().policies().get(0).name()); - Assertions.assertEquals("e", response.properties().policies().get(0).value()); - Assertions.assertEquals(PolicyType.USER_CONTROLLED, response.properties().policies().get(0).policyType()); - Assertions.assertEquals("m", response.properties().policies().get(0).scope()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesGetByCustomerWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesGetByCustomerWithResponseMockTests.java deleted file mode 100644 index 3a130e9c7d14..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesGetByCustomerWithResponseMockTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.CustomerPolicy; -import com.azure.resourcemanager.billing.models.PolicyType; -import com.azure.resourcemanager.billing.models.ServiceDefinedResourceName; -import com.azure.resourcemanager.billing.models.ViewChargesPolicy; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class PoliciesGetByCustomerWithResponseMockTests { - @Test - public void testGetByCustomerWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Failed\",\"viewCharges\":\"Other\",\"policies\":[{\"name\":\"u\",\"value\":\"fsfruenqfnzwy\",\"policyType\":\"UserControlled\",\"scope\":\"larnupp\"}]},\"tags\":{\"zxoyanlhjeuewa\":\"fepsoz\"},\"id\":\"xkvruryyqyt\",\"name\":\"qjhokhij\",\"type\":\"hpvjqpxkikdatb\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - CustomerPolicy response = manager.policies() - .getByCustomerWithResponse("jqjjt", "vdzytsdlpbkor", "u", ServiceDefinedResourceName.DEFAULT, - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("fepsoz", response.tags().get("zxoyanlhjeuewa")); - Assertions.assertEquals(ViewChargesPolicy.OTHER, response.properties().viewCharges()); - Assertions.assertEquals("u", response.properties().policies().get(0).name()); - Assertions.assertEquals("fsfruenqfnzwy", response.properties().policies().get(0).value()); - Assertions.assertEquals(PolicyType.USER_CONTROLLED, response.properties().policies().get(0).policyType()); - Assertions.assertEquals("larnupp", response.properties().policies().get(0).scope()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesGetBySubscriptionWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesGetBySubscriptionWithResponseMockTests.java deleted file mode 100644 index a2a265cb86d1..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PoliciesGetBySubscriptionWithResponseMockTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.PolicyType; -import com.azure.resourcemanager.billing.models.SubscriptionPolicy; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class PoliciesGetBySubscriptionWithResponseMockTests { - @Test - public void testGetBySubscriptionWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"provisioningState\":\"Pending\",\"policies\":[{\"name\":\"zdb\",\"value\":\"kdsbekvprkwpvxie\",\"policyType\":\"UserControlled\",\"scope\":\"gzshfa\"},{\"name\":\"e\",\"value\":\"aeiuex\",\"policyType\":\"SystemControlled\",\"scope\":\"mwdw\"},{\"name\":\"aeplpfre\",\"value\":\"izk\",\"policyType\":\"Other\",\"scope\":\"dl\"}]},\"tags\":{\"jsoxuuwuungdvv\":\"aobsgpdbhbdx\",\"inlgttvon\":\"drcpqu\",\"mitmtkcqixgqxs\":\"rpeli\"},\"id\":\"ev\",\"name\":\"huvupdsafqaghw\",\"type\":\"umecqyia\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - SubscriptionPolicy response - = manager.policies().getBySubscriptionWithResponse(com.azure.core.util.Context.NONE).getValue(); - - Assertions.assertEquals("aobsgpdbhbdx", response.tags().get("jsoxuuwuungdvv")); - Assertions.assertEquals("zdb", response.properties().policies().get(0).name()); - Assertions.assertEquals("kdsbekvprkwpvxie", response.properties().policies().get(0).value()); - Assertions.assertEquals(PolicyType.USER_CONTROLLED, response.properties().policies().get(0).policyType()); - Assertions.assertEquals("gzshfa", response.properties().policies().get(0).scope()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PolicySummaryTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PolicySummaryTests.java deleted file mode 100644 index 4c1245844774..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PolicySummaryTests.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.PolicySummary; -import com.azure.resourcemanager.billing.models.PolicyType; -import org.junit.jupiter.api.Assertions; - -public final class PolicySummaryTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - PolicySummary model = BinaryData - .fromString( - "{\"name\":\"mngqbe\",\"value\":\"gis\",\"policyType\":\"SystemControlled\",\"scope\":\"ykdidj\"}") - .toObject(PolicySummary.class); - Assertions.assertEquals("mngqbe", model.name()); - Assertions.assertEquals("gis", model.value()); - Assertions.assertEquals(PolicyType.SYSTEM_CONTROLLED, model.policyType()); - Assertions.assertEquals("ykdidj", model.scope()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - PolicySummary model = new PolicySummary().withName("mngqbe") - .withValue("gis") - .withPolicyType(PolicyType.SYSTEM_CONTROLLED) - .withScope("ykdidj"); - model = BinaryData.fromObject(model).toObject(PolicySummary.class); - Assertions.assertEquals("mngqbe", model.name()); - Assertions.assertEquals("gis", model.value()); - Assertions.assertEquals(PolicyType.SYSTEM_CONTROLLED, model.policyType()); - Assertions.assertEquals("ykdidj", model.scope()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PrincipalTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PrincipalTests.java deleted file mode 100644 index 05502e96d9b7..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/PrincipalTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.Principal; -import org.junit.jupiter.api.Assertions; - -public final class PrincipalTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Principal model - = BinaryData.fromString("{\"tenantId\":\"y\",\"objectId\":\"nyowxwlmdjrkvfg\",\"upn\":\"fvpdbo\"}") - .toObject(Principal.class); - Assertions.assertEquals("y", model.tenantId()); - Assertions.assertEquals("nyowxwlmdjrkvfg", model.objectId()); - Assertions.assertEquals("fvpdbo", model.upn()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Principal model = new Principal().withTenantId("y").withObjectId("nyowxwlmdjrkvfg").withUpn("fvpdbo"); - model = BinaryData.fromObject(model).toObject(Principal.class); - Assertions.assertEquals("y", model.tenantId()); - Assertions.assertEquals("nyowxwlmdjrkvfg", model.objectId()); - Assertions.assertEquals("fvpdbo", model.upn()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductDetailsTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductDetailsTests.java deleted file mode 100644 index 86571b22fe04..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductDetailsTests.java +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.ProductDetails; -import com.azure.resourcemanager.billing.models.ProductType; -import org.junit.jupiter.api.Assertions; - -public final class ProductDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ProductDetails model = BinaryData.fromString("{\"productType\":\"Department\",\"productId\":\"vctsfaeuhw\"}") - .toObject(ProductDetails.class); - Assertions.assertEquals(ProductType.DEPARTMENT, model.productType()); - Assertions.assertEquals("vctsfaeuhw", model.productId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ProductDetails model = new ProductDetails().withProductType(ProductType.DEPARTMENT).withProductId("vctsfaeuhw"); - model = BinaryData.fromObject(model).toObject(ProductDetails.class); - Assertions.assertEquals(ProductType.DEPARTMENT, model.productType()); - Assertions.assertEquals("vctsfaeuhw", model.productId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductInnerTests.java deleted file mode 100644 index c09d2bdfb2d7..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductInnerTests.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.ProductInner; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.ProductProperties; -import com.azure.resourcemanager.billing.models.ProductPropertiesLastCharge; -import com.azure.resourcemanager.billing.models.ProductPropertiesReseller; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ProductInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ProductInner model = BinaryData.fromString( - "{\"properties\":{\"autoRenew\":\"On\",\"availabilityId\":\"tgfredmlscgrllc\",\"billingFrequency\":\"aovjow\",\"billingProfileId\":\"hpa\",\"billingProfileDisplayName\":\"comlyotgkwsx\",\"customerId\":\"rqorcgen\",\"customerDisplayName\":\"c\",\"displayName\":\"xeetq\",\"endDate\":\"xcxxqndcqjkedw\",\"invoiceSectionId\":\"rcgojmrvvx\",\"invoiceSectionDisplayName\":\"ongzsehqqrsil\",\"lastCharge\":{\"currency\":\"skx\",\"value\":60.94425},\"lastChargeDate\":\"sbvr\",\"productType\":\"qgvtojrulfu\",\"productTypeId\":\"ejrthcfjzhxlyub\",\"skuId\":\"rostvrjeqmtzz\",\"skuDescription\":\"qrztrxal\",\"purchaseDate\":\"d\",\"quantity\":5466164800327011659,\"status\":\"Deleted\",\"tenantId\":\"sn\",\"reseller\":{\"resellerId\":\"qatiwkkvyanxkvvc\",\"description\":\"msvuvdjkqxetq\"}},\"tags\":{\"p\":\"ivrjjxnwxdc\",\"gfquwz\":\"jxlehzlx\",\"ibelwcerwkw\":\"w\"},\"id\":\"jxljtxbusq\",\"name\":\"bxxn\",\"type\":\"uisdzhgbdgz\"}") - .toObject(ProductInner.class); - Assertions.assertEquals("ivrjjxnwxdc", model.tags().get("p")); - Assertions.assertEquals(AutoRenew.ON, model.properties().autoRenew()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ProductInner model - = new ProductInner().withTags(mapOf("p", "ivrjjxnwxdc", "gfquwz", "jxlehzlx", "ibelwcerwkw", "w")) - .withProperties(new ProductProperties().withAutoRenew(AutoRenew.ON) - .withLastCharge(new ProductPropertiesLastCharge()) - .withReseller(new ProductPropertiesReseller())); - model = BinaryData.fromObject(model).toObject(ProductInner.class); - Assertions.assertEquals("ivrjjxnwxdc", model.tags().get("p")); - Assertions.assertEquals(AutoRenew.ON, model.properties().autoRenew()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductListResultTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductListResultTests.java deleted file mode 100644 index f567e41d4495..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductListResultTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.ProductListResult; - -public final class ProductListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ProductListResult model = BinaryData.fromString( - "{\"nextLink\":\"usrexxf\",\"value\":[{\"properties\":{\"autoRenew\":\"Off\",\"availabilityId\":\"ohzilfmnli\",\"billingFrequency\":\"simsfeypofqpmb\",\"billingProfileId\":\"qgsdr\",\"billingProfileDisplayName\":\"ttjxophgerhsmvgo\",\"customerId\":\"wzm\",\"customerDisplayName\":\"lrixysfnimsq\",\"displayName\":\"wwmhkruwae\",\"endDate\":\"ympmlqoin\",\"invoiceSectionId\":\"duewihapfj\",\"invoiceSectionDisplayName\":\"knjdiqfliejhp\",\"lastCharge\":{\"currency\":\"iedfsbwcei\",\"value\":55.95591},\"lastChargeDate\":\"ipbwxgooo\",\"productType\":\"pradmskxknpdgzi\",\"productTypeId\":\"sugswhgsaod\",\"skuId\":\"wnbaf\",\"skuDescription\":\"to\",\"purchaseDate\":\"haquvwsxbgnvk\",\"quantity\":1214153250247560534,\"status\":\"Canceled\",\"tenantId\":\"adhrsxqvzvspa\",\"reseller\":{\"resellerId\":\"r\",\"description\":\"ajglzrsubklr\"}},\"tags\":{\"jdvqy\":\"nltce\",\"qkwaruwd\":\"ie\",\"xbibanbaupw\":\"vqzxoebwg\",\"lssan\":\"zvpaklozkxbzrpej\"},\"id\":\"ttkgsux\",\"name\":\"nrswgkpjhboyik\",\"type\":\"bhuhk\"},{\"properties\":{\"autoRenew\":\"On\",\"availabilityId\":\"okhu\",\"billingFrequency\":\"ijyzcqypzqzufgsy\",\"billingProfileId\":\"jyvdwtfxptpqayam\",\"billingProfileDisplayName\":\"cf\",\"customerId\":\"bmxsnxoc\",\"customerDisplayName\":\"llojkpoyhgwwdj\",\"displayName\":\"dbdljz\",\"endDate\":\"yrcvuqbsgzlrq\",\"invoiceSectionId\":\"jnqogdxwbsfpyx\",\"invoiceSectionDisplayName\":\"jlf\",\"lastCharge\":{\"currency\":\"ominxojjlu\",\"value\":55.413414},\"lastChargeDate\":\"ilz\",\"productType\":\"zzqjmu\",\"productTypeId\":\"ay\",\"skuId\":\"ribqlotokh\",\"skuDescription\":\"wtaznkcqw\",\"purchaseDate\":\"wjyofgwhnkbtl\",\"quantity\":6715067531103732186,\"status\":\"Disabled\",\"tenantId\":\"tsnld\",\"reseller\":{\"resellerId\":\"olgisu\",\"description\":\"bteogfg\"}},\"tags\":{\"zfpxgnmqvzvluy\":\"jrykwlefksxqce\"},\"id\":\"aiossscyvaifp\",\"name\":\"uacvfy\",\"type\":\"owpsfxt\"},{\"properties\":{\"autoRenew\":\"Off\",\"availabilityId\":\"ymh\",\"billingFrequency\":\"tyqft\",\"billingProfileId\":\"hdpbo\",\"billingProfileDisplayName\":\"stkfvvdshxcdeds\",\"customerId\":\"nygnxcgjtfrnquk\",\"customerDisplayName\":\"fnslnlrxsmy\",\"displayName\":\"rwntfm\",\"endDate\":\"g\",\"invoiceSectionId\":\"dxwnazkurrd\",\"invoiceSectionDisplayName\":\"yzjwhsetwwjwzzq\",\"lastCharge\":{\"currency\":\"zuukykcyqhyqq\",\"value\":47.627968},\"lastChargeDate\":\"ykeys\",\"productType\":\"wfopazdazg\",\"productTypeId\":\"qgpewqcfutmdpvoz\",\"skuId\":\"qjbknl\",\"skuDescription\":\"lctzeyowmndcovd\",\"purchaseDate\":\"qauxzan\",\"quantity\":2013371764541224956,\"status\":\"Active\",\"tenantId\":\"wkudrbcpf\",\"reseller\":{\"resellerId\":\"dqyemebunaucm\",\"description\":\"rtneemmja\"}},\"tags\":{\"ohaitranizerwgud\":\"gxef\",\"ngfcocefhpriyl\":\"smxubvf\",\"culregpqt\":\"mpztraudsvhlc\",\"nvgyshqrdgrtwme\":\"ojhvrz\"},\"id\":\"zlpykcfazzwjcay\",\"name\":\"rzrr\",\"type\":\"nsyby\"},{\"properties\":{\"autoRenew\":\"Off\",\"availabilityId\":\"zrghsrleink\",\"billingFrequency\":\"cjfncjwvuagfq\",\"billingProfileId\":\"ltngvmreupt\",\"billingProfileDisplayName\":\"lzmijajwolxfsv\",\"customerId\":\"h\",\"customerDisplayName\":\"ynwlslrcigtzjcv\",\"displayName\":\"qlapsnsso\",\"endDate\":\"xpavid\",\"invoiceSectionId\":\"ev\",\"invoiceSectionDisplayName\":\"fcvvy\",\"lastCharge\":{\"currency\":\"lpuxgcbdsvalpnpt\",\"value\":95.14251},\"lastChargeDate\":\"xgpazwugxyqv\",\"productType\":\"obfelhldiuhz\",\"productTypeId\":\"qlmfaewz\",\"skuId\":\"udjpxpqht\",\"skuDescription\":\"hnmhkrezsdsux\",\"purchaseDate\":\"qdgcrux\",\"quantity\":6604275681694306509,\"status\":\"Expired\",\"tenantId\":\"qgwokmikp\",\"reseller\":{\"resellerId\":\"bmjxuvjipf\",\"description\":\"haxd\"}},\"tags\":{\"pphthdklmvetatla\":\"ae\",\"oxrpogw\":\"fqoixwgiksbbvt\",\"cihmbfntumeezbxv\":\"hchgjtnhtukf\"},\"id\":\"bnuvwcg\",\"name\":\"sgomtmjz\",\"type\":\"xuqgovsxpwwztj\"}]}") - .toObject(ProductListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ProductListResult model = new ProductListResult(); - model = BinaryData.fromObject(model).toObject(ProductListResult.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductPatchTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductPatchTests.java deleted file mode 100644 index 2f74214f1b8a..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductPatchTests.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.ProductPatch; -import com.azure.resourcemanager.billing.models.ProductProperties; -import com.azure.resourcemanager.billing.models.ProductPropertiesLastCharge; -import com.azure.resourcemanager.billing.models.ProductPropertiesReseller; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ProductPatchTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ProductPatch model = BinaryData.fromString( - "{\"properties\":{\"autoRenew\":\"Off\",\"availabilityId\":\"tjoxztfw\",\"billingFrequency\":\"chvczev\",\"billingProfileId\":\"nctagfyvrtpqpem\",\"billingProfileDisplayName\":\"cgkrepdqhqy\",\"customerId\":\"qwemvxqabckmzeo\",\"customerDisplayName\":\"nhgr\",\"displayName\":\"h\",\"endDate\":\"h\",\"invoiceSectionId\":\"uz\",\"invoiceSectionDisplayName\":\"ceezn\",\"lastCharge\":{\"currency\":\"gprbfaxyx\",\"value\":22.899992},\"lastChargeDate\":\"iphmsexroqrn\",\"productType\":\"txfvonfe\",\"productTypeId\":\"gpkrie\",\"skuId\":\"gnixxowwzkyfwnw\",\"skuDescription\":\"wxeiicrmpepk\",\"purchaseDate\":\"maxxijvskwsdgkjg\",\"quantity\":6518986112008740765,\"status\":\"Suspended\",\"tenantId\":\"ekwefcvoinw\",\"reseller\":{\"resellerId\":\"rtwy\",\"description\":\"i\"}},\"tags\":{\"bym\":\"dvatdavuqm\",\"mvpsimioyo\":\"fobjlquvjezcj\",\"clibbfqpsp\":\"glkmiqwnnr\",\"exzgpmnmabedd\":\"ladydgnhautwu\"},\"id\":\"lwgdfpfqfpcvs\",\"name\":\"clg\",\"type\":\"rvwerfwxbsmtb\"}") - .toObject(ProductPatch.class); - Assertions.assertEquals("dvatdavuqm", model.tags().get("bym")); - Assertions.assertEquals(AutoRenew.OFF, model.properties().autoRenew()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ProductPatch model = new ProductPatch() - .withTags(mapOf("bym", "dvatdavuqm", "mvpsimioyo", "fobjlquvjezcj", "clibbfqpsp", "glkmiqwnnr", - "exzgpmnmabedd", "ladydgnhautwu")) - .withProperties(new ProductProperties().withAutoRenew(AutoRenew.OFF) - .withLastCharge(new ProductPropertiesLastCharge()) - .withReseller(new ProductPropertiesReseller())); - model = BinaryData.fromObject(model).toObject(ProductPatch.class); - Assertions.assertEquals("dvatdavuqm", model.tags().get("bym")); - Assertions.assertEquals(AutoRenew.OFF, model.properties().autoRenew()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductPropertiesLastChargeTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductPropertiesLastChargeTests.java deleted file mode 100644 index 5d92b4716961..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductPropertiesLastChargeTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.ProductPropertiesLastCharge; - -public final class ProductPropertiesLastChargeTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ProductPropertiesLastCharge model = BinaryData.fromString("{\"currency\":\"lobvv\",\"value\":19.954985}") - .toObject(ProductPropertiesLastCharge.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ProductPropertiesLastCharge model = new ProductPropertiesLastCharge(); - model = BinaryData.fromObject(model).toObject(ProductPropertiesLastCharge.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductPropertiesResellerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductPropertiesResellerTests.java deleted file mode 100644 index 5b2459800944..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductPropertiesResellerTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.ProductPropertiesReseller; - -public final class ProductPropertiesResellerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ProductPropertiesReseller model = BinaryData.fromString("{\"resellerId\":\"hdiqayfl\",\"description\":\"yu\"}") - .toObject(ProductPropertiesReseller.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ProductPropertiesReseller model = new ProductPropertiesReseller(); - model = BinaryData.fromObject(model).toObject(ProductPropertiesReseller.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductPropertiesTests.java deleted file mode 100644 index 0c324836a8ea..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductPropertiesTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.ProductProperties; -import com.azure.resourcemanager.billing.models.ProductPropertiesLastCharge; -import com.azure.resourcemanager.billing.models.ProductPropertiesReseller; -import org.junit.jupiter.api.Assertions; - -public final class ProductPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ProductProperties model = BinaryData.fromString( - "{\"autoRenew\":\"On\",\"availabilityId\":\"ecnad\",\"billingFrequency\":\"wqrgxfllmqi\",\"billingProfileId\":\"ezoell\",\"billingProfileDisplayName\":\"kiiwvmtu\",\"customerId\":\"pymdjfuax\",\"customerDisplayName\":\"qvqpilrg\",\"displayName\":\"canlduwzorxs\",\"endDate\":\"x\",\"invoiceSectionId\":\"klxymxkqvfqepdxc\",\"invoiceSectionDisplayName\":\"uubwyvpjb\",\"lastCharge\":{\"currency\":\"pjqduqgix\",\"value\":99.45866},\"lastChargeDate\":\"dfbwljav\",\"productType\":\"erkjddv\",\"productTypeId\":\"liegftcvbi\",\"skuId\":\"tksdwgdnkefgmw\",\"skuDescription\":\"c\",\"purchaseDate\":\"uvczldbgl\",\"quantity\":1021873909266464669,\"status\":\"Suspended\",\"tenantId\":\"qgz\",\"reseller\":{\"resellerId\":\"jclyzgsnor\",\"description\":\"gmnzjotvmrx\"}}") - .toObject(ProductProperties.class); - Assertions.assertEquals(AutoRenew.ON, model.autoRenew()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ProductProperties model = new ProductProperties().withAutoRenew(AutoRenew.ON) - .withLastCharge(new ProductPropertiesLastCharge()) - .withReseller(new ProductPropertiesReseller()); - model = BinaryData.fromObject(model).toObject(ProductProperties.class); - Assertions.assertEquals(AutoRenew.ON, model.autoRenew()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsGetWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsGetWithResponseMockTests.java deleted file mode 100644 index b9ff9dff029f..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsGetWithResponseMockTests.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.Product; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProductsGetWithResponseMockTests { - @Test - public void testGetWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"autoRenew\":\"On\",\"availabilityId\":\"hwsrmegphwjy\",\"billingFrequency\":\"jdhlqtqjabw\",\"billingProfileId\":\"pjy\",\"billingProfileDisplayName\":\"qyirupsuyq\",\"customerId\":\"xnavxzpyaptex\",\"customerDisplayName\":\"lqhewhcchexc\",\"displayName\":\"my\",\"endDate\":\"wggmitdwolfmfaz\",\"invoiceSectionId\":\"cai\",\"invoiceSectionDisplayName\":\"pjttzfswohd\",\"lastCharge\":{\"currency\":\"ikkosqpliegemtn\",\"value\":28.761084},\"lastChargeDate\":\"uukydi\",\"productType\":\"ncr\",\"productTypeId\":\"tlrbzqtu\",\"skuId\":\"ajfay\",\"skuDescription\":\"ohdlpcix\",\"purchaseDate\":\"xnyhivhyujqxyfb\",\"quantity\":3145621458887697919,\"status\":\"Expiring\",\"tenantId\":\"abrdnovu\",\"reseller\":{\"resellerId\":\"wjohgcnrkmcivhww\",\"description\":\"ejh\"}},\"tags\":{\"cfqa\":\"fcfyzwkmrjfsq\",\"pasxwiic\":\"oveqowqodi\",\"x\":\"sbjhhadndow\"},\"id\":\"wsaxpbieehpvq\",\"name\":\"i\",\"type\":\"rrjprygjgyovc\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Product response = manager.products() - .getWithResponse("argbmemopypc", "omowucjznnowp", com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("fcfyzwkmrjfsq", response.tags().get("cfqa")); - Assertions.assertEquals(AutoRenew.ON, response.properties().autoRenew()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsListByBillingAccountMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsListByBillingAccountMockTests.java deleted file mode 100644 index 5d1bb2d3ba6e..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsListByBillingAccountMockTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.Product; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProductsListByBillingAccountMockTests { - @Test - public void testListByBillingAccount() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"autoRenew\":\"Off\",\"availabilityId\":\"jjqztrpjmeip\",\"billingFrequency\":\"taaq\",\"billingProfileId\":\"k\",\"billingProfileDisplayName\":\"abco\",\"customerId\":\"aavjk\",\"customerDisplayName\":\"pqasv\",\"displayName\":\"sbvolivianklqclf\",\"endDate\":\"neouxpdnlbp\",\"invoiceSectionId\":\"ckohn\",\"invoiceSectionDisplayName\":\"aqzekggurwxf\",\"lastCharge\":{\"currency\":\"ghwfiy\",\"value\":33.978844},\"lastChargeDate\":\"grzfs\",\"productType\":\"lookwnz\",\"productTypeId\":\"jb\",\"skuId\":\"uidlodcqsylkk\",\"skuDescription\":\"m\",\"purchaseDate\":\"wel\",\"quantity\":9168248383339814161,\"status\":\"Expired\",\"tenantId\":\"mcmnsmn\",\"reseller\":{\"resellerId\":\"x\",\"description\":\"hlbibwodayi\"}},\"tags\":{\"byoxpvbv\":\"hkioec\",\"okzdshhhdixn\":\"chfuxuqpdde\",\"ywspajakjhv\":\"apzibmstvzzkzv\"},\"id\":\"tbnmhxtmzzpau\",\"name\":\"srvsbkn\",\"type\":\"ouytsajjgvu\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.products() - .listByBillingAccount("feugcwtsztxoswv", "rymqqfksqfcxdle", "hysdg", 7245214005145934559L, - 7922566269976853390L, true, "wvtkrqi", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("hkioec", response.iterator().next().tags().get("byoxpvbv")); - Assertions.assertEquals(AutoRenew.OFF, response.iterator().next().properties().autoRenew()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsListByBillingProfileMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsListByBillingProfileMockTests.java deleted file mode 100644 index cc4588efee05..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsListByBillingProfileMockTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.Product; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProductsListByBillingProfileMockTests { - @Test - public void testListByBillingProfile() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"autoRenew\":\"On\",\"availabilityId\":\"ruskmbq\",\"billingFrequency\":\"ecnsqeewfuwgmk\",\"billingProfileId\":\"yazibhw\",\"billingProfileDisplayName\":\"wmebmx\",\"customerId\":\"cfd\",\"customerDisplayName\":\"kurppwksixh\",\"displayName\":\"nvydxjkdsqe\",\"endDate\":\"jd\",\"invoiceSectionId\":\"tiqwixsdxxflwfv\",\"invoiceSectionDisplayName\":\"bwhrguqetvbqh\",\"lastCharge\":{\"currency\":\"flzj\",\"value\":74.232},\"lastChargeDate\":\"wxlggrtpayfk\",\"productType\":\"gshbkdpt\",\"productTypeId\":\"sqznv\",\"skuId\":\"jtrashnfofi\",\"skuDescription\":\"loeq\",\"purchaseDate\":\"cpqboubeh\",\"quantity\":4610656788817968838,\"status\":\"Other\",\"tenantId\":\"suuvo\",\"reseller\":{\"resellerId\":\"eoinxko\",\"description\":\"rnlgnwwjikg\"}},\"tags\":{\"pjnhhiofcnyzqz\":\"czzkzi\",\"cemagsyljww\":\"lddngqwmlleg\"},\"id\":\"qh\",\"name\":\"hlajmikqvnrj\",\"type\":\"jopbgtzrgyrldoa\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.products() - .listByBillingProfile("ueksvjtgpy", "atl", "si", "xqmmxjdk", 3998494545207100937L, 7056514834670945245L, - true, "lfgow", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("czzkzi", response.iterator().next().tags().get("pjnhhiofcnyzqz")); - Assertions.assertEquals(AutoRenew.ON, response.iterator().next().properties().autoRenew()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsListByCustomerMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsListByCustomerMockTests.java deleted file mode 100644 index 82e755542c1d..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsListByCustomerMockTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.Product; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProductsListByCustomerMockTests { - @Test - public void testListByCustomer() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"autoRenew\":\"On\",\"availabilityId\":\"tg\",\"billingFrequency\":\"tcplxidiuxzzhl\",\"billingProfileId\":\"xv\",\"billingProfileDisplayName\":\"puw\",\"customerId\":\"f\",\"customerDisplayName\":\"wvrbbpgibyzrpqeh\",\"displayName\":\"ldvxcjjhjnpa\",\"endDate\":\"zfy\",\"invoiceSectionId\":\"gklywdlxmyoqmam\",\"invoiceSectionDisplayName\":\"cqqtqzwntnly\",\"lastCharge\":{\"currency\":\"mdwi\",\"value\":35.370193},\"lastChargeDate\":\"cforgcufiphnr\",\"productType\":\"zz\",\"productTypeId\":\"nybfsoayatqkdzux\",\"skuId\":\"dzkvbe\",\"skuDescription\":\"jsaoggd\",\"purchaseDate\":\"jkoxlccjdooy\",\"quantity\":4188067949162425237,\"status\":\"Suspended\",\"tenantId\":\"zdjhqq\",\"reseller\":{\"resellerId\":\"idsbdftbxruuuy\",\"description\":\"rrrgjnqk\"}},\"tags\":{\"fittheax\":\"rwnpwgchlabtt\",\"acss\":\"yhflnlu\"},\"id\":\"llfukqurrtcfgq\",\"name\":\"cxyrsleghozsm\",\"type\":\"jsvymozryyyvlxm\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.products() - .listByCustomer("ldglz", "k", "ftjrederkvbdvl", "zkxaujj", 8285251286077676208L, 8252951728482713654L, true, - "dwrvffjpws", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("rwnpwgchlabtt", response.iterator().next().tags().get("fittheax")); - Assertions.assertEquals(AutoRenew.ON, response.iterator().next().properties().autoRenew()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsListByInvoiceSectionMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsListByInvoiceSectionMockTests.java deleted file mode 100644 index ff0fd68aeaef..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsListByInvoiceSectionMockTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.Product; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProductsListByInvoiceSectionMockTests { - @Test - public void testListByInvoiceSection() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"autoRenew\":\"On\",\"availabilityId\":\"vj\",\"billingFrequency\":\"wrvtflot\",\"billingProfileId\":\"zviswix\",\"billingProfileDisplayName\":\"nwznfxapylsllbd\",\"customerId\":\"wkpelyglfwmajll\",\"customerDisplayName\":\"bldhcfhw\",\"displayName\":\"thxnai\",\"endDate\":\"svr\",\"invoiceSectionId\":\"slylioguwsh\",\"invoiceSectionDisplayName\":\"cpbmyghq\",\"lastCharge\":{\"currency\":\"sbb\",\"value\":78.72579},\"lastChargeDate\":\"ztqrnreyjfmnrwee\",\"productType\":\"unjdclug\",\"productTypeId\":\"jfpsyqvgaaymfk\",\"skuId\":\"hiwmklj\",\"skuDescription\":\"gxcewz\",\"purchaseDate\":\"xz\",\"quantity\":3819250844731645650,\"status\":\"AutoRenew\",\"tenantId\":\"ttedzyzbvsjuths\",\"reseller\":{\"resellerId\":\"filnc\",\"description\":\"nkpxefmpzdwer\"}},\"tags\":{\"bfoi\":\"zxdlupgtptmnd\",\"sdxy\":\"vpglntnsiuxyitj\"},\"id\":\"rrllzxx\",\"name\":\"omhenqnovt\",\"type\":\"kobxvexusjfjuphj\"}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - PagedIterable response = manager.products() - .listByInvoiceSection("jmvvkodkqffhuxo", "qtgzvzcfmwfogjr", "mtbpnhjo", "lvfzwt", "rmp", - 4298151096087392704L, 6179884327864393416L, false, "esginpixhulf", com.azure.core.util.Context.NONE); - - Assertions.assertEquals("zxdlupgtptmnd", response.iterator().next().tags().get("bfoi")); - Assertions.assertEquals(AutoRenew.ON, response.iterator().next().properties().autoRenew()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsMoveMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsMoveMockTests.java deleted file mode 100644 index 8aa444d78613..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsMoveMockTests.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.MoveProductRequest; -import com.azure.resourcemanager.billing.models.Product; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProductsMoveMockTests { - @Test - public void testMove() throws Exception { - String responseStr - = "{\"properties\":{\"autoRenew\":\"Off\",\"availabilityId\":\"hgxsdo\",\"billingFrequency\":\"dfodokh\",\"billingProfileId\":\"g\",\"billingProfileDisplayName\":\"dhlnar\",\"customerId\":\"uoa\",\"customerDisplayName\":\"iriccuyqtjvrz\",\"displayName\":\"gmgfa\",\"endDate\":\"b\",\"invoiceSectionId\":\"aenvpzd\",\"invoiceSectionDisplayName\":\"pizgaujvc\",\"lastCharge\":{\"currency\":\"ybxorrceomsqar\",\"value\":38.995117},\"lastChargeDate\":\"dno\",\"productType\":\"ijpjiudnustbmox\",\"productTypeId\":\"gkdnhbhuepu\",\"skuId\":\"l\",\"skuDescription\":\"qzjvfrhyxl\",\"purchaseDate\":\"yousqmernbjp\",\"quantity\":1446144916392991800,\"status\":\"Canceled\",\"tenantId\":\"ouwmjxhmkchjdxr\",\"reseller\":{\"resellerId\":\"ukxuqhyrbeqpgad\",\"description\":\"nesgnxdvgxtefv\"}},\"tags\":{\"bzjyzajdpbnbpzxn\":\"toqcezmznoejqduy\",\"xi\":\"pryutxasnigh\",\"zqheit\":\"hiihg\",\"udzntbzgugwhk\":\"ymip\"},\"id\":\"p\",\"name\":\"qnxpo\",\"type\":\"crkm\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Product response = manager.products() - .move("pjqaf", "xvqquazoblxxkspu", new MoveProductRequest().withDestinationInvoiceSectionId("i"), - com.azure.core.util.Context.NONE); - - Assertions.assertEquals("toqcezmznoejqduy", response.tags().get("bzjyzajdpbnbpzxn")); - Assertions.assertEquals(AutoRenew.OFF, response.properties().autoRenew()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsUpdateWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsUpdateWithResponseMockTests.java deleted file mode 100644 index daab4741c355..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProductsUpdateWithResponseMockTests.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AutoRenew; -import com.azure.resourcemanager.billing.models.Product; -import com.azure.resourcemanager.billing.models.ProductPatch; -import com.azure.resourcemanager.billing.models.ProductProperties; -import com.azure.resourcemanager.billing.models.ProductPropertiesLastCharge; -import com.azure.resourcemanager.billing.models.ProductPropertiesReseller; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class ProductsUpdateWithResponseMockTests { - @Test - public void testUpdateWithResponse() throws Exception { - String responseStr - = "{\"properties\":{\"autoRenew\":\"Off\",\"availabilityId\":\"uuwd\",\"billingFrequency\":\"qahlby\",\"billingProfileId\":\"hb\",\"billingProfileDisplayName\":\"tlmacbwmvp\",\"customerId\":\"jyzicel\",\"customerDisplayName\":\"azcgwnibnduqgji\",\"displayName\":\"xxiao\",\"endDate\":\"wu\",\"invoiceSectionId\":\"m\",\"invoiceSectionDisplayName\":\"spugnv\",\"lastCharge\":{\"currency\":\"wadudokoxqbozezx\",\"value\":36.251335},\"lastChargeDate\":\"rgukqobo\",\"productType\":\"ll\",\"productTypeId\":\"lqufkrnrbnjkcol\",\"skuId\":\"qlyputawdmd\",\"skuDescription\":\"ufzqvv\",\"purchaseDate\":\"jzofyldxkzhvfo\",\"quantity\":1830501166525434226,\"status\":\"Expiring\",\"tenantId\":\"buiywky\",\"reseller\":{\"resellerId\":\"acbeauvldbd\",\"description\":\"guifqjtoxzxbljpz\"}},\"tags\":{\"aii\":\"gdarfumit\",\"wbgmjrvrsq\":\"mokfdybv\",\"cttvxkxgffpvv\":\"jcozrwry\"},\"id\":\"vvnxoqaaq\",\"name\":\"b\",\"type\":\"wqwwte\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - Product response = manager.products() - .updateWithResponse("gqiismaggkt", "oykrbk", - new ProductPatch().withTags(mapOf("oorw", "mdgffvxni", "pcxljzzcdrgtuaoo", "dtjpsjw")) - .withProperties(new ProductProperties().withAutoRenew(AutoRenew.OFF) - .withLastCharge(new ProductPropertiesLastCharge()) - .withReseller(new ProductPropertiesReseller())), - com.azure.core.util.Context.NONE) - .getValue(); - - Assertions.assertEquals("gdarfumit", response.tags().get("aii")); - Assertions.assertEquals(AutoRenew.OFF, response.properties().autoRenew()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProxyResourceWithTagsTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProxyResourceWithTagsTests.java deleted file mode 100644 index 1b7b93195253..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ProxyResourceWithTagsTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.ProxyResourceWithTags; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class ProxyResourceWithTagsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ProxyResourceWithTags model = BinaryData.fromString( - "{\"tags\":{\"un\":\"tusivyevcciqihn\"},\"id\":\"wjzrnfygxgisp\",\"name\":\"mvtzfkufub\",\"type\":\"jofxqe\"}") - .toObject(ProxyResourceWithTags.class); - Assertions.assertEquals("tusivyevcciqihn", model.tags().get("un")); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ProxyResourceWithTags model = new ProxyResourceWithTags().withTags(mapOf("un", "tusivyevcciqihn")); - model = BinaryData.fromObject(model).toObject(ProxyResourceWithTags.class); - Assertions.assertEquals("tusivyevcciqihn", model.tags().get("un")); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RebillDetailsTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RebillDetailsTests.java deleted file mode 100644 index 18fed005ca92..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RebillDetailsTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.RebillDetails; - -public final class RebillDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RebillDetails model = BinaryData.fromString( - "{\"invoiceDocumentId\":\"ktyjmf\",\"creditNoteDocumentId\":\"l\",\"rebillDetails\":{\"invoiceDocumentId\":\"qkfrbzgowoxqmj\",\"creditNoteDocumentId\":\"jcx\",\"rebillDetails\":{\"invoiceDocumentId\":\"gxhlusr\",\"creditNoteDocumentId\":\"i\",\"rebillDetails\":{\"invoiceDocumentId\":\"jceagb\",\"creditNoteDocumentId\":\"vl\",\"rebillDetails\":{\"invoiceDocumentId\":\"ywzash\",\"creditNoteDocumentId\":\"onoyjf\",\"rebillDetails\":{\"invoiceDocumentId\":\"ubyzn\",\"creditNoteDocumentId\":\"k\",\"rebillDetails\":{}}}}}}}") - .toObject(RebillDetails.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RebillDetails model = new RebillDetails(); - model = BinaryData.fromObject(model).toObject(RebillDetails.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RecipientTransferDetailsListResultTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RecipientTransferDetailsListResultTests.java deleted file mode 100644 index d2984ba8bc7c..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RecipientTransferDetailsListResultTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.RecipientTransferDetailsListResult; - -public final class RecipientTransferDetailsListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RecipientTransferDetailsListResult model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"expirationTime\":\"2021-01-28T20:13:35Z\",\"allowedProductType\":[\"AzureReservation\",\"StandardAzureSubscription\"],\"transferStatus\":\"Completed\",\"recipientEmailId\":\"dvrgptqmawzjdrp\",\"initiatorEmailId\":\"fu\",\"resellerId\":\"yctsdbtqgkuj\",\"resellerName\":\"ooxrqwoeurb\",\"initiatorCustomerType\":\"EA\",\"canceledBy\":\"pdyarikeejdpd\",\"detailedTransferStatus\":[{\"productType\":\"AzureSubscription\",\"productId\":\"kfqbriqulwwt\",\"productName\":\"meqkvy\",\"skuDescription\":\"okpoyuoh\",\"transferStatus\":\"Completed\",\"errorDetails\":{}},{\"productType\":\"AzureSubscription\",\"productId\":\"jphmpoejnglpws\",\"productName\":\"axj\",\"skuDescription\":\"mxpezco\",\"transferStatus\":\"Completed\",\"errorDetails\":{}},{\"productType\":\"SAAS\",\"productId\":\"qzwqdnxke\",\"productName\":\"c\",\"skuDescription\":\"m\",\"transferStatus\":\"Completed\",\"errorDetails\":{}}],\"customerTenantId\":\"zkvemy\",\"supportedAccounts\":[\"Enterprise\",\"Partner\",\"Individual\"]},\"tags\":{\"isamonatniz\":\"qifdbmptrwtxz\",\"sttxs\":\"xroqsqjghrmthspl\"},\"id\":\"xfqp\",\"name\":\"niceovxgzwh\",\"type\":\"xyrujmt\"}],\"nextLink\":\"eslikyohzixyqhf\"}") - .toObject(RecipientTransferDetailsListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RecipientTransferDetailsListResult model = new RecipientTransferDetailsListResult(); - model = BinaryData.fromObject(model).toObject(RecipientTransferDetailsListResult.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RecipientTransfersValidateWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RecipientTransfersValidateWithResponseMockTests.java deleted file mode 100644 index adb8917f1439..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RecipientTransfersValidateWithResponseMockTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.AcceptTransferRequest; -import com.azure.resourcemanager.billing.models.ProductDetails; -import com.azure.resourcemanager.billing.models.ProductType; -import com.azure.resourcemanager.billing.models.ValidateTransferListResponse; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class RecipientTransfersValidateWithResponseMockTests { - @Test - public void testValidateWithResponse() throws Exception { - String responseStr - = "{\"value\":[{\"properties\":{\"status\":\"pkatccetyyvx\",\"productId\":\"obb\",\"results\":[{},{},{},{}]}}]}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - ValidateTransferListResponse response = manager.recipientTransfers() - .validateWithResponse("xlxoksyypft", - new AcceptTransferRequest().withProductDetails(Arrays - .asList(new ProductDetails().withProductType(ProductType.SAVINGS_PLAN).withProductId("bqgatkl"))), - com.azure.core.util.Context.NONE) - .getValue(); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundDetailsSummaryAmountRefundedTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundDetailsSummaryAmountRefundedTests.java deleted file mode 100644 index f602e0fc71f4..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundDetailsSummaryAmountRefundedTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.RefundDetailsSummaryAmountRefunded; - -public final class RefundDetailsSummaryAmountRefundedTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RefundDetailsSummaryAmountRefunded model = BinaryData.fromString("{\"currency\":\"uifr\",\"value\":92.191284}") - .toObject(RefundDetailsSummaryAmountRefunded.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RefundDetailsSummaryAmountRefunded model = new RefundDetailsSummaryAmountRefunded(); - model = BinaryData.fromObject(model).toObject(RefundDetailsSummaryAmountRefunded.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundDetailsSummaryAmountRequestedTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundDetailsSummaryAmountRequestedTests.java deleted file mode 100644 index 946e65bc04c6..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundDetailsSummaryAmountRequestedTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.RefundDetailsSummaryAmountRequested; - -public final class RefundDetailsSummaryAmountRequestedTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RefundDetailsSummaryAmountRequested model - = BinaryData.fromString("{\"currency\":\"rsrziuctix\",\"value\":0.11745691}") - .toObject(RefundDetailsSummaryAmountRequested.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RefundDetailsSummaryAmountRequested model = new RefundDetailsSummaryAmountRequested(); - model = BinaryData.fromObject(model).toObject(RefundDetailsSummaryAmountRequested.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundDetailsSummaryTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundDetailsSummaryTests.java deleted file mode 100644 index eb31af0b6516..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundDetailsSummaryTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.RefundDetailsSummary; -import com.azure.resourcemanager.billing.models.RefundDetailsSummaryAmountRefunded; -import com.azure.resourcemanager.billing.models.RefundDetailsSummaryAmountRequested; - -public final class RefundDetailsSummaryTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RefundDetailsSummary model = BinaryData.fromString( - "{\"requestedOn\":\"2021-02-01T02:34:06Z\",\"approvedOn\":\"2021-02-12T23:13:01Z\",\"completedOn\":\"2021-06-12T20:12:09Z\",\"amountRequested\":{\"currency\":\"xrkadjfynnfmuii\",\"value\":56.621952},\"amountRefunded\":{\"currency\":\"ohykfkxbbcbrw\",\"value\":0.20254254},\"rebillInvoiceId\":\"gn\",\"transactionCount\":1717253036,\"refundStatus\":\"Approved\",\"refundOperationId\":\"woiymrvz\",\"refundReason\":\"AccidentalConversion\"}") - .toObject(RefundDetailsSummary.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RefundDetailsSummary model - = new RefundDetailsSummary().withAmountRequested(new RefundDetailsSummaryAmountRequested()) - .withAmountRefunded(new RefundDetailsSummaryAmountRefunded()); - model = BinaryData.fromObject(model).toObject(RefundDetailsSummary.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundTransactionDetailsAmountRefundedTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundTransactionDetailsAmountRefundedTests.java deleted file mode 100644 index 5564ab0c9310..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundTransactionDetailsAmountRefundedTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.RefundTransactionDetailsAmountRefunded; - -public final class RefundTransactionDetailsAmountRefundedTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RefundTransactionDetailsAmountRefunded model - = BinaryData.fromString("{\"currency\":\"qjoghdsai\",\"value\":0.47377944}") - .toObject(RefundTransactionDetailsAmountRefunded.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RefundTransactionDetailsAmountRefunded model = new RefundTransactionDetailsAmountRefunded(); - model = BinaryData.fromObject(model).toObject(RefundTransactionDetailsAmountRefunded.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundTransactionDetailsAmountRequestedTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundTransactionDetailsAmountRequestedTests.java deleted file mode 100644 index 1f7e59b51840..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundTransactionDetailsAmountRequestedTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.RefundTransactionDetailsAmountRequested; - -public final class RefundTransactionDetailsAmountRequestedTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RefundTransactionDetailsAmountRequested model - = BinaryData.fromString("{\"currency\":\"ncclabvoyngsuxxc\",\"value\":37.41293}") - .toObject(RefundTransactionDetailsAmountRequested.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RefundTransactionDetailsAmountRequested model = new RefundTransactionDetailsAmountRequested(); - model = BinaryData.fromObject(model).toObject(RefundTransactionDetailsAmountRequested.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundTransactionDetailsTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundTransactionDetailsTests.java deleted file mode 100644 index 67c4e26a85e0..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RefundTransactionDetailsTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.RefundTransactionDetails; -import com.azure.resourcemanager.billing.models.RefundTransactionDetailsAmountRefunded; -import com.azure.resourcemanager.billing.models.RefundTransactionDetailsAmountRequested; -import org.junit.jupiter.api.Assertions; - -public final class RefundTransactionDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RefundTransactionDetails model = BinaryData.fromString( - "{\"amountRequested\":{\"currency\":\"eh\",\"value\":58.864777},\"amountRefunded\":{\"currency\":\"d\",\"value\":76.02638},\"refundOperationId\":\"zxvctkbbxuharls\"}") - .toObject(RefundTransactionDetails.class); - Assertions.assertEquals("zxvctkbbxuharls", model.refundOperationId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RefundTransactionDetails model - = new RefundTransactionDetails().withAmountRequested(new RefundTransactionDetailsAmountRequested()) - .withAmountRefunded(new RefundTransactionDetailsAmountRefunded()) - .withRefundOperationId("zxvctkbbxuharls"); - model = BinaryData.fromObject(model).toObject(RefundTransactionDetails.class); - Assertions.assertEquals("zxvctkbbxuharls", model.refundOperationId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RegistrationNumberTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RegistrationNumberTests.java deleted file mode 100644 index 4acfa0a9d8b0..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RegistrationNumberTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.RegistrationNumber; -import org.junit.jupiter.api.Assertions; - -public final class RegistrationNumberTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RegistrationNumber model = BinaryData - .fromString("{\"id\":\"bhqwalmuzyoxa\",\"required\":true,\"type\":[\"jancu\",\"rhdwbavxbniw\"]}") - .toObject(RegistrationNumber.class); - Assertions.assertEquals("bhqwalmuzyoxa", model.id()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RegistrationNumber model = new RegistrationNumber().withId("bhqwalmuzyoxa"); - model = BinaryData.fromObject(model).toObject(RegistrationNumber.class); - Assertions.assertEquals("bhqwalmuzyoxa", model.id()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RenewalTermDetailsTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RenewalTermDetailsTests.java deleted file mode 100644 index 1626e6429f55..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/RenewalTermDetailsTests.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.RenewalTermDetails; -import org.junit.jupiter.api.Assertions; - -public final class RenewalTermDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - RenewalTermDetails model = BinaryData.fromString( - "{\"billingFrequency\":\"chndbnwie\",\"productId\":\"lewjwiuubwef\",\"productTypeId\":\"fapaqtfer\",\"skuId\":\"wexjkmfxapjwogq\",\"termDuration\":\"o\",\"quantity\":6974301688992111876,\"termEndDate\":\"2021-02-14T03:20:28Z\"}") - .toObject(RenewalTermDetails.class); - Assertions.assertEquals(6974301688992111876L, model.quantity()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - RenewalTermDetails model = new RenewalTermDetails().withQuantity(6974301688992111876L); - model = BinaryData.fromObject(model).toObject(RenewalTermDetails.class); - Assertions.assertEquals(6974301688992111876L, model.quantity()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ResellerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ResellerTests.java deleted file mode 100644 index b37f48b76ce4..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ResellerTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.Reseller; - -public final class ResellerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Reseller model = BinaryData.fromString("{\"resellerId\":\"zejnhl\",\"description\":\"pbzpcpiljhahz\"}") - .toObject(Reseller.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Reseller model = new Reseller(); - model = BinaryData.fromObject(model).toObject(Reseller.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationAppliedScopePropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationAppliedScopePropertiesTests.java deleted file mode 100644 index db1ae1fad6bf..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationAppliedScopePropertiesTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.ReservationAppliedScopeProperties; -import org.junit.jupiter.api.Assertions; - -public final class ReservationAppliedScopePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ReservationAppliedScopeProperties model = BinaryData.fromString( - "{\"tenantId\":\"urghoo\",\"managementGroupId\":\"exbkhx\",\"subscriptionId\":\"joezlqxrkdknkobe\",\"resourceGroupId\":\"mbozom\",\"displayName\":\"amicbigwcdgz\"}") - .toObject(ReservationAppliedScopeProperties.class); - Assertions.assertEquals("urghoo", model.tenantId()); - Assertions.assertEquals("exbkhx", model.managementGroupId()); - Assertions.assertEquals("joezlqxrkdknkobe", model.subscriptionId()); - Assertions.assertEquals("mbozom", model.resourceGroupId()); - Assertions.assertEquals("amicbigwcdgz", model.displayName()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ReservationAppliedScopeProperties model = new ReservationAppliedScopeProperties().withTenantId("urghoo") - .withManagementGroupId("exbkhx") - .withSubscriptionId("joezlqxrkdknkobe") - .withResourceGroupId("mbozom") - .withDisplayName("amicbigwcdgz"); - model = BinaryData.fromObject(model).toObject(ReservationAppliedScopeProperties.class); - Assertions.assertEquals("urghoo", model.tenantId()); - Assertions.assertEquals("exbkhx", model.managementGroupId()); - Assertions.assertEquals("joezlqxrkdknkobe", model.subscriptionId()); - Assertions.assertEquals("mbozom", model.resourceGroupId()); - Assertions.assertEquals("amicbigwcdgz", model.displayName()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationMergePropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationMergePropertiesTests.java deleted file mode 100644 index 598ad984bea2..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationMergePropertiesTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.ReservationMergeProperties; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ReservationMergePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ReservationMergeProperties model - = BinaryData.fromString("{\"mergeDestination\":\"vskiczd\",\"mergeSources\":[\"eizikgqaboohxbms\"]}") - .toObject(ReservationMergeProperties.class); - Assertions.assertEquals("vskiczd", model.mergeDestination()); - Assertions.assertEquals("eizikgqaboohxbms", model.mergeSources().get(0)); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ReservationMergeProperties model = new ReservationMergeProperties().withMergeDestination("vskiczd") - .withMergeSources(Arrays.asList("eizikgqaboohxbms")); - model = BinaryData.fromObject(model).toObject(ReservationMergeProperties.class); - Assertions.assertEquals("vskiczd", model.mergeDestination()); - Assertions.assertEquals("eizikgqaboohxbms", model.mergeSources().get(0)); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationPropertyUtilizationTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationPropertyUtilizationTests.java deleted file mode 100644 index 0ad3d9b90cc6..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationPropertyUtilizationTests.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.ReservationPropertyUtilization; -import com.azure.resourcemanager.billing.models.ReservationUtilizationAggregates; -import java.util.Arrays; - -public final class ReservationPropertyUtilizationTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ReservationPropertyUtilization model = BinaryData.fromString( - "{\"trend\":\"ocgjs\",\"aggregates\":[{\"grain\":1.3885856,\"grainUnit\":\"hwvixqqggljkybsj\",\"value\":28.30782,\"valueUnit\":\"vtzqnrbctbhp\"},{\"grain\":13.420904,\"grainUnit\":\"cvrdnyeitaneqady\",\"value\":77.752335,\"valueUnit\":\"hwriuo\"},{\"grain\":12.099033,\"grainUnit\":\"fki\",\"value\":28.832603,\"valueUnit\":\"saaxwspca\"},{\"grain\":75.33044,\"grainUnit\":\"fjqebglcxkx\",\"value\":53.11063,\"valueUnit\":\"omv\"}]}") - .toObject(ReservationPropertyUtilization.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ReservationPropertyUtilization model = new ReservationPropertyUtilization().withAggregates( - Arrays.asList(new ReservationUtilizationAggregates(), new ReservationUtilizationAggregates(), - new ReservationUtilizationAggregates(), new ReservationUtilizationAggregates())); - model = BinaryData.fromObject(model).toObject(ReservationPropertyUtilization.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationPurchaseRequestPropertiesReservedResourcePropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationPurchaseRequestPropertiesReservedResourcePropertiesTests.java deleted file mode 100644 index 3bd9f6e10ba7..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationPurchaseRequestPropertiesReservedResourcePropertiesTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.ReservationPurchaseRequestPropertiesReservedResourceProperties; -import com.azure.resourcemanager.billing.models.InstanceFlexibility; -import org.junit.jupiter.api.Assertions; - -public final class ReservationPurchaseRequestPropertiesReservedResourcePropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ReservationPurchaseRequestPropertiesReservedResourceProperties model - = BinaryData.fromString("{\"instanceFlexibility\":\"Off\"}") - .toObject(ReservationPurchaseRequestPropertiesReservedResourceProperties.class); - Assertions.assertEquals(InstanceFlexibility.OFF, model.instanceFlexibility()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ReservationPurchaseRequestPropertiesReservedResourceProperties model - = new ReservationPurchaseRequestPropertiesReservedResourceProperties() - .withInstanceFlexibility(InstanceFlexibility.OFF); - model = BinaryData.fromObject(model) - .toObject(ReservationPurchaseRequestPropertiesReservedResourceProperties.class); - Assertions.assertEquals(InstanceFlexibility.OFF, model.instanceFlexibility()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationPurchaseRequestPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationPurchaseRequestPropertiesTests.java deleted file mode 100644 index ac57937a2df3..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationPurchaseRequestPropertiesTests.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.ReservationPurchaseRequestProperties; -import com.azure.resourcemanager.billing.models.AppliedScopeType; -import com.azure.resourcemanager.billing.models.InstanceFlexibility; -import com.azure.resourcemanager.billing.models.ReservationAppliedScopeProperties; -import com.azure.resourcemanager.billing.models.ReservationBillingPlan; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ReservationPurchaseRequestPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ReservationPurchaseRequestProperties model = BinaryData.fromString( - "{\"reservedResourceType\":\"qibzji\",\"billingScopeId\":\"ee\",\"term\":\"ph\",\"billingPlan\":\"Monthly\",\"quantity\":367645464,\"displayName\":\"qwoqs\",\"appliedScopeType\":\"Single\",\"appliedScopes\":[\"dhzybsp\",\"jhfrzgdkkagv\",\"ukhsusmmorf\",\"zhwilzzh\"],\"appliedScopeProperties\":{\"tenantId\":\"mriprlk\",\"managementGroupId\":\"eyttlrcxiv\",\"subscriptionId\":\"kutpu\",\"resourceGroupId\":\"twjfluxynbp\",\"displayName\":\"l\"},\"renew\":false,\"reservedResourceProperties\":{\"instanceFlexibility\":\"On\"},\"instanceFlexibility\":\"On\",\"reviewDateTime\":\"2021-02-07T19:13:17Z\"}") - .toObject(ReservationPurchaseRequestProperties.class); - Assertions.assertEquals(ReservationBillingPlan.MONTHLY, model.billingPlan()); - Assertions.assertEquals(367645464, model.quantity()); - Assertions.assertEquals("qwoqs", model.displayName()); - Assertions.assertEquals(AppliedScopeType.SINGLE, model.appliedScopeType()); - Assertions.assertEquals("dhzybsp", model.appliedScopes().get(0)); - Assertions.assertEquals("mriprlk", model.appliedScopeProperties().tenantId()); - Assertions.assertEquals("eyttlrcxiv", model.appliedScopeProperties().managementGroupId()); - Assertions.assertEquals("kutpu", model.appliedScopeProperties().subscriptionId()); - Assertions.assertEquals("twjfluxynbp", model.appliedScopeProperties().resourceGroupId()); - Assertions.assertEquals("l", model.appliedScopeProperties().displayName()); - Assertions.assertEquals(false, model.renew()); - Assertions.assertEquals(InstanceFlexibility.ON, model.instanceFlexibility()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-07T19:13:17Z"), model.reviewDateTime()); - Assertions.assertEquals(InstanceFlexibility.ON, - model.instanceFlexibilityReservedResourcePropertiesInstanceFlexibility()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ReservationPurchaseRequestProperties model - = new ReservationPurchaseRequestProperties().withBillingPlan(ReservationBillingPlan.MONTHLY) - .withQuantity(367645464) - .withDisplayName("qwoqs") - .withAppliedScopeType(AppliedScopeType.SINGLE) - .withAppliedScopes(Arrays.asList("dhzybsp", "jhfrzgdkkagv", "ukhsusmmorf", "zhwilzzh")) - .withAppliedScopeProperties(new ReservationAppliedScopeProperties().withTenantId("mriprlk") - .withManagementGroupId("eyttlrcxiv") - .withSubscriptionId("kutpu") - .withResourceGroupId("twjfluxynbp") - .withDisplayName("l")) - .withRenew(false) - .withInstanceFlexibility(InstanceFlexibility.ON) - .withReviewDateTime(OffsetDateTime.parse("2021-02-07T19:13:17Z")) - .withInstanceFlexibilityReservedResourcePropertiesInstanceFlexibility(InstanceFlexibility.ON); - model = BinaryData.fromObject(model).toObject(ReservationPurchaseRequestProperties.class); - Assertions.assertEquals(ReservationBillingPlan.MONTHLY, model.billingPlan()); - Assertions.assertEquals(367645464, model.quantity()); - Assertions.assertEquals("qwoqs", model.displayName()); - Assertions.assertEquals(AppliedScopeType.SINGLE, model.appliedScopeType()); - Assertions.assertEquals("dhzybsp", model.appliedScopes().get(0)); - Assertions.assertEquals("mriprlk", model.appliedScopeProperties().tenantId()); - Assertions.assertEquals("eyttlrcxiv", model.appliedScopeProperties().managementGroupId()); - Assertions.assertEquals("kutpu", model.appliedScopeProperties().subscriptionId()); - Assertions.assertEquals("twjfluxynbp", model.appliedScopeProperties().resourceGroupId()); - Assertions.assertEquals("l", model.appliedScopeProperties().displayName()); - Assertions.assertEquals(false, model.renew()); - Assertions.assertEquals(InstanceFlexibility.ON, model.instanceFlexibility()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-07T19:13:17Z"), model.reviewDateTime()); - Assertions.assertEquals(InstanceFlexibility.ON, - model.instanceFlexibilityReservedResourcePropertiesInstanceFlexibility()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationPurchaseRequestTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationPurchaseRequestTests.java deleted file mode 100644 index 053ec1ddf5a5..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationPurchaseRequestTests.java +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.AppliedScopeType; -import com.azure.resourcemanager.billing.models.InstanceFlexibility; -import com.azure.resourcemanager.billing.models.ReservationAppliedScopeProperties; -import com.azure.resourcemanager.billing.models.ReservationBillingPlan; -import com.azure.resourcemanager.billing.models.ReservationPurchaseRequest; -import com.azure.resourcemanager.billing.models.SkuName; -import java.time.OffsetDateTime; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ReservationPurchaseRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ReservationPurchaseRequest model = BinaryData.fromString( - "{\"sku\":{\"name\":\"sxstcyilbvzmm\"},\"location\":\"jzlquz\",\"properties\":{\"reservedResourceType\":\"kjxebj\",\"billingScopeId\":\"zinzabwmvogljsvl\",\"term\":\"idnwceha\",\"billingPlan\":\"Upfront\",\"quantity\":279830620,\"displayName\":\"l\",\"appliedScopeType\":\"Shared\",\"appliedScopes\":[\"qoqpepiaeap\",\"sergdtpe\",\"nacyheqwb\",\"qq\"],\"appliedScopeProperties\":{\"tenantId\":\"u\",\"managementGroupId\":\"hjozf\",\"subscriptionId\":\"cwmbupyvqyvli\",\"resourceGroupId\":\"ipsejbsvsia\",\"displayName\":\"swhddzydisnuep\"},\"renew\":false,\"reservedResourceProperties\":{\"instanceFlexibility\":\"Off\"},\"instanceFlexibility\":\"On\",\"reviewDateTime\":\"2021-09-29T18:06:51Z\"}}") - .toObject(ReservationPurchaseRequest.class); - Assertions.assertEquals("sxstcyilbvzmm", model.sku().name()); - Assertions.assertEquals("jzlquz", model.location()); - Assertions.assertEquals(ReservationBillingPlan.UPFRONT, model.billingPlan()); - Assertions.assertEquals(279830620, model.quantity()); - Assertions.assertEquals("l", model.displayName()); - Assertions.assertEquals(AppliedScopeType.SHARED, model.appliedScopeType()); - Assertions.assertEquals("qoqpepiaeap", model.appliedScopes().get(0)); - Assertions.assertEquals("u", model.appliedScopeProperties().tenantId()); - Assertions.assertEquals("hjozf", model.appliedScopeProperties().managementGroupId()); - Assertions.assertEquals("cwmbupyvqyvli", model.appliedScopeProperties().subscriptionId()); - Assertions.assertEquals("ipsejbsvsia", model.appliedScopeProperties().resourceGroupId()); - Assertions.assertEquals("swhddzydisnuep", model.appliedScopeProperties().displayName()); - Assertions.assertEquals(false, model.renew()); - Assertions.assertEquals(InstanceFlexibility.ON, model.instanceFlexibility()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-29T18:06:51Z"), model.reviewDateTime()); - Assertions.assertEquals(InstanceFlexibility.OFF, - model.instanceFlexibilityReservedResourcePropertiesInstanceFlexibility()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ReservationPurchaseRequest model - = new ReservationPurchaseRequest().withSku(new SkuName().withName("sxstcyilbvzmm")) - .withLocation("jzlquz") - .withBillingPlan(ReservationBillingPlan.UPFRONT) - .withQuantity(279830620) - .withDisplayName("l") - .withAppliedScopeType(AppliedScopeType.SHARED) - .withAppliedScopes(Arrays.asList("qoqpepiaeap", "sergdtpe", "nacyheqwb", "qq")) - .withAppliedScopeProperties(new ReservationAppliedScopeProperties().withTenantId("u") - .withManagementGroupId("hjozf") - .withSubscriptionId("cwmbupyvqyvli") - .withResourceGroupId("ipsejbsvsia") - .withDisplayName("swhddzydisnuep")) - .withRenew(false) - .withInstanceFlexibility(InstanceFlexibility.ON) - .withReviewDateTime(OffsetDateTime.parse("2021-09-29T18:06:51Z")) - .withInstanceFlexibilityReservedResourcePropertiesInstanceFlexibility(InstanceFlexibility.OFF); - model = BinaryData.fromObject(model).toObject(ReservationPurchaseRequest.class); - Assertions.assertEquals("sxstcyilbvzmm", model.sku().name()); - Assertions.assertEquals("jzlquz", model.location()); - Assertions.assertEquals(ReservationBillingPlan.UPFRONT, model.billingPlan()); - Assertions.assertEquals(279830620, model.quantity()); - Assertions.assertEquals("l", model.displayName()); - Assertions.assertEquals(AppliedScopeType.SHARED, model.appliedScopeType()); - Assertions.assertEquals("qoqpepiaeap", model.appliedScopes().get(0)); - Assertions.assertEquals("u", model.appliedScopeProperties().tenantId()); - Assertions.assertEquals("hjozf", model.appliedScopeProperties().managementGroupId()); - Assertions.assertEquals("cwmbupyvqyvli", model.appliedScopeProperties().subscriptionId()); - Assertions.assertEquals("ipsejbsvsia", model.appliedScopeProperties().resourceGroupId()); - Assertions.assertEquals("swhddzydisnuep", model.appliedScopeProperties().displayName()); - Assertions.assertEquals(false, model.renew()); - Assertions.assertEquals(InstanceFlexibility.ON, model.instanceFlexibility()); - Assertions.assertEquals(OffsetDateTime.parse("2021-09-29T18:06:51Z"), model.reviewDateTime()); - Assertions.assertEquals(InstanceFlexibility.OFF, - model.instanceFlexibilityReservedResourcePropertiesInstanceFlexibility()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationSkuPropertyTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationSkuPropertyTests.java deleted file mode 100644 index c561d8b56082..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationSkuPropertyTests.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.ReservationSkuProperty; - -public final class ReservationSkuPropertyTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ReservationSkuProperty model - = BinaryData.fromString("{\"name\":\"swxspvckojaz\"}").toObject(ReservationSkuProperty.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ReservationSkuProperty model = new ReservationSkuProperty(); - model = BinaryData.fromObject(model).toObject(ReservationSkuProperty.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationSplitPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationSplitPropertiesTests.java deleted file mode 100644 index 431f00939008..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationSplitPropertiesTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.ReservationSplitProperties; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class ReservationSplitPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ReservationSplitProperties model = BinaryData.fromString( - "{\"splitDestinations\":[\"ifrhjulrsul\",\"zpfl\",\"snawmhhgzotfri\",\"rgkoekvzwxxyx\"],\"splitSource\":\"ghctxbxmolpcqyde\"}") - .toObject(ReservationSplitProperties.class); - Assertions.assertEquals("ifrhjulrsul", model.splitDestinations().get(0)); - Assertions.assertEquals("ghctxbxmolpcqyde", model.splitSource()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ReservationSplitProperties model = new ReservationSplitProperties() - .withSplitDestinations(Arrays.asList("ifrhjulrsul", "zpfl", "snawmhhgzotfri", "rgkoekvzwxxyx")) - .withSplitSource("ghctxbxmolpcqyde"); - model = BinaryData.fromObject(model).toObject(ReservationSplitProperties.class); - Assertions.assertEquals("ifrhjulrsul", model.splitDestinations().get(0)); - Assertions.assertEquals("ghctxbxmolpcqyde", model.splitSource()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationSummaryTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationSummaryTests.java deleted file mode 100644 index 54baf20c01a3..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationSummaryTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.ReservationSummary; - -public final class ReservationSummaryTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ReservationSummary model = BinaryData.fromString( - "{\"cancelledCount\":42.73576,\"expiredCount\":29.428112,\"expiringCount\":51.64282,\"failedCount\":86.84235,\"pendingCount\":82.57944,\"succeededCount\":63.314163,\"noBenefitCount\":60.028564,\"warningCount\":94.05625,\"processingCount\":49.30765}") - .toObject(ReservationSummary.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ReservationSummary model = new ReservationSummary(); - model = BinaryData.fromObject(model).toObject(ReservationSummary.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationSwapPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationSwapPropertiesTests.java deleted file mode 100644 index aec774479acd..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationSwapPropertiesTests.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.ReservationSwapProperties; -import org.junit.jupiter.api.Assertions; - -public final class ReservationSwapPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ReservationSwapProperties model - = BinaryData.fromString("{\"swapSource\":\"cqsxrmdvewu\",\"swapDestination\":\"aeohpjhgejkbvhh\"}") - .toObject(ReservationSwapProperties.class); - Assertions.assertEquals("cqsxrmdvewu", model.swapSource()); - Assertions.assertEquals("aeohpjhgejkbvhh", model.swapDestination()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ReservationSwapProperties model - = new ReservationSwapProperties().withSwapSource("cqsxrmdvewu").withSwapDestination("aeohpjhgejkbvhh"); - model = BinaryData.fromObject(model).toObject(ReservationSwapProperties.class); - Assertions.assertEquals("cqsxrmdvewu", model.swapSource()); - Assertions.assertEquals("aeohpjhgejkbvhh", model.swapDestination()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationUtilizationAggregatesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationUtilizationAggregatesTests.java deleted file mode 100644 index 90992e3a743d..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/ReservationUtilizationAggregatesTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.ReservationUtilizationAggregates; - -public final class ReservationUtilizationAggregatesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - ReservationUtilizationAggregates model = BinaryData - .fromString("{\"grain\":92.30518,\"grainUnit\":\"emtm\",\"value\":9.405745,\"valueUnit\":\"svpinkzpatqt\"}") - .toObject(ReservationUtilizationAggregates.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - ReservationUtilizationAggregates model = new ReservationUtilizationAggregates(); - model = BinaryData.fromObject(model).toObject(ReservationUtilizationAggregates.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SavingsPlanSummaryCountTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SavingsPlanSummaryCountTests.java deleted file mode 100644 index 1f6aa0946afc..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SavingsPlanSummaryCountTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.SavingsPlanSummaryCount; - -public final class SavingsPlanSummaryCountTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SavingsPlanSummaryCount model = BinaryData.fromString( - "{\"succeededCount\":55.75871,\"failedCount\":44.765682,\"expiringCount\":63.125515,\"expiredCount\":10.386032,\"pendingCount\":36.98035,\"cancelledCount\":42.971317,\"processingCount\":30.47576,\"noBenefitCount\":89.3541,\"warningCount\":44.28318}") - .toObject(SavingsPlanSummaryCount.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SavingsPlanSummaryCount model = new SavingsPlanSummaryCount(); - model = BinaryData.fromObject(model).toObject(SavingsPlanSummaryCount.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SavingsPlanUpdateValidateRequestTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SavingsPlanUpdateValidateRequestTests.java deleted file mode 100644 index c5f4017df04c..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SavingsPlanUpdateValidateRequestTests.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.AppliedScopeProperties; -import com.azure.resourcemanager.billing.models.AppliedScopeType; -import com.azure.resourcemanager.billing.models.BillingPlan; -import com.azure.resourcemanager.billing.models.Commitment; -import com.azure.resourcemanager.billing.models.PurchaseRequest; -import com.azure.resourcemanager.billing.models.RenewProperties; -import com.azure.resourcemanager.billing.models.SavingsPlanTerm; -import com.azure.resourcemanager.billing.models.SavingsPlanUpdateRequestProperties; -import com.azure.resourcemanager.billing.models.SavingsPlanUpdateValidateRequest; -import com.azure.resourcemanager.billing.models.Sku; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class SavingsPlanUpdateValidateRequestTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SavingsPlanUpdateValidateRequest model = BinaryData.fromString( - "{\"benefits\":[{\"displayName\":\"lecdmdqbw\",\"appliedScopeType\":\"Single\",\"appliedScopeProperties\":{\"tenantId\":\"gsfjac\",\"managementGroupId\":\"lhhxudbxvodhtnsi\",\"subscriptionId\":\"dhzmmesckdlp\",\"resourceGroupId\":\"zrcxfailcfxwmdbo\",\"displayName\":\"fgsftufqob\"},\"renew\":false,\"renewProperties\":{\"purchaseProperties\":{\"sku\":{\"name\":\"cc\"},\"properties\":{\"displayName\":\"hxkizvytnrzv\",\"billingScopeId\":\"jraaeranokqguk\",\"term\":\"P5Y\",\"billingPlan\":\"P1M\",\"appliedScopeType\":\"Single\",\"commitment\":{},\"renew\":false,\"appliedScopeProperties\":{}}}}},{\"displayName\":\"xulcdisdos\",\"appliedScopeType\":\"ManagementGroup\",\"appliedScopeProperties\":{\"tenantId\":\"vgjrwhr\",\"managementGroupId\":\"ycy\",\"subscriptionId\":\"c\",\"resourceGroupId\":\"gc\",\"displayName\":\"nfnw\"},\"renew\":true,\"renewProperties\":{\"purchaseProperties\":{\"sku\":{\"name\":\"vjdhttzaefedxih\"},\"properties\":{\"displayName\":\"phkmcrjdqnsdfz\",\"billingScopeId\":\"gtgkylkdghr\",\"term\":\"P5Y\",\"billingPlan\":\"P1M\",\"appliedScopeType\":\"Shared\",\"commitment\":{},\"renew\":false,\"appliedScopeProperties\":{}}}}},{\"displayName\":\"hokvbwnh\",\"appliedScopeType\":\"Shared\",\"appliedScopeProperties\":{\"tenantId\":\"ehgpp\",\"managementGroupId\":\"ifhpf\",\"subscriptionId\":\"ajvgcxtxjcsheafi\",\"resourceGroupId\":\"tugsresmkssjh\",\"displayName\":\"ftxfkf\"},\"renew\":false,\"renewProperties\":{\"purchaseProperties\":{\"sku\":{\"name\":\"tillucbiqtg\"},\"properties\":{\"displayName\":\"hm\",\"billingScopeId\":\"sldrizetpwbral\",\"term\":\"P1Y\",\"billingPlan\":\"P1M\",\"appliedScopeType\":\"Shared\",\"commitment\":{},\"renew\":false,\"appliedScopeProperties\":{}}}}}]}") - .toObject(SavingsPlanUpdateValidateRequest.class); - Assertions.assertEquals("lecdmdqbw", model.benefits().get(0).displayName()); - Assertions.assertEquals(AppliedScopeType.SINGLE, model.benefits().get(0).appliedScopeType()); - Assertions.assertEquals("gsfjac", model.benefits().get(0).appliedScopeProperties().tenantId()); - Assertions.assertEquals("lhhxudbxvodhtnsi", - model.benefits().get(0).appliedScopeProperties().managementGroupId()); - Assertions.assertEquals("dhzmmesckdlp", model.benefits().get(0).appliedScopeProperties().subscriptionId()); - Assertions.assertEquals("zrcxfailcfxwmdbo", model.benefits().get(0).appliedScopeProperties().resourceGroupId()); - Assertions.assertEquals("fgsftufqob", model.benefits().get(0).appliedScopeProperties().displayName()); - Assertions.assertEquals(false, model.benefits().get(0).renew()); - Assertions.assertEquals("cc", model.benefits().get(0).renewProperties().purchaseProperties().sku().name()); - Assertions.assertEquals("hxkizvytnrzv", - model.benefits().get(0).renewProperties().purchaseProperties().displayName()); - Assertions.assertEquals("jraaeranokqguk", - model.benefits().get(0).renewProperties().purchaseProperties().billingScopeId()); - Assertions.assertEquals(SavingsPlanTerm.P5Y, - model.benefits().get(0).renewProperties().purchaseProperties().term()); - Assertions.assertEquals(BillingPlan.P1M, - model.benefits().get(0).renewProperties().purchaseProperties().billingPlan()); - Assertions.assertEquals(AppliedScopeType.SINGLE, - model.benefits().get(0).renewProperties().purchaseProperties().appliedScopeType()); - Assertions.assertEquals(false, model.benefits().get(0).renewProperties().purchaseProperties().renew()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SavingsPlanUpdateValidateRequest model - = new SavingsPlanUpdateValidateRequest().withBenefits(Arrays.asList( - new SavingsPlanUpdateRequestProperties().withDisplayName("lecdmdqbw") - .withAppliedScopeType(AppliedScopeType.SINGLE) - .withAppliedScopeProperties(new AppliedScopeProperties().withTenantId("gsfjac") - .withManagementGroupId("lhhxudbxvodhtnsi") - .withSubscriptionId("dhzmmesckdlp") - .withResourceGroupId("zrcxfailcfxwmdbo") - .withDisplayName("fgsftufqob")) - .withRenew(false) - .withRenewProperties(new RenewProperties() - .withPurchaseProperties(new PurchaseRequest().withSku(new Sku().withName("cc")) - .withDisplayName("hxkizvytnrzv") - .withBillingScopeId("jraaeranokqguk") - .withTerm(SavingsPlanTerm.P5Y) - .withBillingPlan(BillingPlan.P1M) - .withAppliedScopeType(AppliedScopeType.SINGLE) - .withCommitment(new Commitment()) - .withRenew(false) - .withAppliedScopeProperties(new AppliedScopeProperties()))), - new SavingsPlanUpdateRequestProperties().withDisplayName("xulcdisdos") - .withAppliedScopeType(AppliedScopeType.MANAGEMENT_GROUP) - .withAppliedScopeProperties(new AppliedScopeProperties().withTenantId("vgjrwhr") - .withManagementGroupId("ycy") - .withSubscriptionId("c") - .withResourceGroupId("gc") - .withDisplayName("nfnw")) - .withRenew(true) - .withRenewProperties(new RenewProperties() - .withPurchaseProperties(new PurchaseRequest().withSku(new Sku().withName("vjdhttzaefedxih")) - .withDisplayName("phkmcrjdqnsdfz") - .withBillingScopeId("gtgkylkdghr") - .withTerm(SavingsPlanTerm.P5Y) - .withBillingPlan(BillingPlan.P1M) - .withAppliedScopeType(AppliedScopeType.SHARED) - .withCommitment(new Commitment()) - .withRenew(false) - .withAppliedScopeProperties(new AppliedScopeProperties()))), - new SavingsPlanUpdateRequestProperties().withDisplayName("hokvbwnh") - .withAppliedScopeType(AppliedScopeType.SHARED) - .withAppliedScopeProperties(new AppliedScopeProperties().withTenantId("ehgpp") - .withManagementGroupId("ifhpf") - .withSubscriptionId("ajvgcxtxjcsheafi") - .withResourceGroupId("tugsresmkssjh") - .withDisplayName("ftxfkf")) - .withRenew(false) - .withRenewProperties(new RenewProperties() - .withPurchaseProperties(new PurchaseRequest().withSku(new Sku().withName("tillucbiqtg")) - .withDisplayName("hm") - .withBillingScopeId("sldrizetpwbral") - .withTerm(SavingsPlanTerm.P1Y) - .withBillingPlan(BillingPlan.P1M) - .withAppliedScopeType(AppliedScopeType.SHARED) - .withCommitment(new Commitment()) - .withRenew(false) - .withAppliedScopeProperties(new AppliedScopeProperties()))))); - model = BinaryData.fromObject(model).toObject(SavingsPlanUpdateValidateRequest.class); - Assertions.assertEquals("lecdmdqbw", model.benefits().get(0).displayName()); - Assertions.assertEquals(AppliedScopeType.SINGLE, model.benefits().get(0).appliedScopeType()); - Assertions.assertEquals("gsfjac", model.benefits().get(0).appliedScopeProperties().tenantId()); - Assertions.assertEquals("lhhxudbxvodhtnsi", - model.benefits().get(0).appliedScopeProperties().managementGroupId()); - Assertions.assertEquals("dhzmmesckdlp", model.benefits().get(0).appliedScopeProperties().subscriptionId()); - Assertions.assertEquals("zrcxfailcfxwmdbo", model.benefits().get(0).appliedScopeProperties().resourceGroupId()); - Assertions.assertEquals("fgsftufqob", model.benefits().get(0).appliedScopeProperties().displayName()); - Assertions.assertEquals(false, model.benefits().get(0).renew()); - Assertions.assertEquals("cc", model.benefits().get(0).renewProperties().purchaseProperties().sku().name()); - Assertions.assertEquals("hxkizvytnrzv", - model.benefits().get(0).renewProperties().purchaseProperties().displayName()); - Assertions.assertEquals("jraaeranokqguk", - model.benefits().get(0).renewProperties().purchaseProperties().billingScopeId()); - Assertions.assertEquals(SavingsPlanTerm.P5Y, - model.benefits().get(0).renewProperties().purchaseProperties().term()); - Assertions.assertEquals(BillingPlan.P1M, - model.benefits().get(0).renewProperties().purchaseProperties().billingPlan()); - Assertions.assertEquals(AppliedScopeType.SINGLE, - model.benefits().get(0).renewProperties().purchaseProperties().appliedScopeType()); - Assertions.assertEquals(false, model.benefits().get(0).renewProperties().purchaseProperties().renew()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SkuNameTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SkuNameTests.java deleted file mode 100644 index 3f12eb346b0e..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SkuNameTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.SkuName; -import org.junit.jupiter.api.Assertions; - -public final class SkuNameTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SkuName model = BinaryData.fromString("{\"name\":\"ttdiia\"}").toObject(SkuName.class); - Assertions.assertEquals("ttdiia", model.name()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SkuName model = new SkuName().withName("ttdiia"); - model = BinaryData.fromObject(model).toObject(SkuName.class); - Assertions.assertEquals("ttdiia", model.name()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SkuTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SkuTests.java deleted file mode 100644 index ec0a5c276979..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SkuTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.Sku; -import org.junit.jupiter.api.Assertions; - -public final class SkuTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Sku model = BinaryData.fromString("{\"name\":\"okpvzm\"}").toObject(Sku.class); - Assertions.assertEquals("okpvzm", model.name()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Sku model = new Sku().withName("okpvzm"); - model = BinaryData.fromObject(model).toObject(Sku.class); - Assertions.assertEquals("okpvzm", model.name()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SpendingLimitDetailsTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SpendingLimitDetailsTests.java deleted file mode 100644 index c2b31d376cf5..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SpendingLimitDetailsTests.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.SpendingLimitDetails; -import com.azure.resourcemanager.billing.models.SpendingLimitStatus; -import com.azure.resourcemanager.billing.models.SpendingLimitType; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Assertions; - -public final class SpendingLimitDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SpendingLimitDetails model = BinaryData.fromString( - "{\"amount\":55.807846,\"currency\":\"srruvwbhsqfsubcg\",\"startDate\":\"2021-02-04T22:06:27Z\",\"endDate\":\"2021-06-17T14:12:31Z\",\"type\":\"AzureForStudentsStarter\",\"status\":\"LimitReached\"}") - .toObject(SpendingLimitDetails.class); - Assertions.assertEquals(55.807846F, model.amount()); - Assertions.assertEquals("srruvwbhsqfsubcg", model.currency()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-04T22:06:27Z"), model.startDate()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-17T14:12:31Z"), model.endDate()); - Assertions.assertEquals(SpendingLimitType.AZURE_FOR_STUDENTS_STARTER, model.type()); - Assertions.assertEquals(SpendingLimitStatus.LIMIT_REACHED, model.status()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SpendingLimitDetails model = new SpendingLimitDetails().withAmount(55.807846F) - .withCurrency("srruvwbhsqfsubcg") - .withStartDate(OffsetDateTime.parse("2021-02-04T22:06:27Z")) - .withEndDate(OffsetDateTime.parse("2021-06-17T14:12:31Z")) - .withType(SpendingLimitType.AZURE_FOR_STUDENTS_STARTER) - .withStatus(SpendingLimitStatus.LIMIT_REACHED); - model = BinaryData.fromObject(model).toObject(SpendingLimitDetails.class); - Assertions.assertEquals(55.807846F, model.amount()); - Assertions.assertEquals("srruvwbhsqfsubcg", model.currency()); - Assertions.assertEquals(OffsetDateTime.parse("2021-02-04T22:06:27Z"), model.startDate()); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-17T14:12:31Z"), model.endDate()); - Assertions.assertEquals(SpendingLimitType.AZURE_FOR_STUDENTS_STARTER, model.type()); - Assertions.assertEquals(SpendingLimitStatus.LIMIT_REACHED, model.status()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SubscriptionEnrollmentDetailsTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SubscriptionEnrollmentDetailsTests.java deleted file mode 100644 index 1ba33e45c4f9..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SubscriptionEnrollmentDetailsTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.SubscriptionEnrollmentDetails; -import org.junit.jupiter.api.Assertions; - -public final class SubscriptionEnrollmentDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SubscriptionEnrollmentDetails model = BinaryData.fromString( - "{\"departmentDisplayName\":\"fikdowwqu\",\"departmentId\":\"xzxcl\",\"enrollmentAccountStatus\":\"thhqzonosggbh\",\"enrollmentAccountDisplayName\":\"hfwdsjnkaljutiis\",\"enrollmentAccountId\":\"cffgdkzzewk\"}") - .toObject(SubscriptionEnrollmentDetails.class); - Assertions.assertEquals("fikdowwqu", model.departmentDisplayName()); - Assertions.assertEquals("xzxcl", model.departmentId()); - Assertions.assertEquals("thhqzonosggbh", model.enrollmentAccountStatus()); - Assertions.assertEquals("hfwdsjnkaljutiis", model.enrollmentAccountDisplayName()); - Assertions.assertEquals("cffgdkzzewk", model.enrollmentAccountId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SubscriptionEnrollmentDetails model = new SubscriptionEnrollmentDetails().withDepartmentDisplayName("fikdowwqu") - .withDepartmentId("xzxcl") - .withEnrollmentAccountStatus("thhqzonosggbh") - .withEnrollmentAccountDisplayName("hfwdsjnkaljutiis") - .withEnrollmentAccountId("cffgdkzzewk"); - model = BinaryData.fromObject(model).toObject(SubscriptionEnrollmentDetails.class); - Assertions.assertEquals("fikdowwqu", model.departmentDisplayName()); - Assertions.assertEquals("xzxcl", model.departmentId()); - Assertions.assertEquals("thhqzonosggbh", model.enrollmentAccountStatus()); - Assertions.assertEquals("hfwdsjnkaljutiis", model.enrollmentAccountDisplayName()); - Assertions.assertEquals("cffgdkzzewk", model.enrollmentAccountId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SubscriptionPolicyInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SubscriptionPolicyInnerTests.java deleted file mode 100644 index 769af02d4f7a..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SubscriptionPolicyInnerTests.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.SubscriptionPolicyInner; -import com.azure.resourcemanager.billing.models.PolicySummary; -import com.azure.resourcemanager.billing.models.PolicyType; -import com.azure.resourcemanager.billing.models.SubscriptionPolicyProperties; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import org.junit.jupiter.api.Assertions; - -public final class SubscriptionPolicyInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SubscriptionPolicyInner model = BinaryData.fromString( - "{\"properties\":{\"provisioningState\":\"Succeeded\",\"policies\":[{\"name\":\"maiubavlzwp\",\"value\":\"mfalkzazmgok\",\"policyType\":\"Other\",\"scope\":\"qafkmkrokzrth\"},{\"name\":\"twpqrtva\",\"value\":\"nqnixiezeagmce\",\"policyType\":\"UserControlled\",\"scope\":\"gedhfpjstlzm\"},{\"name\":\"syjdeolctae\",\"value\":\"syrled\",\"policyType\":\"SystemControlled\",\"scope\":\"tb\"},{\"name\":\"qigdx\",\"value\":\"sgeafgfosehx\",\"policyType\":\"SystemControlled\",\"scope\":\"ezppkkwaaesk\"}]},\"tags\":{\"eqtoyrpl\":\"lp\",\"llpquevhamfo\":\"xlaj\",\"mkekxpkzwaqxo\":\"gwb\"},\"id\":\"ovchiqbplvfid\",\"name\":\"sztekxby\",\"type\":\"gmsfepxyi\"}") - .toObject(SubscriptionPolicyInner.class); - Assertions.assertEquals("lp", model.tags().get("eqtoyrpl")); - Assertions.assertEquals("maiubavlzwp", model.properties().policies().get(0).name()); - Assertions.assertEquals("mfalkzazmgok", model.properties().policies().get(0).value()); - Assertions.assertEquals(PolicyType.OTHER, model.properties().policies().get(0).policyType()); - Assertions.assertEquals("qafkmkrokzrth", model.properties().policies().get(0).scope()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SubscriptionPolicyInner model = new SubscriptionPolicyInner() - .withTags(mapOf("eqtoyrpl", "lp", "llpquevhamfo", "xlaj", "mkekxpkzwaqxo", "gwb")) - .withProperties(new SubscriptionPolicyProperties().withPolicies(Arrays.asList( - new PolicySummary().withName("maiubavlzwp") - .withValue("mfalkzazmgok") - .withPolicyType(PolicyType.OTHER) - .withScope("qafkmkrokzrth"), - new PolicySummary().withName("twpqrtva") - .withValue("nqnixiezeagmce") - .withPolicyType(PolicyType.USER_CONTROLLED) - .withScope("gedhfpjstlzm"), - new PolicySummary().withName("syjdeolctae") - .withValue("syrled") - .withPolicyType(PolicyType.SYSTEM_CONTROLLED) - .withScope("tb"), - new PolicySummary().withName("qigdx") - .withValue("sgeafgfosehx") - .withPolicyType(PolicyType.SYSTEM_CONTROLLED) - .withScope("ezppkkwaaesk")))); - model = BinaryData.fromObject(model).toObject(SubscriptionPolicyInner.class); - Assertions.assertEquals("lp", model.tags().get("eqtoyrpl")); - Assertions.assertEquals("maiubavlzwp", model.properties().policies().get(0).name()); - Assertions.assertEquals("mfalkzazmgok", model.properties().policies().get(0).value()); - Assertions.assertEquals(PolicyType.OTHER, model.properties().policies().get(0).policyType()); - Assertions.assertEquals("qafkmkrokzrth", model.properties().policies().get(0).scope()); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SubscriptionPolicyPropertiesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SubscriptionPolicyPropertiesTests.java deleted file mode 100644 index 6b606c0850d2..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SubscriptionPolicyPropertiesTests.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.PolicySummary; -import com.azure.resourcemanager.billing.models.PolicyType; -import com.azure.resourcemanager.billing.models.SubscriptionPolicyProperties; -import java.util.Arrays; -import org.junit.jupiter.api.Assertions; - -public final class SubscriptionPolicyPropertiesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SubscriptionPolicyProperties model = BinaryData.fromString( - "{\"provisioningState\":\"Failed\",\"policies\":[{\"name\":\"grhrdic\",\"value\":\"wyjfowxwyovcxjs\",\"policyType\":\"SystemControlled\",\"scope\":\"cu\"},{\"name\":\"veksbuhoduchvl\",\"value\":\"rdpibfd\",\"policyType\":\"Other\",\"scope\":\"sspyszekbh\"},{\"name\":\"kaaggkreh\",\"value\":\"rnuybffljfii\",\"policyType\":\"SystemControlled\",\"scope\":\"agsqta\"}]}") - .toObject(SubscriptionPolicyProperties.class); - Assertions.assertEquals("grhrdic", model.policies().get(0).name()); - Assertions.assertEquals("wyjfowxwyovcxjs", model.policies().get(0).value()); - Assertions.assertEquals(PolicyType.SYSTEM_CONTROLLED, model.policies().get(0).policyType()); - Assertions.assertEquals("cu", model.policies().get(0).scope()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SubscriptionPolicyProperties model = new SubscriptionPolicyProperties().withPolicies(Arrays.asList( - new PolicySummary().withName("grhrdic") - .withValue("wyjfowxwyovcxjs") - .withPolicyType(PolicyType.SYSTEM_CONTROLLED) - .withScope("cu"), - new PolicySummary().withName("veksbuhoduchvl") - .withValue("rdpibfd") - .withPolicyType(PolicyType.OTHER) - .withScope("sspyszekbh"), - new PolicySummary().withName("kaaggkreh") - .withValue("rnuybffljfii") - .withPolicyType(PolicyType.SYSTEM_CONTROLLED) - .withScope("agsqta"))); - model = BinaryData.fromObject(model).toObject(SubscriptionPolicyProperties.class); - Assertions.assertEquals("grhrdic", model.policies().get(0).name()); - Assertions.assertEquals("wyjfowxwyovcxjs", model.policies().get(0).value()); - Assertions.assertEquals(PolicyType.SYSTEM_CONTROLLED, model.policies().get(0).policyType()); - Assertions.assertEquals("cu", model.policies().get(0).scope()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SystemOverridesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SystemOverridesTests.java deleted file mode 100644 index 013a1d449af0..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/SystemOverridesTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.SystemOverrides; - -public final class SystemOverridesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - SystemOverrides model = BinaryData - .fromString("{\"cancellation\":\"Allowed\",\"cancellationAllowedEndDate\":\"2021-06-05T11:36:55Z\"}") - .toObject(SystemOverrides.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - SystemOverrides model = new SystemOverrides(); - model = BinaryData.fromObject(model).toObject(SystemOverrides.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TaxIdentifierTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TaxIdentifierTests.java deleted file mode 100644 index d18408f0b657..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TaxIdentifierTests.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.TaxIdentifier; -import com.azure.resourcemanager.billing.models.TaxIdentifierStatus; -import com.azure.resourcemanager.billing.models.TaxIdentifierType; -import org.junit.jupiter.api.Assertions; - -public final class TaxIdentifierTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TaxIdentifier model = BinaryData.fromString( - "{\"id\":\"swzts\",\"type\":\"IndiaFederalTanId\",\"scope\":\"nxytxh\",\"country\":\"xbzpfzab\",\"status\":\"Valid\"}") - .toObject(TaxIdentifier.class); - Assertions.assertEquals("swzts", model.id()); - Assertions.assertEquals(TaxIdentifierType.INDIA_FEDERAL_TAN_ID, model.type()); - Assertions.assertEquals("nxytxh", model.scope()); - Assertions.assertEquals("xbzpfzab", model.country()); - Assertions.assertEquals(TaxIdentifierStatus.VALID, model.status()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TaxIdentifier model = new TaxIdentifier().withId("swzts") - .withType(TaxIdentifierType.INDIA_FEDERAL_TAN_ID) - .withScope("nxytxh") - .withCountry("xbzpfzab") - .withStatus(TaxIdentifierStatus.VALID); - model = BinaryData.fromObject(model).toObject(TaxIdentifier.class); - Assertions.assertEquals("swzts", model.id()); - Assertions.assertEquals(TaxIdentifierType.INDIA_FEDERAL_TAN_ID, model.type()); - Assertions.assertEquals("nxytxh", model.scope()); - Assertions.assertEquals("xbzpfzab", model.country()); - Assertions.assertEquals(TaxIdentifierStatus.VALID, model.status()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesAzureCreditAppliedTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesAzureCreditAppliedTests.java deleted file mode 100644 index 6ef6765f7ea3..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesAzureCreditAppliedTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.TransactionPropertiesAzureCreditApplied; - -public final class TransactionPropertiesAzureCreditAppliedTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TransactionPropertiesAzureCreditApplied model - = BinaryData.fromString("{\"currency\":\"wirfljf\",\"value\":24.830431}") - .toObject(TransactionPropertiesAzureCreditApplied.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TransactionPropertiesAzureCreditApplied model = new TransactionPropertiesAzureCreditApplied(); - model = BinaryData.fromObject(model).toObject(TransactionPropertiesAzureCreditApplied.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesConsumptionCommitmentDecrementedTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesConsumptionCommitmentDecrementedTests.java deleted file mode 100644 index dca5d8a60dcb..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesConsumptionCommitmentDecrementedTests.java +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.TransactionPropertiesConsumptionCommitmentDecremented; - -public final class TransactionPropertiesConsumptionCommitmentDecrementedTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TransactionPropertiesConsumptionCommitmentDecremented model - = BinaryData.fromString("{\"currency\":\"ou\",\"value\":7.5617256}") - .toObject(TransactionPropertiesConsumptionCommitmentDecremented.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TransactionPropertiesConsumptionCommitmentDecremented model - = new TransactionPropertiesConsumptionCommitmentDecremented(); - model = BinaryData.fromObject(model).toObject(TransactionPropertiesConsumptionCommitmentDecremented.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesEffectivePriceTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesEffectivePriceTests.java deleted file mode 100644 index 95f046248329..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesEffectivePriceTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.TransactionPropertiesEffectivePrice; - -public final class TransactionPropertiesEffectivePriceTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TransactionPropertiesEffectivePrice model - = BinaryData.fromString("{\"currency\":\"nmckaprhkn\",\"value\":65.641525}") - .toObject(TransactionPropertiesEffectivePrice.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TransactionPropertiesEffectivePrice model = new TransactionPropertiesEffectivePrice(); - model = BinaryData.fromObject(model).toObject(TransactionPropertiesEffectivePrice.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesMarketPriceTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesMarketPriceTests.java deleted file mode 100644 index a3460dc98e2d..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesMarketPriceTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.TransactionPropertiesMarketPrice; - -public final class TransactionPropertiesMarketPriceTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TransactionPropertiesMarketPrice model - = BinaryData.fromString("{\"currency\":\"gencdgmoq\",\"value\":13.483625}") - .toObject(TransactionPropertiesMarketPrice.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TransactionPropertiesMarketPrice model = new TransactionPropertiesMarketPrice(); - model = BinaryData.fromObject(model).toObject(TransactionPropertiesMarketPrice.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesRefundTransactionDetailsTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesRefundTransactionDetailsTests.java deleted file mode 100644 index a8198b1aaec1..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesRefundTransactionDetailsTests.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.RefundTransactionDetailsAmountRefunded; -import com.azure.resourcemanager.billing.models.RefundTransactionDetailsAmountRequested; -import com.azure.resourcemanager.billing.models.TransactionPropertiesRefundTransactionDetails; -import org.junit.jupiter.api.Assertions; - -public final class TransactionPropertiesRefundTransactionDetailsTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TransactionPropertiesRefundTransactionDetails model = BinaryData.fromString( - "{\"amountRequested\":{\"currency\":\"otnplfacqocc\",\"value\":45.08301},\"amountRefunded\":{\"currency\":\"etjt\",\"value\":82.01218},\"refundOperationId\":\"tfdoadtx\"}") - .toObject(TransactionPropertiesRefundTransactionDetails.class); - Assertions.assertEquals("tfdoadtx", model.refundOperationId()); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TransactionPropertiesRefundTransactionDetails model = new TransactionPropertiesRefundTransactionDetails() - .withAmountRequested(new RefundTransactionDetailsAmountRequested()) - .withAmountRefunded(new RefundTransactionDetailsAmountRefunded()) - .withRefundOperationId("tfdoadtx"); - model = BinaryData.fromObject(model).toObject(TransactionPropertiesRefundTransactionDetails.class); - Assertions.assertEquals("tfdoadtx", model.refundOperationId()); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesSubTotalTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesSubTotalTests.java deleted file mode 100644 index caef079a4987..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesSubTotalTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.TransactionPropertiesSubTotal; - -public final class TransactionPropertiesSubTotalTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TransactionPropertiesSubTotal model - = BinaryData.fromString("{\"currency\":\"hkkyowltjouw\",\"value\":90.42876}") - .toObject(TransactionPropertiesSubTotal.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TransactionPropertiesSubTotal model = new TransactionPropertiesSubTotal(); - model = BinaryData.fromObject(model).toObject(TransactionPropertiesSubTotal.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesTaxTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesTaxTests.java deleted file mode 100644 index 268112a49920..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesTaxTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.TransactionPropertiesTax; - -public final class TransactionPropertiesTaxTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TransactionPropertiesTax model - = BinaryData.fromString("{\"currency\":\"whieproqksmfxmcv\",\"value\":76.092735}") - .toObject(TransactionPropertiesTax.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TransactionPropertiesTax model = new TransactionPropertiesTax(); - model = BinaryData.fromObject(model).toObject(TransactionPropertiesTax.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesTransactionAmountTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesTransactionAmountTests.java deleted file mode 100644 index 9defc85de2f1..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionPropertiesTransactionAmountTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.TransactionPropertiesTransactionAmount; - -public final class TransactionPropertiesTransactionAmountTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TransactionPropertiesTransactionAmount model - = BinaryData.fromString("{\"currency\":\"vkitb\",\"value\":51.716232}") - .toObject(TransactionPropertiesTransactionAmount.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TransactionPropertiesTransactionAmount model = new TransactionPropertiesTransactionAmount(); - model = BinaryData.fromObject(model).toObject(TransactionPropertiesTransactionAmount.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionSummaryInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionSummaryInnerTests.java deleted file mode 100644 index 775fa7f6636e..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionSummaryInnerTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.TransactionSummaryInner; - -public final class TransactionSummaryInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TransactionSummaryInner model = BinaryData.fromString( - "{\"azureCreditApplied\":98.85146,\"billingCurrency\":\"movdxxurn\",\"consumptionCommitmentDecremented\":55.68794,\"subTotal\":69.29038,\"tax\":9.567701,\"total\":92.986404}") - .toObject(TransactionSummaryInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TransactionSummaryInner model = new TransactionSummaryInner(); - model = BinaryData.fromObject(model).toObject(TransactionSummaryInner.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionsGetTransactionSummaryByInvoiceWithResponseMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionsGetTransactionSummaryByInvoiceWithResponseMockTests.java deleted file mode 100644 index e6441311d6a1..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionsGetTransactionSummaryByInvoiceWithResponseMockTests.java +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.TransactionSummary; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class TransactionsGetTransactionSummaryByInvoiceWithResponseMockTests { - @Test - public void testGetTransactionSummaryByInvoiceWithResponse() throws Exception { - String responseStr - = "{\"azureCreditApplied\":79.841835,\"billingCurrency\":\"fj\",\"consumptionCommitmentDecremented\":88.2823,\"subTotal\":59.771053,\"tax\":66.34461,\"total\":26.896769}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - TransactionSummary response = manager.transactions() - .getTransactionSummaryByInvoiceWithResponse("cljnkm", "fsquxxqc", "mnchvkjwriva", "csmrtepsybdgtf", - com.azure.core.util.Context.NONE) - .getValue(); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionsTransactionsDownloadByInvoiceMockTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionsTransactionsDownloadByInvoiceMockTests.java deleted file mode 100644 index a53171be07f6..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransactionsTransactionsDownloadByInvoiceMockTests.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.credential.AccessToken; -import com.azure.core.http.HttpClient; -import com.azure.core.management.AzureEnvironment; -import com.azure.core.management.profile.AzureProfile; -import com.azure.core.test.http.MockHttpResponse; -import com.azure.resourcemanager.billing.BillingManager; -import com.azure.resourcemanager.billing.models.DocumentDownloadResult; -import java.nio.charset.StandardCharsets; -import java.time.OffsetDateTime; -import org.junit.jupiter.api.Test; -import reactor.core.publisher.Mono; - -public final class TransactionsTransactionsDownloadByInvoiceMockTests { - @Test - public void testTransactionsDownloadByInvoice() throws Exception { - String responseStr = "{\"expiryTime\":\"kqjrbbl\",\"url\":\"mxxxpnk\"}"; - - HttpClient httpClient - = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); - BillingManager manager = BillingManager.configure() - .withHttpClient(httpClient) - .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), - new AzureProfile("", "", AzureEnvironment.AZURE)); - - DocumentDownloadResult response = manager.transactions() - .transactionsDownloadByInvoice("xznxh", "ttkkicxjxueilixz", com.azure.core.util.Context.NONE); - - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransferDetailsListResultTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransferDetailsListResultTests.java deleted file mode 100644 index f25f13cb6b2c..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransferDetailsListResultTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.TransferDetailsListResult; - -public final class TransferDetailsListResultTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TransferDetailsListResult model = BinaryData.fromString( - "{\"value\":[{\"properties\":{\"expirationTime\":\"2021-07-16T13:02:06Z\",\"transferStatus\":\"Completed\",\"recipientEmailId\":\"unmlhxdfbklcii\",\"initiatorEmailId\":\"gjsysmvxodgwxfkz\",\"canceledBy\":\"fcuvbdujgcwx\",\"detailedTransferStatus\":[{\"productType\":\"SAAS\",\"productId\":\"jtrdxr\",\"productName\":\"agbbgia\",\"skuDescription\":\"sy\",\"transferStatus\":\"Completed\",\"errorDetails\":{}},{\"productType\":\"AzureSubscription\",\"productId\":\"abzrwiqrxha\",\"productName\":\"cdosqkptj\",\"skuDescription\":\"kifmmainw\",\"transferStatus\":\"NotStarted\",\"errorDetails\":{}},{\"productType\":\"AzureReservation\",\"productId\":\"qwuntob\",\"productName\":\"z\",\"skuDescription\":\"zelwgvydjufbnkl\",\"transferStatus\":\"InProgress\",\"errorDetails\":{}}]},\"tags\":{\"lfdxaglz\":\"gjwdab\",\"siflikyypzkgxf\":\"ytlbtlqhopxouvm\",\"qsdb\":\"fmy\",\"nm\":\"oksz\"},\"id\":\"gpterdiu\",\"name\":\"kirkskw\",\"type\":\"tsdetjygowifcq\"},{\"properties\":{\"expirationTime\":\"2021-09-11T06:29:41Z\",\"transferStatus\":\"CompletedWithErrors\",\"recipientEmailId\":\"sdgzyy\",\"initiatorEmailId\":\"oxlvocptvdxxheig\",\"canceledBy\":\"ilwzghj\",\"detailedTransferStatus\":[{\"productType\":\"Department\",\"productId\":\"zzbwaybfmdaf\",\"productName\":\"ymqtnapreojx\",\"skuDescription\":\"nbsconx\",\"transferStatus\":\"InProgress\",\"errorDetails\":{}},{\"productType\":\"SavingsPlan\",\"productId\":\"chbj\",\"productName\":\"qf\",\"skuDescription\":\"nwdxzedpqlrfbor\",\"transferStatus\":\"NotStarted\",\"errorDetails\":{}},{\"productType\":\"SAAS\",\"productId\":\"yzavfrbypicdbkpd\",\"productName\":\"aq\",\"skuDescription\":\"mqazpdgonjh\",\"transferStatus\":\"NotStarted\",\"errorDetails\":{}},{\"productType\":\"SAAS\",\"productId\":\"pczqulptkbvcp\",\"productName\":\"zhigqqbtimpkj\",\"skuDescription\":\"o\",\"transferStatus\":\"NotStarted\",\"errorDetails\":{}}]},\"tags\":{\"jakx\":\"hudsmusuaa\",\"vqban\":\"jnfczmnniixy\",\"gm\":\"sjtgirnbgmgmddo\",\"yxwe\":\"nltwmpftmfoeajog\"},\"id\":\"mfd\",\"name\":\"rvlkpzwbhnrec\",\"type\":\"hdidrmuhkahmjedb\"},{\"properties\":{\"expirationTime\":\"2021-12-02T07:43:44Z\",\"transferStatus\":\"Declined\",\"recipientEmailId\":\"wmjpjbweunxcqrr\",\"initiatorEmailId\":\"ufoihppiybxv\",\"canceledBy\":\"zuzpbgkzcs\",\"detailedTransferStatus\":[{\"productType\":\"SAAS\",\"productId\":\"kunhdimjuk\",\"productName\":\"r\",\"skuDescription\":\"a\",\"transferStatus\":\"InProgress\",\"errorDetails\":{}},{\"productType\":\"AzureReservation\",\"productId\":\"cfqp\",\"productName\":\"gofmhxwrjlv\",\"skuDescription\":\"lkv\",\"transferStatus\":\"Completed\",\"errorDetails\":{}},{\"productType\":\"AzureSubscription\",\"productId\":\"kakvlbishjvpza\",\"productName\":\"uoskaoizjixwf\",\"skuDescription\":\"d\",\"transferStatus\":\"Failed\",\"errorDetails\":{}},{\"productType\":\"AzureReservation\",\"productId\":\"nujvqynvavi\",\"productName\":\"dmuqohhi\",\"skuDescription\":\"a\",\"transferStatus\":\"InProgress\",\"errorDetails\":{}}]},\"tags\":{\"jbrhlhpvzadbw\":\"wjc\"},\"id\":\"ninafhxrz\",\"name\":\"rmvzti\",\"type\":\"cwviqllukhk\"}],\"nextLink\":\"qxgcbvzarmqcbpo\"}") - .toObject(TransferDetailsListResult.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TransferDetailsListResult model = new TransferDetailsListResult(); - model = BinaryData.fromObject(model).toObject(TransferDetailsListResult.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransitionDetailsInnerTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransitionDetailsInnerTests.java deleted file mode 100644 index 2c96b04a46bc..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/TransitionDetailsInnerTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.fluent.models.TransitionDetailsInner; - -public final class TransitionDetailsInnerTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - TransitionDetailsInner model - = BinaryData.fromString("{\"transitionDate\":\"2021-07-14T02:22:10Z\",\"anniversaryDay\":1848229806}") - .toObject(TransitionDetailsInner.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - TransitionDetailsInner model = new TransitionDetailsInner(); - model = BinaryData.fromObject(model).toObject(TransitionDetailsInner.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/UtilizationAggregatesTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/UtilizationAggregatesTests.java deleted file mode 100644 index e9f67a76585c..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/UtilizationAggregatesTests.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.UtilizationAggregates; - -public final class UtilizationAggregatesTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - UtilizationAggregates model = BinaryData.fromString( - "{\"grain\":48.290157,\"grainUnit\":\"kuqgsjjxundxgket\",\"value\":43.33548,\"valueUnit\":\"zjhfjmhvv\"}") - .toObject(UtilizationAggregates.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - UtilizationAggregates model = new UtilizationAggregates(); - model = BinaryData.fromObject(model).toObject(UtilizationAggregates.class); - } -} diff --git a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/UtilizationTests.java b/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/UtilizationTests.java deleted file mode 100644 index 37e09cc1d0cc..000000000000 --- a/sdk/billing/azure-resourcemanager-billing/src/test/java/com/azure/resourcemanager/billing/generated/UtilizationTests.java +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.billing.generated; - -import com.azure.core.util.BinaryData; -import com.azure.resourcemanager.billing.models.Utilization; -import com.azure.resourcemanager.billing.models.UtilizationAggregates; -import java.util.Arrays; - -public final class UtilizationTests { - @org.junit.jupiter.api.Test - public void testDeserialize() throws Exception { - Utilization model = BinaryData.fromString( - "{\"trend\":\"qusrdvetnws\",\"aggregates\":[{\"grain\":97.207664,\"grainUnit\":\"lduycv\",\"value\":84.20545,\"valueUnit\":\"rmewipmve\"}]}") - .toObject(Utilization.class); - } - - @org.junit.jupiter.api.Test - public void testSerialize() throws Exception { - Utilization model = new Utilization().withAggregates(Arrays.asList(new UtilizationAggregates())); - model = BinaryData.fromObject(model).toObject(Utilization.class); - } -}