From 3f5f8c61670938f70730dcab5780daf55f720233 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Sun, 29 Jan 2023 04:01:44 +0000 Subject: [PATCH] CodeGen from PR 22338 in Azure/azure-rest-api-specs update example name in reservations (#22338) * update example name in reservations * update files * update files * update files --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 5 + .../README.md | 105 + .../SAMPLE.md | 1041 +++++++ .../pom.xml | 55 + .../reservations/ReservationsManager.java | 425 +++ .../fluent/AzureReservationApi.java | 102 + .../fluent/CalculateExchangesClient.java | 76 + .../fluent/CalculateRefundsClient.java | 48 + .../reservations/fluent/ExchangesClient.java | 76 + .../reservations/fluent/OperationsClient.java | 40 + .../fluent/QuotaRequestStatusClient.java | 95 + .../reservations/fluent/QuotasClient.java | 295 ++ .../fluent/ReservationOrdersClient.java | 202 ++ .../fluent/ReservationsClient.java | 494 ++++ .../fluent/ResourceProvidersClient.java | 95 + .../reservations/fluent/ReturnsClient.java | 82 + .../models/AppliedReservationsInner.java | 111 + .../models/AppliedReservationsProperties.java | 54 + .../models/AvailableScopePropertiesInner.java | 54 + ...eExchangeOperationResultResponseInner.java | 166 ++ .../models/CalculatePriceResponseInner.java | 54 + .../models/CalculateRefundResponseInner.java | 80 + .../fluent/models/CatalogInner.java | 222 ++ .../models/ChangeDirectoryResponseInner.java | 84 + .../models/CurrentQuotaLimitBaseInner.java | 55 + .../ExchangeOperationResultResponseInner.java | 165 ++ .../fluent/models/MergeProperties.java | 54 + .../fluent/models/OperationResponseInner.java | 158 ++ .../fluent/models/PatchProperties.java | 254 ++ .../models/PurchaseRequestProperties.java | 360 +++ .../models/QuotaRequestDetailsInner.java | 112 + .../fluent/models/QuotaRequestProperties.java | 115 + .../models/QuotaRequestStatusDetails.java | 55 + .../QuotaRequestSubmitResponse201Inner.java | 106 + .../fluent/models/RefundResponseInner.java | 80 + .../models/ReservationOrderProperties.java | 375 +++ .../models/ReservationOrderResponseInner.java | 391 +++ .../models/ReservationResponseInner.java | 180 ++ .../SavingsPlanPurchaseRequestProperties.java | 223 ++ .../fluent/models/SplitProperties.java | 80 + .../fluent/models/package-info.java | 6 + .../reservations/fluent/package-info.java | 6 + .../AppliedReservationsImpl.java | 46 + .../AvailableScopePropertiesImpl.java | 34 + .../AzureReservationApiBuilder.java | 123 + .../AzureReservationApiImpl.java | 388 +++ ...teExchangeOperationResultResponseImpl.java | 52 + .../CalculateExchangesClientImpl.java | 291 ++ .../CalculateExchangesImpl.java | 54 + .../CalculatePriceResponseImpl.java | 34 + .../CalculateRefundResponseImpl.java | 38 + .../CalculateRefundsClientImpl.java | 201 ++ .../implementation/CalculateRefundsImpl.java | 61 + .../implementation/CatalogImpl.java | 110 + .../ChangeDirectoryResponseImpl.java | 45 + .../CurrentQuotaLimitBaseImpl.java | 138 + .../ExchangeOperationResultResponseImpl.java | 52 + .../implementation/ExchangesClientImpl.java | 286 ++ .../implementation/ExchangesImpl.java | 53 + .../implementation/OperationResponseImpl.java | 49 + .../implementation/OperationsClientImpl.java | 281 ++ .../implementation/OperationsImpl.java | 45 + .../QuotaRequestDetailsImpl.java | 67 + .../QuotaRequestStatusClientImpl.java | 599 ++++ .../QuotaRequestStatusImpl.java | 80 + .../QuotaRequestSubmitResponse201Impl.java | 50 + .../implementation/QuotasClientImpl.java | 1337 +++++++++ .../implementation/QuotasImpl.java | 147 + .../implementation/RefundResponseImpl.java | 37 + .../ReservationOrderResponseImpl.java | 123 + .../ReservationOrdersClientImpl.java | 952 +++++++ .../implementation/ReservationOrdersImpl.java | 142 + .../ReservationResponseImpl.java | 69 + .../ReservationsClientImpl.java | 2478 +++++++++++++++++ .../implementation/ReservationsImpl.java | 225 ++ .../ResourceProvidersClientImpl.java | 624 +++++ .../implementation/ResourceProvidersImpl.java | 96 + .../implementation/ReturnsClientImpl.java | 312 +++ .../implementation/ReturnsImpl.java | 53 + .../reservations/implementation/Utils.java | 204 ++ .../implementation/package-info.java | 6 + .../models/AppliedReservationList.java | 77 + .../models/AppliedReservations.java | 45 + .../models/AppliedScopeProperties.java | 159 ++ .../reservations/models/AppliedScopeType.java | 50 + .../models/AvailableScopeProperties.java | 24 + .../models/AvailableScopeRequest.java | 53 + .../AvailableScopeRequestProperties.java | 51 + .../models/BillingInformation.java | 114 + .../reservations/models/BillingPlan.java | 44 + ...culateExchangeOperationResultResponse.java | 54 + ...alculateExchangeOperationResultStatus.java | 54 + .../models/CalculateExchangeRequest.java | 53 + .../CalculateExchangeRequestProperties.java | 114 + .../CalculateExchangeResponseProperties.java | 257 ++ .../models/CalculateExchanges.java | 37 + .../models/CalculatePriceResponse.java | 24 + .../CalculatePriceResponseProperties.java | 330 +++ ...esponsePropertiesBillingCurrencyTotal.java | 76 + ...esponsePropertiesPricingCurrencyTotal.java | 76 + .../models/CalculateRefundRequest.java | 81 + .../CalculateRefundRequestProperties.java | 79 + .../models/CalculateRefundResponse.java | 31 + .../reservations/models/CalculateRefunds.java | 42 + .../reservations/models/Catalog.java | 96 + .../reservations/models/CatalogMsrp.java | 53 + .../reservations/models/CatalogsResult.java | 85 + .../models/ChangeDirectoryRequest.java | 50 + .../models/ChangeDirectoryResponse.java | 32 + .../models/ChangeDirectoryResult.java | 130 + .../reservations/models/Commitment.java | 66 + .../reservations/models/CommitmentGrain.java | 44 + .../models/CurrentQuotaLimitBase.java | 150 + .../models/ErrorResponseCode.java | 229 ++ .../ExchangeOperationResultResponse.java | 53 + .../models/ExchangeOperationResultStatus.java | 56 + .../models/ExchangePolicyError.java | 76 + .../models/ExchangePolicyErrors.java | 54 + .../reservations/models/ExchangeRequest.java | 53 + .../models/ExchangeRequestProperties.java | 50 + .../models/ExchangeResponseProperties.java | 257 ++ .../reservations/models/Exchanges.java | 37 + .../models/ExtendedStatusInfo.java | 76 + .../models/InstanceFlexibility.java | 50 + .../reservations/models/Kind.java | 48 + .../reservations/models/MergeRequest.java | 69 + .../reservations/models/OperationDisplay.java | 128 + .../reservations/models/OperationList.java | 81 + .../models/OperationResponse.java | 52 + .../models/OperationResultError.java | 82 + .../reservations/models/OperationStatus.java | 53 + .../reservations/models/Operations.java | 35 + .../reservations/models/PatchModel.java | 237 ++ .../PatchPropertiesRenewProperties.java | 53 + .../reservations/models/PaymentDetail.java | 220 ++ .../reservations/models/PaymentStatus.java | 53 + .../reservations/models/Price.java | 76 + .../models/ProvisioningState.java | 80 + .../reservations/models/PurchaseRequest.java | 385 +++ ...tPropertiesReservedResourceProperties.java | 54 + .../reservations/models/QuotaLimits.java | 83 + .../reservations/models/QuotaProperties.java | 196 ++ .../models/QuotaRequestDetails.java | 69 + .../models/QuotaRequestDetailsList.java | 83 + .../models/QuotaRequestState.java | 56 + .../models/QuotaRequestStatus.java | 88 + .../models/QuotaRequestSubmitResponse201.java | 52 + .../reservations/models/Quotas.java | 111 + .../reservations/models/QuotasGetHeaders.java | 58 + .../models/QuotasGetResponse.java | 41 + .../models/QuotasListHeaders.java | 58 + .../models/QuotasListNextHeaders.java | 58 + .../models/QuotasListNextResponse.java | 36 + .../models/QuotasListResponse.java | 36 + .../models/RefundBillingInformation.java | 192 ++ .../models/RefundPolicyError.java | 76 + .../models/RefundPolicyResult.java | 53 + .../models/RefundPolicyResultProperty.java | 112 + .../reservations/models/RefundRequest.java | 56 + .../models/RefundRequestProperties.java | 134 + .../reservations/models/RefundResponse.java | 31 + .../models/RefundResponseProperties.java | 192 ++ .../models/RenewPropertiesResponse.java | 119 + ...ropertiesResponseBillingCurrencyTotal.java | 79 + ...ropertiesResponsePricingCurrencyTotal.java | 79 + .../models/ReservationBillingPlan.java | 47 + .../reservations/models/ReservationList.java | 81 + .../models/ReservationMergeProperties.java | 85 + ...eservationOrderBillingPlanInformation.java | 139 + .../models/ReservationOrderList.java | 81 + .../models/ReservationOrderResponse.java | 148 + .../models/ReservationOrders.java | 150 + .../models/ReservationResponse.java | 81 + .../models/ReservationSplitProperties.java | 83 + .../models/ReservationStatusCode.java | 71 + .../models/ReservationSummary.java | 159 ++ .../models/ReservationSwapProperties.java | 84 + .../reservations/models/ReservationTerm.java | 50 + .../models/ReservationToExchange.java | 134 + ...eservationToPurchaseCalculateExchange.java | 82 + .../models/ReservationToPurchaseExchange.java | 163 ++ .../models/ReservationToReturn.java | 76 + .../ReservationToReturnForExchange.java | 160 ++ .../ReservationUtilizationAggregates.java | 84 + .../reservations/models/Reservations.java | 322 +++ .../models/ReservationsListResult.java | 88 + .../models/ReservationsProperties.java | 911 ++++++ .../ReservationsPropertiesUtilization.java | 69 + .../models/ReservedResourceType.java | 119 + .../reservations/models/ResourceName.java | 65 + .../models/ResourceProviders.java | 87 + .../reservations/models/ResourceType.java | 56 + .../reservations/models/Returns.java | 39 + .../models/SavingsPlanPurchaseRequest.java | 237 ++ .../reservations/models/SavingsPlanTerm.java | 47 + ...avingsPlanToPurchaseCalculateExchange.java | 82 + .../models/SavingsPlanToPurchaseExchange.java | 163 ++ .../reservations/models/ScopeProperties.java | 76 + .../reservations/models/SkuCapability.java | 76 + .../reservations/models/SkuName.java | 50 + .../reservations/models/SkuProperty.java | 76 + .../reservations/models/SkuRestriction.java | 106 + .../reservations/models/SplitRequest.java | 92 + .../reservations/models/SubRequest.java | 168 ++ .../models/SubscriptionScopeProperties.java | 54 + .../reservations/models/package-info.java | 6 + .../reservations/package-info.java | 6 + .../src/main/java/module-info.java | 19 + .../CalculateExchangePostSamples.java | 86 + .../generated/CalculateRefundPostSamples.java | 38 + .../generated/ExchangePostSamples.java | 29 + .../generated/OperationListSamples.java | 20 + .../generated/QuotaCreateOrUpdateSamples.java | 79 + .../generated/QuotaGetSamples.java | 27 + .../generated/QuotaListSamples.java | 45 + .../QuotaRequestStatusGetSamples.java | 65 + .../QuotaRequestStatusListSamples.java | 29 + .../generated/QuotaUpdateSamples.java | 42 + .../generated/ReservationArchiveSamples.java | 25 + .../ReservationAvailableScopesSamples.java | 33 + .../generated/ReservationGetSamples.java | 26 + .../generated/ReservationListAllSamples.java | 29 + .../ReservationListRevisionsSamples.java | 25 + .../generated/ReservationListSamples.java | 20 + .../generated/ReservationMergeSamples.java | 33 + .../ReservationOrderCalculateSamples.java | 45 + ...eservationOrderChangeDirectorySamples.java | 27 + .../generated/ReservationOrderGetSamples.java | 37 + .../ReservationOrderListSamples.java | 20 + .../ReservationOrderPurchaseSamples.java | 47 + .../generated/ReservationSplitSamples.java | 31 + .../ReservationUnarchiveSamples.java | 25 + .../generated/ReservationUpdateSamples.java | 32 + ...viderGetAppliedReservationListSamples.java | 23 + .../ResourceProviderListSamples.java | 32 + .../generated/ReturnPostSamples.java | 39 + sdk/reservations/ci.yml | 47 + sdk/reservations/pom.xml | 15 + 240 files changed, 30339 insertions(+) create mode 100644 sdk/reservations/azure-resourcemanager-reservations/CHANGELOG.md create mode 100644 sdk/reservations/azure-resourcemanager-reservations/README.md create mode 100644 sdk/reservations/azure-resourcemanager-reservations/SAMPLE.md create mode 100644 sdk/reservations/azure-resourcemanager-reservations/pom.xml create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/ReservationsManager.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/AzureReservationApi.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/CalculateExchangesClient.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/CalculateRefundsClient.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/ExchangesClient.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/OperationsClient.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/QuotaRequestStatusClient.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/QuotasClient.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/ReservationOrdersClient.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/ReservationsClient.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/ResourceProvidersClient.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/ReturnsClient.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/AppliedReservationsInner.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/AppliedReservationsProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/AvailableScopePropertiesInner.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CalculateExchangeOperationResultResponseInner.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CalculatePriceResponseInner.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CalculateRefundResponseInner.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CatalogInner.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ChangeDirectoryResponseInner.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CurrentQuotaLimitBaseInner.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ExchangeOperationResultResponseInner.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/MergeProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/OperationResponseInner.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/PatchProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/PurchaseRequestProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/QuotaRequestDetailsInner.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/QuotaRequestProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/QuotaRequestStatusDetails.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/QuotaRequestSubmitResponse201Inner.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/RefundResponseInner.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ReservationOrderProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ReservationOrderResponseInner.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ReservationResponseInner.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/SavingsPlanPurchaseRequestProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/SplitProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/package-info.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/package-info.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/AppliedReservationsImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/AvailableScopePropertiesImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/AzureReservationApiBuilder.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/AzureReservationApiImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateExchangeOperationResultResponseImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateExchangesClientImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateExchangesImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculatePriceResponseImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateRefundResponseImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateRefundsClientImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateRefundsImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CatalogImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ChangeDirectoryResponseImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CurrentQuotaLimitBaseImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ExchangeOperationResultResponseImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ExchangesClientImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ExchangesImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/OperationResponseImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/OperationsClientImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/OperationsImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotaRequestDetailsImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotaRequestStatusClientImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotaRequestStatusImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotaRequestSubmitResponse201Impl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotasClientImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotasImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/RefundResponseImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationOrderResponseImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationOrdersClientImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationOrdersImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationResponseImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationsClientImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationsImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ResourceProvidersClientImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ResourceProvidersImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReturnsClientImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReturnsImpl.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/Utils.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/package-info.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AppliedReservationList.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AppliedReservations.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AppliedScopeProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AppliedScopeType.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AvailableScopeProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AvailableScopeRequest.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AvailableScopeRequestProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/BillingInformation.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/BillingPlan.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeOperationResultResponse.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeOperationResultStatus.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeRequest.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeRequestProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeResponseProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchanges.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculatePriceResponse.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculatePriceResponseProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculatePriceResponsePropertiesBillingCurrencyTotal.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculatePriceResponsePropertiesPricingCurrencyTotal.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateRefundRequest.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateRefundRequestProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateRefundResponse.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateRefunds.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Catalog.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CatalogMsrp.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CatalogsResult.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ChangeDirectoryRequest.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ChangeDirectoryResponse.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ChangeDirectoryResult.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Commitment.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CommitmentGrain.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CurrentQuotaLimitBase.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ErrorResponseCode.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeOperationResultResponse.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeOperationResultStatus.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangePolicyError.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangePolicyErrors.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeRequest.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeRequestProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeResponseProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Exchanges.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExtendedStatusInfo.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/InstanceFlexibility.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Kind.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/MergeRequest.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationDisplay.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationList.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationResponse.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationResultError.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationStatus.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Operations.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PatchModel.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PatchPropertiesRenewProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PaymentDetail.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PaymentStatus.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Price.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ProvisioningState.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PurchaseRequest.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PurchaseRequestPropertiesReservedResourceProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaLimits.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaRequestDetails.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaRequestDetailsList.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaRequestState.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaRequestStatus.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaRequestSubmitResponse201.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Quotas.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasGetHeaders.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasGetResponse.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasListHeaders.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasListNextHeaders.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasListNextResponse.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasListResponse.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundBillingInformation.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundPolicyError.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundPolicyResult.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundPolicyResultProperty.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundRequest.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundRequestProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundResponse.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundResponseProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RenewPropertiesResponse.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RenewPropertiesResponseBillingCurrencyTotal.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RenewPropertiesResponsePricingCurrencyTotal.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationBillingPlan.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationList.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationMergeProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationOrderBillingPlanInformation.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationOrderList.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationOrderResponse.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationOrders.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationResponse.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationSplitProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationStatusCode.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationSummary.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationSwapProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationTerm.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToExchange.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToPurchaseCalculateExchange.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToPurchaseExchange.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToReturn.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToReturnForExchange.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationUtilizationAggregates.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Reservations.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationsListResult.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationsProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationsPropertiesUtilization.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservedResourceType.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ResourceName.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ResourceProviders.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ResourceType.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Returns.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SavingsPlanPurchaseRequest.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SavingsPlanTerm.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SavingsPlanToPurchaseCalculateExchange.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SavingsPlanToPurchaseExchange.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ScopeProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SkuCapability.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SkuName.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SkuProperty.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SkuRestriction.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SplitRequest.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SubRequest.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SubscriptionScopeProperties.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/package-info.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/package-info.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/main/java/module-info.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/CalculateExchangePostSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/CalculateRefundPostSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ExchangePostSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/OperationListSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaCreateOrUpdateSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaGetSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaListSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaRequestStatusGetSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaRequestStatusListSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaUpdateSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationArchiveSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationAvailableScopesSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationGetSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationListAllSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationListRevisionsSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationListSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationMergeSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderCalculateSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderChangeDirectorySamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderGetSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderListSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderPurchaseSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationSplitSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationUnarchiveSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationUpdateSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ResourceProviderGetAppliedReservationListSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ResourceProviderListSamples.java create mode 100644 sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReturnPostSamples.java create mode 100644 sdk/reservations/ci.yml create mode 100644 sdk/reservations/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index dab7c82f2261c..225a72df13d1a 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -392,6 +392,7 @@ com.azure.resourcemanager:azure-resourcemanager-appcomplianceautomation;1.0.0-be com.azure.resourcemanager:azure-resourcemanager-servicenetworking;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-recoveryservicessiterecovery;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-billingbenefits;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-reservations;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index 5081c08637ea1..31567fecfcf84 100644 --- a/pom.xml +++ b/pom.xml @@ -141,6 +141,7 @@ sdk/redisenterprise sdk/relay sdk/remoterendering + sdk/reservations sdk/resourceconnector sdk/resourcegraph sdk/resourcehealth diff --git a/sdk/reservations/azure-resourcemanager-reservations/CHANGELOG.md b/sdk/reservations/azure-resourcemanager-reservations/CHANGELOG.md new file mode 100644 index 0000000000000..c41a420402ec3 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-01-29) + +- Azure Resource Manager reservations client library for Java. This package contains Microsoft Azure SDK for reservations Management SDK. This API describe Azure Reservation. Package tag package-2022-11. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/reservations/azure-resourcemanager-reservations/README.md b/sdk/reservations/azure-resourcemanager-reservations/README.md new file mode 100644 index 0000000000000..d8356602e28f9 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/README.md @@ -0,0 +1,105 @@ +# Azure Resource Manager reservations client library for Java + +Azure Resource Manager reservations client library for Java. + +This package contains Microsoft Azure SDK for reservations Management SDK. This API describe Azure Reservation. Package tag package-2022-11. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-reservations;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-reservations + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configuration of the following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +With above configuration, `azure` client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +ReservationsManager manager = ReservationsManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/reservations/azure-resourcemanager-reservations/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[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/reservations/azure-resourcemanager-reservations/SAMPLE.md b/sdk/reservations/azure-resourcemanager-reservations/SAMPLE.md new file mode 100644 index 0000000000000..d3cdfabcd0977 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/SAMPLE.md @@ -0,0 +1,1041 @@ +# Code snippets and samples + + +## CalculateExchange + +- [Post](#calculateexchange_post) + +## CalculateRefund + +- [Post](#calculaterefund_post) + +## Exchange + +- [Post](#exchange_post) + +## Operation + +- [List](#operation_list) + +## Quota + +- [CreateOrUpdate](#quota_createorupdate) +- [Get](#quota_get) +- [List](#quota_list) +- [Update](#quota_update) + +## QuotaRequestStatus + +- [Get](#quotarequeststatus_get) +- [List](#quotarequeststatus_list) + +## Reservation + +- [Archive](#reservation_archive) +- [AvailableScopes](#reservation_availablescopes) +- [Get](#reservation_get) +- [List](#reservation_list) +- [ListAll](#reservation_listall) +- [ListRevisions](#reservation_listrevisions) +- [Merge](#reservation_merge) +- [Split](#reservation_split) +- [Unarchive](#reservation_unarchive) +- [Update](#reservation_update) + +## ReservationOrder + +- [Calculate](#reservationorder_calculate) +- [ChangeDirectory](#reservationorder_changedirectory) +- [Get](#reservationorder_get) +- [List](#reservationorder_list) +- [Purchase](#reservationorder_purchase) + +## ResourceProvider + +- [GetAppliedReservationList](#resourceprovider_getappliedreservationlist) +- [List](#resourceprovider_list) + +## Return + +- [Post](#return_post) +### CalculateExchange_Post + +```java +import com.azure.resourcemanager.reservations.models.AppliedScopeProperties; +import com.azure.resourcemanager.reservations.models.AppliedScopeType; +import com.azure.resourcemanager.reservations.models.CalculateExchangeRequest; +import com.azure.resourcemanager.reservations.models.CalculateExchangeRequestProperties; +import com.azure.resourcemanager.reservations.models.Commitment; +import com.azure.resourcemanager.reservations.models.CommitmentGrain; +import com.azure.resourcemanager.reservations.models.InstanceFlexibility; +import com.azure.resourcemanager.reservations.models.PurchaseRequest; +import com.azure.resourcemanager.reservations.models.PurchaseRequestPropertiesReservedResourceProperties; +import com.azure.resourcemanager.reservations.models.ReservationBillingPlan; +import com.azure.resourcemanager.reservations.models.ReservationTerm; +import com.azure.resourcemanager.reservations.models.ReservationToReturn; +import com.azure.resourcemanager.reservations.models.ReservedResourceType; +import com.azure.resourcemanager.reservations.models.SavingsPlanPurchaseRequest; +import com.azure.resourcemanager.reservations.models.SavingsPlanTerm; +import com.azure.resourcemanager.reservations.models.SkuName; +import java.util.Arrays; + +/** Samples for CalculateExchange Post. */ +public final class CalculateExchangePostSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/CalculateExchange.json + */ + /** + * Sample code: CalculateExchange. + * + * @param manager Entry point to ReservationsManager. + */ + public static void calculateExchange(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .calculateExchanges() + .post( + new CalculateExchangeRequest() + .withProperties( + new CalculateExchangeRequestProperties() + .withReservationsToPurchase( + Arrays + .asList( + new PurchaseRequest() + .withSku(new SkuName().withName("Standard_B1ls")) + .withLocation("westus") + .withReservedResourceType(ReservedResourceType.VIRTUAL_MACHINES) + .withBillingScopeId("/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83") + .withTerm(ReservationTerm.P1Y) + .withBillingPlan(ReservationBillingPlan.UPFRONT) + .withQuantity(1) + .withDisplayName("testDisplayName") + .withAppliedScopeType(AppliedScopeType.SHARED) + .withRenew(false) + .withReservedResourceProperties( + new PurchaseRequestPropertiesReservedResourceProperties() + .withInstanceFlexibility(InstanceFlexibility.ON)))) + .withSavingsPlansToPurchase( + Arrays + .asList( + new SavingsPlanPurchaseRequest() + .withSku(new SkuName().withName("Compute_Savings_Plan")) + .withDisplayName("ComputeSavingsPlan") + .withBillingScopeId("/subscriptions/10000000-0000-0000-0000-000000000000") + .withTerm(SavingsPlanTerm.P1Y) + .withAppliedScopeType(AppliedScopeType.SINGLE) + .withAppliedScopeProperties( + new AppliedScopeProperties() + .withResourceGroupId( + "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/testrg")) + .withCommitment( + new Commitment() + .withCurrencyCode("fakeTokenPlaceholder") + .withAmount(15.23D) + .withGrain(CommitmentGrain.HOURLY)))) + .withReservationsToExchange( + Arrays + .asList( + new ReservationToReturn() + .withReservationId( + "/providers/microsoft.capacity/reservationOrders/1f14354c-dc12-4c8d-8090-6f295a3a34aa/reservations/c8c926bd-fc5d-4e29-9d43-b68340ac23a6") + .withQuantity(1)))), + com.azure.core.util.Context.NONE); + } +} +``` + +### CalculateRefund_Post + +```java +import com.azure.resourcemanager.reservations.models.CalculateRefundRequest; +import com.azure.resourcemanager.reservations.models.CalculateRefundRequestProperties; +import com.azure.resourcemanager.reservations.models.ReservationToReturn; + +/** Samples for CalculateRefund Post. */ +public final class CalculateRefundPostSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/CalculateRefund.json + */ + /** + * Sample code: CalculateRefund. + * + * @param manager Entry point to ReservationsManager. + */ + public static void calculateRefund(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .calculateRefunds() + .postWithResponse( + "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", + new CalculateRefundRequest() + .withId("/providers/microsoft.capacity/reservationOrders/50000000-aaaa-bbbb-cccc-100000000004") + .withProperties( + new CalculateRefundRequestProperties() + .withScope("Reservation") + .withReservationToReturn( + new ReservationToReturn() + .withReservationId( + "/providers/microsoft.capacity/reservationOrders/50000000-aaaa-bbbb-cccc-100000000004/reservations/40000000-aaaa-bbbb-cccc-100000000000") + .withQuantity(1))), + com.azure.core.util.Context.NONE); + } +} +``` + +### Exchange_Post + +```java +import com.azure.resourcemanager.reservations.models.ExchangeRequest; +import com.azure.resourcemanager.reservations.models.ExchangeRequestProperties; + +/** Samples for Exchange Post. */ +public final class ExchangePostSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Exchange.json + */ + /** + * Sample code: Exchange. + * + * @param manager Entry point to ReservationsManager. + */ + public static void exchange(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .exchanges() + .post( + new ExchangeRequest() + .withProperties( + new ExchangeRequestProperties().withSessionId("66e2ac8f-439e-4345-8235-6fef07608081")), + com.azure.core.util.Context.NONE); + } +} +``` + +### Operation_List + +```java +/** Samples for Operation List. */ +public final class OperationListSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetOperations.json + */ + /** + * Sample code: GetOperations. + * + * @param manager Entry point to ReservationsManager. + */ + public static void getOperations(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Quota_CreateOrUpdate + +```java +import com.azure.resourcemanager.reservations.models.QuotaProperties; +import com.azure.resourcemanager.reservations.models.ResourceName; +import com.azure.resourcemanager.reservations.models.ResourceType; + +/** Samples for Quota CreateOrUpdate. */ +public final class QuotaCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestDedicated.json + */ + /** + * Sample code: Quotas_Request_PutForMachineLearningServices_DedicatedResource. + * + * @param manager Entry point to ReservationsManager. + */ + public static void quotasRequestPutForMachineLearningServicesDedicatedResource( + com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .quotas() + .define("StandardDv2Family") + .withExistingLocation("D7EC67B3-7657-4966-BFFC-41EFD36BAAB3", "Microsoft.MachineLearningServices", "eastus") + .withProperties( + new QuotaProperties() + .withLimit(200) + .withUnit("Count") + .withName(new ResourceName().withValue("StandardDv2Family")) + .withResourceType(ResourceType.DEDICATED)) + .create(); + } + + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestLowPriority.json + */ + /** + * Sample code: Quotas_Request_PutForMachineLearningServices_LowPriorityResource. + * + * @param manager Entry point to ReservationsManager. + */ + public static void quotasRequestPutForMachineLearningServicesLowPriorityResource( + com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .quotas() + .define("TotalLowPriorityCores") + .withExistingLocation("D7EC67B3-7657-4966-BFFC-41EFD36BAAB3", "Microsoft.MachineLearningServices", "eastus") + .withProperties( + new QuotaProperties() + .withLimit(200) + .withUnit("Count") + .withName(new ResourceName().withValue("TotalLowPriorityCores")) + .withResourceType(ResourceType.LOW_PRIORITY)) + .create(); + } + + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putComputeOneSkuQuotaRequest.json + */ + /** + * Sample code: Quotas_Request_PutForCompute. + * + * @param manager Entry point to ReservationsManager. + */ + public static void quotasRequestPutForCompute(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .quotas() + .define("standardFSv2Family") + .withExistingLocation("D7EC67B3-7657-4966-BFFC-41EFD36BAAB3", "Microsoft.Compute", "eastus") + .withProperties( + new QuotaProperties() + .withLimit(200) + .withUnit("Count") + .withName(new ResourceName().withValue("standardFSv2Family"))) + .create(); + } +} +``` + +### Quota_Get + +```java +/** Samples for Quota Get. */ +public final class QuotaGetSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeOneSkuUsages.json + */ + /** + * Sample code: Quotas_Request_ForCompute. + * + * @param manager Entry point to ReservationsManager. + */ + public static void quotasRequestForCompute(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .quotas() + .getWithResponse( + "00000000-0000-0000-0000-000000000000", + "Microsoft.Compute", + "eastus", + "standardNDSFamily", + com.azure.core.util.Context.NONE); + } +} +``` + +### Quota_List + +```java +/** Samples for Quota List. */ +public final class QuotaListSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeUsages.json + */ + /** + * Sample code: Quotas_listUsagesForCompute. + * + * @param manager Entry point to ReservationsManager. + */ + public static void quotasListUsagesForCompute(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .quotas() + .list( + "00000000-0000-0000-0000-000000000000", + "Microsoft.Compute", + "eastus", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getMachineLearningServicesUsages.json + */ + /** + * Sample code: Quotas_listUsagesMachineLearningServices. + * + * @param manager Entry point to ReservationsManager. + */ + public static void quotasListUsagesMachineLearningServices( + com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .quotas() + .list( + "00000000-0000-0000-0000-000000000000", + "Microsoft.MachineLearningServices", + "eastus", + com.azure.core.util.Context.NONE); + } +} +``` + +### Quota_Update + +```java +import com.azure.resourcemanager.reservations.models.CurrentQuotaLimitBase; +import com.azure.resourcemanager.reservations.models.QuotaProperties; +import com.azure.resourcemanager.reservations.models.ResourceName; + +/** Samples for Quota Update. */ +public final class QuotaUpdateSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/patchComputeQuotaRequest.json + */ + /** + * Sample code: Quotas_Request_PatchForCompute. + * + * @param manager Entry point to ReservationsManager. + */ + public static void quotasRequestPatchForCompute( + com.azure.resourcemanager.reservations.ReservationsManager manager) { + CurrentQuotaLimitBase resource = + manager + .quotas() + .getWithResponse( + "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3", + "Microsoft.Compute", + "eastus", + "standardFSv2Family", + com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withProperties( + new QuotaProperties() + .withLimit(200) + .withUnit("Count") + .withName(new ResourceName().withValue("standardFSv2Family"))) + .apply(); + } +} +``` + +### QuotaRequestStatus_Get + +```java +/** Samples for QuotaRequestStatus Get. */ +public final class QuotaRequestStatusGetSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusFailed.json + */ + /** + * Sample code: QuotaRequestFailed. + * + * @param manager Entry point to ReservationsManager. + */ + public static void quotaRequestFailed(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .quotaRequestStatus() + .getWithResponse( + "00000000-0000-0000-0000-000000000000", + "Microsoft.Compute", + "eastus", + "2B5C8515-37D8-4B6A-879B-CD641A2CF605", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusById.json + */ + /** + * Sample code: QuotaRequestStatus. + * + * @param manager Entry point to ReservationsManager. + */ + public static void quotaRequestStatus(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .quotaRequestStatus() + .getWithResponse( + "00000000-0000-0000-0000-000000000000", + "Microsoft.Compute", + "eastus", + "2B5C8515-37D8-4B6A-879B-CD641A2CF605", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusInProgress.json + */ + /** + * Sample code: QuotaRequestInProgress. + * + * @param manager Entry point to ReservationsManager. + */ + public static void quotaRequestInProgress(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .quotaRequestStatus() + .getWithResponse( + "00000000-0000-0000-0000-000000000000", + "Microsoft.Compute", + "eastus", + "2B5C8515-37D8-4B6A-879B-CD641A2CF605", + com.azure.core.util.Context.NONE); + } +} +``` + +### QuotaRequestStatus_List + +```java +/** Samples for QuotaRequestStatus List. */ +public final class QuotaRequestStatusListSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestsHistory.json + */ + /** + * Sample code: QuotaRequestHistory. + * + * @param manager Entry point to ReservationsManager. + */ + public static void quotaRequestHistory(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .quotaRequestStatus() + .list( + "3f75fdf7-977e-44ad-990d-99f14f0f299f", + "Microsoft.Compute", + "eastus", + null, + null, + null, + com.azure.core.util.Context.NONE); + } +} +``` + +### Reservation_Archive + +```java +/** Samples for Reservation Archive. */ +public final class ReservationArchiveSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Archive.json + */ + /** + * Sample code: Archive. + * + * @param manager Entry point to ReservationsManager. + */ + public static void archive(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservations() + .archiveWithResponse( + "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", + "356e7ae4-84d0-4da6-ab4b-d6b94f3557da", + com.azure.core.util.Context.NONE); + } +} +``` + +### Reservation_AvailableScopes + +```java +import com.azure.resourcemanager.reservations.models.AvailableScopeRequest; +import com.azure.resourcemanager.reservations.models.AvailableScopeRequestProperties; +import java.util.Arrays; + +/** Samples for Reservation AvailableScopes. */ +public final class ReservationAvailableScopesSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetAvailableScope.json + */ + /** + * Sample code: AvailableScopes. + * + * @param manager Entry point to ReservationsManager. + */ + public static void availableScopes(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservations() + .availableScopes( + "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", + "356e7ae4-84d0-4da6-ab4b-d6b94f3557da", + new AvailableScopeRequest() + .withProperties( + new AvailableScopeRequestProperties() + .withScopes(Arrays.asList("/subscriptions/efc7c997-7700-4a74-b731-55aec16c15e9"))), + com.azure.core.util.Context.NONE); + } +} +``` + +### Reservation_Get + +```java +/** Samples for Reservation Get. */ +public final class ReservationGetSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationDetails.json + */ + /** + * Sample code: GetReservation. + * + * @param manager Entry point to ReservationsManager. + */ + public static void getReservation(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservations() + .getWithResponse( + "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", + "6ef59113-3482-40da-8d79-787f823e34bc", + "renewProperties", + com.azure.core.util.Context.NONE); + } +} +``` + +### Reservation_List + +```java +/** Samples for Reservation List. */ +public final class ReservationListSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationsFromOrder.json + */ + /** + * Sample code: ReservationList. + * + * @param manager Entry point to ReservationsManager. + */ + public static void reservationList(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager.reservations().list("276e7ae4-84d0-4da6-ab4b-d6b94f3557da", com.azure.core.util.Context.NONE); + } +} +``` + +### Reservation_ListAll + +```java +/** Samples for Reservation ListAll. */ +public final class ReservationListAllSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservations.json + */ + /** + * Sample code: ReservationListAll. + * + * @param manager Entry point to ReservationsManager. + */ + public static void reservationListAll(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservations() + .listAll( + "(properties/archived eq false)", + "properties/displayName asc", + "true", + 50.0F, + null, + 1.0F, + com.azure.core.util.Context.NONE); + } +} +``` + +### Reservation_ListRevisions + +```java +/** Samples for Reservation ListRevisions. */ +public final class ReservationListRevisionsSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationRevisions.json + */ + /** + * Sample code: ReservationRevisions. + * + * @param manager Entry point to ReservationsManager. + */ + public static void reservationRevisions(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservations() + .listRevisions( + "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", + "6ef59113-3482-40da-8d79-787f823e34bc", + com.azure.core.util.Context.NONE); + } +} +``` + +### Reservation_Merge + +```java +import com.azure.resourcemanager.reservations.models.MergeRequest; +import java.util.Arrays; + +/** Samples for Reservation Merge. */ +public final class ReservationMergeSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/MergeReservations.json + */ + /** + * Sample code: Merge. + * + * @param manager Entry point to ReservationsManager. + */ + public static void merge(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservations() + .merge( + "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", + new MergeRequest() + .withSources( + Arrays + .asList( + "/providers/Microsoft.Capacity/reservationOrders/c0565a8a-4491-4e77-b07b-5e6d66718e1c/reservations/cea04232-932e-47db-acb5-e29a945ecc73", + "/providers/Microsoft.Capacity/reservationOrders/c0565a8a-4491-4e77-b07b-5e6d66718e1c/reservations/5bf54dc7-dacd-4f46-a16b-7b78f4a59799")), + com.azure.core.util.Context.NONE); + } +} +``` + +### Reservation_Split + +```java +import com.azure.resourcemanager.reservations.models.SplitRequest; +import java.util.Arrays; + +/** Samples for Reservation Split. */ +public final class ReservationSplitSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/SplitReservation.json + */ + /** + * Sample code: Split. + * + * @param manager Entry point to ReservationsManager. + */ + public static void split(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservations() + .split( + "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", + new SplitRequest() + .withQuantities(Arrays.asList(1, 2)) + .withReservationId( + "/providers/Microsoft.Capacity/reservationOrders/276e7ae4-84d0-4da6-ab4b-d6b94f3557da/reservations/bcae77cd-3119-4766-919f-b50d36c75c7a"), + com.azure.core.util.Context.NONE); + } +} +``` + +### Reservation_Unarchive + +```java +/** Samples for Reservation Unarchive. */ +public final class ReservationUnarchiveSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Unarchive.json + */ + /** + * Sample code: Unarchive. + * + * @param manager Entry point to ReservationsManager. + */ + public static void unarchive(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservations() + .unarchiveWithResponse( + "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", + "356e7ae4-84d0-4da6-ab4b-d6b94f3557da", + com.azure.core.util.Context.NONE); + } +} +``` + +### Reservation_Update + +```java +import com.azure.resourcemanager.reservations.models.AppliedScopeType; +import com.azure.resourcemanager.reservations.models.InstanceFlexibility; +import com.azure.resourcemanager.reservations.models.PatchModel; + +/** Samples for Reservation Update. */ +public final class ReservationUpdateSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/UpdateReservation.json + */ + /** + * Sample code: PatchReservation. + * + * @param manager Entry point to ReservationsManager. + */ + public static void patchReservation(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservations() + .update( + "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", + "6ef59113-3482-40da-8d79-787f823e34bc", + new PatchModel() + .withAppliedScopeType(AppliedScopeType.SHARED) + .withInstanceFlexibility(InstanceFlexibility.OFF), + com.azure.core.util.Context.NONE); + } +} +``` + +### ReservationOrder_Calculate + +```java +import com.azure.resourcemanager.reservations.models.AppliedScopeType; +import com.azure.resourcemanager.reservations.models.InstanceFlexibility; +import com.azure.resourcemanager.reservations.models.PurchaseRequest; +import com.azure.resourcemanager.reservations.models.PurchaseRequestPropertiesReservedResourceProperties; +import com.azure.resourcemanager.reservations.models.ReservationBillingPlan; +import com.azure.resourcemanager.reservations.models.ReservationTerm; +import com.azure.resourcemanager.reservations.models.ReservedResourceType; +import com.azure.resourcemanager.reservations.models.SkuName; + +/** Samples for ReservationOrder Calculate. */ +public final class ReservationOrderCalculateSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/CalculateReservationOrder.json + */ + /** + * Sample code: CalculatePrice. + * + * @param manager Entry point to ReservationsManager. + */ + public static void calculatePrice(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservationOrders() + .calculateWithResponse( + new PurchaseRequest() + .withSku(new SkuName().withName("standard_D1")) + .withLocation("westus") + .withReservedResourceType(ReservedResourceType.VIRTUAL_MACHINES) + .withBillingScopeId("/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83") + .withTerm(ReservationTerm.P1Y) + .withBillingPlan(ReservationBillingPlan.MONTHLY) + .withQuantity(1) + .withDisplayName("TestReservationOrder") + .withAppliedScopeType(AppliedScopeType.SHARED) + .withReservedResourceProperties( + new PurchaseRequestPropertiesReservedResourceProperties() + .withInstanceFlexibility(InstanceFlexibility.ON)), + com.azure.core.util.Context.NONE); + } +} +``` + +### ReservationOrder_ChangeDirectory + +```java +import com.azure.resourcemanager.reservations.models.ChangeDirectoryRequest; + +/** Samples for ReservationOrder ChangeDirectory. */ +public final class ReservationOrderChangeDirectorySamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/ChangeDirectoryReservationOrder.json + */ + /** + * Sample code: ChangeDirectory. + * + * @param manager Entry point to ReservationsManager. + */ + public static void changeDirectory(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservationOrders() + .changeDirectoryWithResponse( + "a075419f-44cc-497f-b68a-14ee811d48b9", + new ChangeDirectoryRequest().withDestinationTenantId("906655ea-30be-4587-9d12-b50e077b0f32"), + com.azure.core.util.Context.NONE); + } +} +``` + +### ReservationOrder_Get + +```java +/** Samples for ReservationOrder Get. */ +public final class ReservationOrderGetSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationOrderDetailsWithExpandPlanInformation.json + */ + /** + * Sample code: GetReservationWithExpandPayments. + * + * @param manager Entry point to ReservationsManager. + */ + public static void getReservationWithExpandPayments( + com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservationOrders() + .getWithResponse("a075419f-44cc-497f-b68a-14ee811d48b9", "schedule", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationOrderDetails.json + */ + /** + * Sample code: GetReservationOrder. + * + * @param manager Entry point to ReservationsManager. + */ + public static void getReservationOrder(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservationOrders() + .getWithResponse("a075419f-44cc-497f-b68a-14ee811d48b9", null, com.azure.core.util.Context.NONE); + } +} +``` + +### ReservationOrder_List + +```java +/** Samples for ReservationOrder List. */ +public final class ReservationOrderListSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationOrders.json + */ + /** + * Sample code: ReservationOrderList. + * + * @param manager Entry point to ReservationsManager. + */ + public static void reservationOrderList(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager.reservationOrders().list(com.azure.core.util.Context.NONE); + } +} +``` + +### ReservationOrder_Purchase + +```java +import com.azure.resourcemanager.reservations.models.AppliedScopeType; +import com.azure.resourcemanager.reservations.models.InstanceFlexibility; +import com.azure.resourcemanager.reservations.models.PurchaseRequest; +import com.azure.resourcemanager.reservations.models.PurchaseRequestPropertiesReservedResourceProperties; +import com.azure.resourcemanager.reservations.models.ReservationBillingPlan; +import com.azure.resourcemanager.reservations.models.ReservationTerm; +import com.azure.resourcemanager.reservations.models.ReservedResourceType; +import com.azure.resourcemanager.reservations.models.SkuName; + +/** Samples for ReservationOrder Purchase. */ +public final class ReservationOrderPurchaseSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/PurchaseReservationOrder.json + */ + /** + * Sample code: Purchase. + * + * @param manager Entry point to ReservationsManager. + */ + public static void purchase(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservationOrders() + .purchase( + "a075419f-44cc-497f-b68a-14ee811d48b9", + new PurchaseRequest() + .withSku(new SkuName().withName("standard_D1")) + .withLocation("westus") + .withReservedResourceType(ReservedResourceType.VIRTUAL_MACHINES) + .withBillingScopeId("/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83") + .withTerm(ReservationTerm.P1Y) + .withBillingPlan(ReservationBillingPlan.MONTHLY) + .withQuantity(1) + .withDisplayName("TestReservationOrder") + .withAppliedScopeType(AppliedScopeType.SHARED) + .withRenew(false) + .withReservedResourceProperties( + new PurchaseRequestPropertiesReservedResourceProperties() + .withInstanceFlexibility(InstanceFlexibility.ON)), + com.azure.core.util.Context.NONE); + } +} +``` + +### ResourceProvider_GetAppliedReservationList + +```java +/** Samples for ResourceProvider GetAppliedReservationList. */ +public final class ResourceProviderGetAppliedReservationListSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetAppliedReservations.json + */ + /** + * Sample code: AppliedReservationList. + * + * @param manager Entry point to ReservationsManager. + */ + public static void appliedReservationList(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .resourceProviders() + .getAppliedReservationListWithResponse( + "23bc208b-083f-4901-ae85-4f98c0c3b4b6", com.azure.core.util.Context.NONE); + } +} +``` + +### ResourceProvider_List + +```java +/** Samples for ResourceProvider List. */ +public final class ResourceProviderListSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetCatalog.json + */ + /** + * Sample code: Catalog. + * + * @param manager Entry point to ReservationsManager. + */ + public static void catalog(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .resourceProviders() + .list( + "23bc208b-083f-4901-ae85-4f98c0c3b4b6", + "VirtualMachines", + "eastus", + null, + null, + null, + null, + null, + null, + com.azure.core.util.Context.NONE); + } +} +``` + +### Return_Post + +```java +import com.azure.resourcemanager.reservations.models.RefundRequest; +import com.azure.resourcemanager.reservations.models.RefundRequestProperties; +import com.azure.resourcemanager.reservations.models.ReservationToReturn; + +/** Samples for Return Post. */ +public final class ReturnPostSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Return.json + */ + /** + * Sample code: Return a reservation. + * + * @param manager Entry point to ReservationsManager. + */ + public static void returnAReservation(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .returns() + .post( + "50000000-aaaa-bbbb-cccc-100000000004", + new RefundRequest() + .withProperties( + new RefundRequestProperties() + .withSessionId("10000000-aaaa-bbbb-cccc-200000000000") + .withScope("Reservation") + .withReservationToReturn( + new ReservationToReturn() + .withReservationId( + "/providers/microsoft.capacity/reservationOrders/50000000-aaaa-bbbb-cccc-100000000004/reservations/40000000-aaaa-bbbb-cccc-100000000000") + .withQuantity(1)) + .withReturnReason("PurchasedWrongProduct")), + com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/reservations/azure-resourcemanager-reservations/pom.xml b/sdk/reservations/azure-resourcemanager-reservations/pom.xml new file mode 100644 index 0000000000000..f3a38afbc0409 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-reservations + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for reservations Management + This package contains Microsoft Azure SDK for reservations Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. This API describe Azure Reservation. Package tag package-2022-11. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + true + + + + com.azure + azure-core + 1.35.0 + + + com.azure + azure-core-management + 1.10.0 + + + diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/ReservationsManager.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/ReservationsManager.java new file mode 100644 index 0000000000000..18a4f7dfa952d --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/ReservationsManager.java @@ -0,0 +1,425 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +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.logging.ClientLogger; +import com.azure.resourcemanager.reservations.fluent.AzureReservationApi; +import com.azure.resourcemanager.reservations.implementation.AzureReservationApiBuilder; +import com.azure.resourcemanager.reservations.implementation.CalculateExchangesImpl; +import com.azure.resourcemanager.reservations.implementation.CalculateRefundsImpl; +import com.azure.resourcemanager.reservations.implementation.ExchangesImpl; +import com.azure.resourcemanager.reservations.implementation.OperationsImpl; +import com.azure.resourcemanager.reservations.implementation.QuotaRequestStatusImpl; +import com.azure.resourcemanager.reservations.implementation.QuotasImpl; +import com.azure.resourcemanager.reservations.implementation.ReservationOrdersImpl; +import com.azure.resourcemanager.reservations.implementation.ReservationsImpl; +import com.azure.resourcemanager.reservations.implementation.ResourceProvidersImpl; +import com.azure.resourcemanager.reservations.implementation.ReturnsImpl; +import com.azure.resourcemanager.reservations.models.CalculateExchanges; +import com.azure.resourcemanager.reservations.models.CalculateRefunds; +import com.azure.resourcemanager.reservations.models.Exchanges; +import com.azure.resourcemanager.reservations.models.Operations; +import com.azure.resourcemanager.reservations.models.QuotaRequestStatus; +import com.azure.resourcemanager.reservations.models.Quotas; +import com.azure.resourcemanager.reservations.models.ReservationOrders; +import com.azure.resourcemanager.reservations.models.Reservations; +import com.azure.resourcemanager.reservations.models.ResourceProviders; +import com.azure.resourcemanager.reservations.models.Returns; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** Entry point to ReservationsManager. This API describe Azure Reservation. */ +public final class ReservationsManager { + private Reservations reservations; + + private ResourceProviders resourceProviders; + + private ReservationOrders reservationOrders; + + private Operations operations; + + private CalculateRefunds calculateRefunds; + + private Returns returns; + + private CalculateExchanges calculateExchanges; + + private Exchanges exchanges; + + private Quotas quotas; + + private QuotaRequestStatus quotaRequestStatus; + + private final AzureReservationApi clientObject; + + private ReservationsManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new AzureReservationApiBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of reservations service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the reservations service API instance. + */ + public static ReservationsManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of reservations service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the reservations service API instance. + */ + public static ReservationsManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ReservationsManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create ReservationsManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ReservationsManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + * + *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = + Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of reservations service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the reservations service API instance. + */ + public ReservationsManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.reservations") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new ReservationsManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Reservations. + * + * @return Resource collection API of Reservations. + */ + public Reservations reservations() { + if (this.reservations == null) { + this.reservations = new ReservationsImpl(clientObject.getReservations(), this); + } + return reservations; + } + + /** + * Gets the resource collection API of ResourceProviders. + * + * @return Resource collection API of ResourceProviders. + */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + + /** + * Gets the resource collection API of ReservationOrders. + * + * @return Resource collection API of ReservationOrders. + */ + public ReservationOrders reservationOrders() { + if (this.reservationOrders == null) { + this.reservationOrders = new ReservationOrdersImpl(clientObject.getReservationOrders(), this); + } + return reservationOrders; + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of CalculateRefunds. + * + * @return Resource collection API of CalculateRefunds. + */ + public CalculateRefunds calculateRefunds() { + if (this.calculateRefunds == null) { + this.calculateRefunds = new CalculateRefundsImpl(clientObject.getCalculateRefunds(), this); + } + return calculateRefunds; + } + + /** + * Gets the resource collection API of Returns. + * + * @return Resource collection API of Returns. + */ + public Returns returns() { + if (this.returns == null) { + this.returns = new ReturnsImpl(clientObject.getReturns(), this); + } + return returns; + } + + /** + * Gets the resource collection API of CalculateExchanges. + * + * @return Resource collection API of CalculateExchanges. + */ + public CalculateExchanges calculateExchanges() { + if (this.calculateExchanges == null) { + this.calculateExchanges = new CalculateExchangesImpl(clientObject.getCalculateExchanges(), this); + } + return calculateExchanges; + } + + /** + * Gets the resource collection API of Exchanges. + * + * @return Resource collection API of Exchanges. + */ + public Exchanges exchanges() { + if (this.exchanges == null) { + this.exchanges = new ExchangesImpl(clientObject.getExchanges(), this); + } + return exchanges; + } + + /** + * Gets the resource collection API of Quotas. It manages CurrentQuotaLimitBase. + * + * @return Resource collection API of Quotas. + */ + public Quotas quotas() { + if (this.quotas == null) { + this.quotas = new QuotasImpl(clientObject.getQuotas(), this); + } + return quotas; + } + + /** + * Gets the resource collection API of QuotaRequestStatus. + * + * @return Resource collection API of QuotaRequestStatus. + */ + public QuotaRequestStatus quotaRequestStatus() { + if (this.quotaRequestStatus == null) { + this.quotaRequestStatus = new QuotaRequestStatusImpl(clientObject.getQuotaRequestStatus(), this); + } + return quotaRequestStatus; + } + + /** + * @return Wrapped service client AzureReservationApi providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public AzureReservationApi serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/AzureReservationApi.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/AzureReservationApi.java new file mode 100644 index 0000000000000..5827e38e19a20 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/AzureReservationApi.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for AzureReservationApi class. */ +public interface AzureReservationApi { + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the ReservationsClient object to access its operations. + * + * @return the ReservationsClient object. + */ + ReservationsClient getReservations(); + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); + + /** + * Gets the ReservationOrdersClient object to access its operations. + * + * @return the ReservationOrdersClient object. + */ + ReservationOrdersClient getReservationOrders(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the CalculateRefundsClient object to access its operations. + * + * @return the CalculateRefundsClient object. + */ + CalculateRefundsClient getCalculateRefunds(); + + /** + * Gets the ReturnsClient object to access its operations. + * + * @return the ReturnsClient object. + */ + ReturnsClient getReturns(); + + /** + * Gets the CalculateExchangesClient object to access its operations. + * + * @return the CalculateExchangesClient object. + */ + CalculateExchangesClient getCalculateExchanges(); + + /** + * Gets the ExchangesClient object to access its operations. + * + * @return the ExchangesClient object. + */ + ExchangesClient getExchanges(); + + /** + * Gets the QuotasClient object to access its operations. + * + * @return the QuotasClient object. + */ + QuotasClient getQuotas(); + + /** + * Gets the QuotaRequestStatusClient object to access its operations. + * + * @return the QuotaRequestStatusClient object. + */ + QuotaRequestStatusClient getQuotaRequestStatus(); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/CalculateExchangesClient.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/CalculateExchangesClient.java new file mode 100644 index 0000000000000..7750eccc5c15b --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/CalculateExchangesClient.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.reservations.fluent.models.CalculateExchangeOperationResultResponseInner; +import com.azure.resourcemanager.reservations.models.CalculateExchangeRequest; + +/** An instance of this class provides access to all the operations defined in CalculateExchangesClient. */ +public interface CalculateExchangesClient { + /** + * Calculates the refund amounts and price of the new purchases. + * + *

Calculates price for exchanging `Reservations` if there are no policy errors. + * + * @param body Request containing purchases and refunds that need to be executed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 calculateExchange operation result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CalculateExchangeOperationResultResponseInner> + beginPost(CalculateExchangeRequest body); + + /** + * Calculates the refund amounts and price of the new purchases. + * + *

Calculates price for exchanging `Reservations` if there are no policy errors. + * + * @param body Request containing purchases and refunds that need to be executed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of calculateExchange operation result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CalculateExchangeOperationResultResponseInner> + beginPost(CalculateExchangeRequest body, Context context); + + /** + * Calculates the refund amounts and price of the new purchases. + * + *

Calculates price for exchanging `Reservations` if there are no policy errors. + * + * @param body Request containing purchases and refunds that need to be executed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return calculateExchange operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CalculateExchangeOperationResultResponseInner post(CalculateExchangeRequest body); + + /** + * Calculates the refund amounts and price of the new purchases. + * + *

Calculates price for exchanging `Reservations` if there are no policy errors. + * + * @param body Request containing purchases and refunds that need to be executed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return calculateExchange operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CalculateExchangeOperationResultResponseInner post(CalculateExchangeRequest body, Context context); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/CalculateRefundsClient.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/CalculateRefundsClient.java new file mode 100644 index 0000000000000..1d619edbb58ad --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/CalculateRefundsClient.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.reservations.fluent.models.CalculateRefundResponseInner; +import com.azure.resourcemanager.reservations.models.CalculateRefundRequest; + +/** An instance of this class provides access to all the operations defined in CalculateRefundsClient. */ +public interface CalculateRefundsClient { + /** + * Calculate the refund amount of a reservation order. + * + *

Calculate price for returning `Reservations` if there are no policy errors. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculating refund of a reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of calculate refund containing refund information of reservation along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response postWithResponse( + String reservationOrderId, CalculateRefundRequest body, Context context); + + /** + * Calculate the refund amount of a reservation order. + * + *

Calculate price for returning `Reservations` if there are no policy errors. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculating refund of a reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of calculate refund containing refund information of reservation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CalculateRefundResponseInner post(String reservationOrderId, CalculateRefundRequest body); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/ExchangesClient.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/ExchangesClient.java new file mode 100644 index 0000000000000..9b04e949c7a56 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/ExchangesClient.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.reservations.fluent.models.ExchangeOperationResultResponseInner; +import com.azure.resourcemanager.reservations.models.ExchangeRequest; + +/** An instance of this class provides access to all the operations defined in ExchangesClient. */ +public interface ExchangesClient { + /** + * Exchange Reservation(s) + * + *

Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + * + * @param body Request containing the refunds and purchases that need to be executed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 exchange operation result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ExchangeOperationResultResponseInner> beginPost( + ExchangeRequest body); + + /** + * Exchange Reservation(s) + * + *

Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + * + * @param body Request containing the refunds and purchases that need to be executed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of exchange operation result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ExchangeOperationResultResponseInner> beginPost( + ExchangeRequest body, Context context); + + /** + * Exchange Reservation(s) + * + *

Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + * + * @param body Request containing the refunds and purchases that need to be executed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return exchange operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExchangeOperationResultResponseInner post(ExchangeRequest body); + + /** + * Exchange Reservation(s) + * + *

Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + * + * @param body Request containing the refunds and purchases that need to be executed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return exchange operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExchangeOperationResultResponseInner post(ExchangeRequest body, Context context); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/OperationsClient.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/OperationsClient.java new file mode 100644 index 0000000000000..0801c54ee1c85 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.reservations.fluent.models.OperationResponseInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Get operations. + * + *

List all the operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paginated list of operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get operations. + * + *

List all the operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paginated list of operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/QuotaRequestStatusClient.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/QuotaRequestStatusClient.java new file mode 100644 index 0000000000000..e501ac4c3eab6 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/QuotaRequestStatusClient.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.reservations.fluent.models.QuotaRequestDetailsInner; + +/** An instance of this class provides access to all the operations defined in QuotaRequestStatusClient. */ +public interface QuotaRequestStatusClient { + /** + * For the specified Azure region (location), get the details and status of the quota request by the quota request + * ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response + * with the requestId parameter. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param id Quota Request ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota request details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String subscriptionId, String providerId, String location, String id, Context context); + + /** + * For the specified Azure region (location), get the details and status of the quota request by the quota request + * ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response + * with the requestId parameter. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param id Quota Request ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota request details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + QuotaRequestDetailsInner get(String subscriptionId, String providerId, String location, String id); + + /** + * For the specified Azure region (location), subscription, and resource provider, get the history of the quota + * requests for the past year. To select specific quota requests, use the oData filter. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota request details as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String subscriptionId, String providerId, String location); + + /** + * For the specified Azure region (location), subscription, and resource provider, get the history of the quota + * requests for the past year. To select specific quota requests, use the oData filter. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param filter | Field | Supported operators | |---------------------|------------------------| |requestSubmitTime + * | ge, le, eq, gt, lt |. + * @param top Number of records to return. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element includes a skiptoken parameter that specifies + * a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota request details as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String subscriptionId, + String providerId, + String location, + String filter, + Integer top, + String skiptoken, + Context context); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/QuotasClient.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/QuotasClient.java new file mode 100644 index 0000000000000..3fed2d893bbf1 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/QuotasClient.java @@ -0,0 +1,295 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.reservations.fluent.models.CurrentQuotaLimitBaseInner; +import com.azure.resourcemanager.reservations.models.QuotasGetResponse; + +/** An instance of this class provides access to all the operations defined in QuotasClient. */ +public interface QuotasClient { + /** + * Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to + * submit quota update request. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current quota (service limit) and usage of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + QuotasGetResponse getWithResponse( + String subscriptionId, String providerId, String location, String resourceName, Context context); + + /** + * Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to + * submit quota update request. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current quota (service limit) and usage of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CurrentQuotaLimitBaseInner get(String subscriptionId, String providerId, String location, String resourceName); + + /** + * Create or update the quota (service limits) of a resource to the requested value. Steps: 1. Make the Get request + * to get the quota information for specific resource. 2. To increase the quota, update the limit field in the + * response from Get request to new value. 3. Submit the JSON to the quota request API to update the quota. The + * Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Quota requests payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 quota properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CurrentQuotaLimitBaseInner> beginCreateOrUpdate( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest); + + /** + * Create or update the quota (service limits) of a resource to the requested value. Steps: 1. Make the Get request + * to get the quota information for specific resource. 2. To increase the quota, update the limit field in the + * response from Get request to new value. 3. Submit the JSON to the quota request API to update the quota. The + * Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Quota requests payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of quota properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CurrentQuotaLimitBaseInner> beginCreateOrUpdate( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest, + Context context); + + /** + * Create or update the quota (service limits) of a resource to the requested value. Steps: 1. Make the Get request + * to get the quota information for specific resource. 2. To increase the quota, update the limit field in the + * response from Get request to new value. 3. Submit the JSON to the quota request API to update the quota. The + * Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Quota requests payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CurrentQuotaLimitBaseInner createOrUpdate( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest); + + /** + * Create or update the quota (service limits) of a resource to the requested value. Steps: 1. Make the Get request + * to get the quota information for specific resource. 2. To increase the quota, update the limit field in the + * response from Get request to new value. 3. Submit the JSON to the quota request API to update the quota. The + * Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Quota requests payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CurrentQuotaLimitBaseInner createOrUpdate( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest, + Context context); + + /** + * Update the quota (service limits) of this resource to the requested value. • To get the quota information for + * specific resource, send a GET request. • To increase the quota, update the limit field from the GET response to a + * new value. • To update the quota value, submit the JSON response to the quota request API to update the quota. • + * To update the quota. use the PATCH operation. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Payload for the quota request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 quota properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CurrentQuotaLimitBaseInner> beginUpdate( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest); + + /** + * Update the quota (service limits) of this resource to the requested value. • To get the quota information for + * specific resource, send a GET request. • To increase the quota, update the limit field from the GET response to a + * new value. • To update the quota value, submit the JSON response to the quota request API to update the quota. • + * To update the quota. use the PATCH operation. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Payload for the quota request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of quota properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CurrentQuotaLimitBaseInner> beginUpdate( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest, + Context context); + + /** + * Update the quota (service limits) of this resource to the requested value. • To get the quota information for + * specific resource, send a GET request. • To increase the quota, update the limit field from the GET response to a + * new value. • To update the quota value, submit the JSON response to the quota request API to update the quota. • + * To update the quota. use the PATCH operation. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Payload for the quota request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CurrentQuotaLimitBaseInner update( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest); + + /** + * Update the quota (service limits) of this resource to the requested value. • To get the quota information for + * specific resource, send a GET request. • To increase the quota, update the limit field from the GET response to a + * new value. • To update the quota value, submit the JSON response to the quota request API to update the quota. • + * To update the quota. use the PATCH operation. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Payload for the quota request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CurrentQuotaLimitBaseInner update( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest, + Context context); + + /** + * Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota + * operation can be leveraged to request quota updates. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of current quotas (service limits) and usage for all resources as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String subscriptionId, String providerId, String location); + + /** + * Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota + * operation can be leveraged to request quota updates. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of current quotas (service limits) and usage for all resources as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String subscriptionId, String providerId, String location, Context context); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/ReservationOrdersClient.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/ReservationOrdersClient.java new file mode 100644 index 0000000000000..b5aad39a08d5a --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/ReservationOrdersClient.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.reservations.fluent.models.CalculatePriceResponseInner; +import com.azure.resourcemanager.reservations.fluent.models.ChangeDirectoryResponseInner; +import com.azure.resourcemanager.reservations.fluent.models.ReservationOrderResponseInner; +import com.azure.resourcemanager.reservations.models.ChangeDirectoryRequest; +import com.azure.resourcemanager.reservations.models.PurchaseRequest; + +/** An instance of this class provides access to all the operations defined in ReservationOrdersClient. */ +public interface ReservationOrdersClient { + /** + * Calculate price for a `ReservationOrder`. + * + *

Calculate price for placing a `ReservationOrder`. + * + * @param body Information needed for calculate or purchase reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of calculate price for reservation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response calculateWithResponse(PurchaseRequest body, Context context); + + /** + * Calculate price for a `ReservationOrder`. + * + *

Calculate price for placing a `ReservationOrder`. + * + * @param body Information needed for calculate or purchase reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of calculate price for reservation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CalculatePriceResponseInner calculate(PurchaseRequest body); + + /** + * Get all `ReservationOrder`s. + * + *

List of all the `ReservationOrder`s that the user has access to in the current tenant. + * + * @throws com.azure.core.management.exception.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 `ReservationOrder`s as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get all `ReservationOrder`s. + * + *

List of all the `ReservationOrder`s that the user has access to in the current tenant. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of `ReservationOrder`s as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Purchase `ReservationOrder` + * + *

Purchase `ReservationOrder` and create resource under the specified URI. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculate or purchase reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 details of a reservation order being returned. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ReservationOrderResponseInner> beginPurchase( + String reservationOrderId, PurchaseRequest body); + + /** + * Purchase `ReservationOrder` + * + *

Purchase `ReservationOrder` and create resource under the specified URI. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculate or purchase reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of details of a reservation order being returned. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ReservationOrderResponseInner> beginPurchase( + String reservationOrderId, PurchaseRequest body, Context context); + + /** + * Purchase `ReservationOrder` + * + *

Purchase `ReservationOrder` and create resource under the specified URI. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculate or purchase reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 a reservation order being returned. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ReservationOrderResponseInner purchase(String reservationOrderId, PurchaseRequest body); + + /** + * Purchase `ReservationOrder` + * + *

Purchase `ReservationOrder` and create resource under the specified URI. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculate or purchase reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of a reservation order being returned. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ReservationOrderResponseInner purchase(String reservationOrderId, PurchaseRequest body, Context context); + + /** + * Get a specific `ReservationOrder`. + * + *

Get the details of the `ReservationOrder`. + * + * @param reservationOrderId Order Id of the reservation. + * @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 com.azure.core.management.exception.ManagementException 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` along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String reservationOrderId, String expand, Context context); + + /** + * Get a specific `ReservationOrder`. + * + *

Get the details of the `ReservationOrder`. + * + * @param reservationOrderId Order Id of the reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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`. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ReservationOrderResponseInner get(String reservationOrderId); + + /** + * Change directory of `ReservationOrder`. + * + *

Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to change directory of reservation order. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return change directory response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response changeDirectoryWithResponse( + String reservationOrderId, ChangeDirectoryRequest body, Context context); + + /** + * Change directory of `ReservationOrder`. + * + *

Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to change directory of reservation order. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return change directory response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ChangeDirectoryResponseInner changeDirectory(String reservationOrderId, ChangeDirectoryRequest body); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/ReservationsClient.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/ReservationsClient.java new file mode 100644 index 0000000000000..bda9c3ba02f4f --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/ReservationsClient.java @@ -0,0 +1,494 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.reservations.fluent.models.AvailableScopePropertiesInner; +import com.azure.resourcemanager.reservations.fluent.models.ReservationResponseInner; +import com.azure.resourcemanager.reservations.models.AvailableScopeRequest; +import com.azure.resourcemanager.reservations.models.MergeRequest; +import com.azure.resourcemanager.reservations.models.PatchModel; +import com.azure.resourcemanager.reservations.models.SplitRequest; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in ReservationsClient. */ +public interface ReservationsClient { + /** + * Get Available Scopes for `Reservation`. + * + *

Check whether the scopes from request is valid for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param body Scopes to be checked for eligibility. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 response of available scope api containing scopes and their + * eligibilities. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AvailableScopePropertiesInner> beginAvailableScopes( + String reservationOrderId, String reservationId, AvailableScopeRequest body); + + /** + * Get Available Scopes for `Reservation`. + * + *

Check whether the scopes from request is valid for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param body Scopes to be checked for eligibility. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the response of available scope api containing scopes and their + * eligibilities. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AvailableScopePropertiesInner> beginAvailableScopes( + String reservationOrderId, String reservationId, AvailableScopeRequest body, Context context); + + /** + * Get Available Scopes for `Reservation`. + * + *

Check whether the scopes from request is valid for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param body Scopes to be checked for eligibility. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of available scope api containing scopes and their eligibilities. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AvailableScopePropertiesInner availableScopes( + String reservationOrderId, String reservationId, AvailableScopeRequest body); + + /** + * Get Available Scopes for `Reservation`. + * + *

Check whether the scopes from request is valid for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param body Scopes to be checked for eligibility. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of available scope api containing scopes and their eligibilities. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AvailableScopePropertiesInner availableScopes( + String reservationOrderId, String reservationId, AvailableScopeRequest body, Context context); + + /** + * Split the `Reservation`. + * + *

Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to Split a reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 array of ReservationResponse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller>, List> beginSplit( + String reservationOrderId, SplitRequest body); + + /** + * Split the `Reservation`. + * + *

Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to Split a reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of array of ReservationResponse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller>, List> beginSplit( + String reservationOrderId, SplitRequest body, Context context); + + /** + * Split the `Reservation`. + * + *

Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to Split a reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 ReservationResponse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List split(String reservationOrderId, SplitRequest body); + + /** + * Split the `Reservation`. + * + *

Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to Split a reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return array of ReservationResponse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List split(String reservationOrderId, SplitRequest body, Context context); + + /** + * Merges two `Reservation`s. + * + *

Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have + * same properties. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for commercial request for a reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 array of ReservationResponse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller>, List> beginMerge( + String reservationOrderId, MergeRequest body); + + /** + * Merges two `Reservation`s. + * + *

Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have + * same properties. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for commercial request for a reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of array of ReservationResponse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller>, List> beginMerge( + String reservationOrderId, MergeRequest body, Context context); + + /** + * Merges two `Reservation`s. + * + *

Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have + * same properties. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for commercial request for a reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 ReservationResponse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List merge(String reservationOrderId, MergeRequest body); + + /** + * Merges two `Reservation`s. + * + *

Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have + * same properties. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for commercial request for a reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return array of ReservationResponse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List merge(String reservationOrderId, MergeRequest body, Context context); + + /** + * Get `Reservation`s in a given reservation Order + * + *

List `Reservation`s within a single `ReservationOrder`. + * + * @param reservationOrderId Order Id of the reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 `Reservation`s as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String reservationOrderId); + + /** + * Get `Reservation`s in a given reservation Order + * + *

List `Reservation`s within a single `ReservationOrder`. + * + * @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 com.azure.core.management.exception.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 `Reservation`s as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String reservationOrderId, Context context); + + /** + * Get `Reservation` details. + * + *

Get specific `Reservation` details. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param expand Supported value of this query is renewProperties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific `Reservation` details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String reservationOrderId, String reservationId, String expand, Context context); + + /** + * Get `Reservation` details. + * + *

Get specific `Reservation` details. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ReservationResponseInner get(String reservationOrderId, String reservationId); + + /** + * Updates a `Reservation`. + * + *

Updates the applied scopes of the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param parameters Information needed to patch a reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 definition of the reservation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ReservationResponseInner> beginUpdate( + String reservationOrderId, String reservationId, PatchModel parameters); + + /** + * Updates a `Reservation`. + * + *

Updates the applied scopes of the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param parameters Information needed to patch a reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the definition of the reservation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ReservationResponseInner> beginUpdate( + String reservationOrderId, String reservationId, PatchModel parameters, Context context); + + /** + * Updates a `Reservation`. + * + *

Updates the applied scopes of the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param parameters Information needed to patch a reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ReservationResponseInner update(String reservationOrderId, String reservationId, PatchModel parameters); + + /** + * Updates a `Reservation`. + * + *

Updates the applied scopes of the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param parameters Information needed to patch a reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition of the reservation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ReservationResponseInner update( + String reservationOrderId, String reservationId, PatchModel parameters, Context context); + + /** + * Archive a `Reservation`. + * + *

Archiving a `Reservation` moves it to `Archived` state. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response archiveWithResponse(String reservationOrderId, String reservationId, Context context); + + /** + * Archive a `Reservation`. + * + *

Archiving a `Reservation` moves it to `Archived` state. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void archive(String reservationOrderId, String reservationId); + + /** + * Unarchive a `Reservation`. + * + *

Restores a `Reservation` to the state it was before archiving. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response unarchiveWithResponse(String reservationOrderId, String reservationId, Context context); + + /** + * Unarchive a `Reservation`. + * + *

Restores a `Reservation` to the state it was before archiving. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void unarchive(String reservationOrderId, String reservationId); + + /** + * Get `Reservation` revisions. + * + *

List of all the revisions for the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 `Reservation`s as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listRevisions(String reservationOrderId, String reservationId); + + /** + * Get `Reservation` revisions. + * + *

List of all the revisions for the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of `Reservation`s as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listRevisions( + String reservationOrderId, String reservationId, Context context); + + /** + * List the reservations and the roll up counts of reservations group by provisioning states that the user has + * access to in the current tenant. + * + * @throws com.azure.core.management.exception.ManagementException thrown if 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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAll(); + + /** + * List the reservations and the roll up counts of reservations group by provisioning states that the user has + * access to in the current tenant. + * + * @param filter May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does + * not currently support 'ne', 'gt', 'le', 'ge', or 'not'. Reservation properties include sku/name, + * properties/{appliedScopeType, archived, displayName, displayProvisioningState, effectiveDateTime, expiryDate, + * expiryDateTime, provisioningState, quantity, renew, reservedResourceType, term, userFriendlyAppliedScopeType, + * userFriendlyRenewState}. + * @param orderby May be used to sort order by reservation properties. + * @param refreshSummary To indicate whether to refresh the roll up counts of the reservations group by provisioning + * states. + * @param skiptoken The number of reservations to skip from the list before returning results. + * @param selectedState The selected provisioning state. + * @param take To number of reservations to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAll( + String filter, + String orderby, + String refreshSummary, + Float skiptoken, + String selectedState, + Float take, + Context context); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/ResourceProvidersClient.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/ResourceProvidersClient.java new file mode 100644 index 0000000000000..2165ff0d7cb3a --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/ResourceProvidersClient.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.reservations.fluent.models.AppliedReservationsInner; +import com.azure.resourcemanager.reservations.fluent.models.CatalogInner; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public interface ResourceProvidersClient { + /** + * Get the regions and skus that are available for RI purchase for the specified Azure subscription. + * + * @param subscriptionId Id of the subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the regions and skus that are available for RI purchase for the specified Azure subscription as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String subscriptionId); + + /** + * Get the regions and skus that are available for RI purchase for the specified Azure subscription. + * + * @param subscriptionId Id of the subscription. + * @param reservedResourceType The type of the resource for which the skus should be provided. + * @param location Filters the skus based on the location specified in this parameter. This can be an Azure region + * or global. + * @param publisherId Publisher id used to get the third party products. + * @param offerId Offer id used to get the third party products. + * @param planId Plan id used to get the third party products. + * @param filter May be used to filter by Catalog properties. The filter supports 'eq', 'or', and 'and'. + * @param skip The number of reservations to skip from the list before returning results. + * @param take To number of reservations to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the regions and skus that are available for RI purchase for the specified Azure subscription as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String subscriptionId, + String reservedResourceType, + String location, + String publisherId, + String offerId, + String planId, + String filter, + Float skip, + Float take, + Context context); + + /** + * Get list of applicable `Reservation`s. + * + *

Get applicable `Reservation`s that are applied to this subscription or a resource group under this + * subscription. + * + * @param subscriptionId Id of the subscription. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return applicable `Reservation`s that are applied to this subscription or a resource group under this + * subscription along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getAppliedReservationListWithResponse(String subscriptionId, Context context); + + /** + * Get list of applicable `Reservation`s. + * + *

Get applicable `Reservation`s that are applied to this subscription or a resource group under this + * subscription. + * + * @param subscriptionId Id of the subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return applicable `Reservation`s that are applied to this subscription or a resource group under this + * subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AppliedReservationsInner getAppliedReservationList(String subscriptionId); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/ReturnsClient.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/ReturnsClient.java new file mode 100644 index 0000000000000..bd3506601b40e --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/ReturnsClient.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.reservations.fluent.models.RefundResponseInner; +import com.azure.resourcemanager.reservations.models.RefundRequest; + +/** An instance of this class provides access to all the operations defined in ReturnsClient. */ +public interface ReturnsClient { + /** + * Return a reservation. + * + *

Return a reservation and get refund information. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for returning reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 response of refund request containing refund information of + * reservation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RefundResponseInner> beginPost( + String reservationOrderId, RefundRequest body); + + /** + * Return a reservation. + * + *

Return a reservation and get refund information. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for returning reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the response of refund request containing refund information of + * reservation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RefundResponseInner> beginPost( + String reservationOrderId, RefundRequest body, Context context); + + /** + * Return a reservation. + * + *

Return a reservation and get refund information. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for returning reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of refund request containing refund information of reservation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RefundResponseInner post(String reservationOrderId, RefundRequest body); + + /** + * Return a reservation. + * + *

Return a reservation and get refund information. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for returning reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of refund request containing refund information of reservation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RefundResponseInner post(String reservationOrderId, RefundRequest body, Context context); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/AppliedReservationsInner.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/AppliedReservationsInner.java new file mode 100644 index 0000000000000..23be3cb1dfd4b --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/AppliedReservationsInner.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.models.AppliedReservationList; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The response for applied reservations api. */ +@Fluent +public final class AppliedReservationsInner { + /* + * Identifier of the applied reservations + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Name of resource + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Type of resource. "Microsoft.Capacity/AppliedReservations" + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Properties for applied reservations returned + */ + @JsonProperty(value = "properties") + private AppliedReservationsProperties innerProperties; + + /** Creates an instance of AppliedReservationsInner class. */ + public AppliedReservationsInner() { + } + + /** + * Get the id property: Identifier of the applied reservations. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: Name of resource. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: Type of resource. "Microsoft.Capacity/AppliedReservations". + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the innerProperties property: Properties for applied reservations returned. + * + * @return the innerProperties value. + */ + private AppliedReservationsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the reservationOrderIds property: Paginated list of applied reservations. + * + * @return the reservationOrderIds value. + */ + public AppliedReservationList reservationOrderIds() { + return this.innerProperties() == null ? null : this.innerProperties().reservationOrderIds(); + } + + /** + * Set the reservationOrderIds property: Paginated list of applied reservations. + * + * @param reservationOrderIds the reservationOrderIds value to set. + * @return the AppliedReservationsInner object itself. + */ + public AppliedReservationsInner withReservationOrderIds(AppliedReservationList reservationOrderIds) { + if (this.innerProperties() == null) { + this.innerProperties = new AppliedReservationsProperties(); + } + this.innerProperties().withReservationOrderIds(reservationOrderIds); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/AppliedReservationsProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/AppliedReservationsProperties.java new file mode 100644 index 0000000000000..5f880016fc976 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/AppliedReservationsProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.models.AppliedReservationList; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties for applied reservations returned. */ +@Fluent +public final class AppliedReservationsProperties { + /* + * Paginated list of applied reservations + */ + @JsonProperty(value = "reservationOrderIds") + private AppliedReservationList reservationOrderIds; + + /** Creates an instance of AppliedReservationsProperties class. */ + public AppliedReservationsProperties() { + } + + /** + * Get the reservationOrderIds property: Paginated list of applied reservations. + * + * @return the reservationOrderIds value. + */ + public AppliedReservationList reservationOrderIds() { + return this.reservationOrderIds; + } + + /** + * Set the reservationOrderIds property: Paginated list of applied reservations. + * + * @param reservationOrderIds the reservationOrderIds value to set. + * @return the AppliedReservationsProperties object itself. + */ + public AppliedReservationsProperties withReservationOrderIds(AppliedReservationList reservationOrderIds) { + this.reservationOrderIds = reservationOrderIds; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (reservationOrderIds() != null) { + reservationOrderIds().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/AvailableScopePropertiesInner.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/AvailableScopePropertiesInner.java new file mode 100644 index 0000000000000..1f850dcefcb0f --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/AvailableScopePropertiesInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.models.SubscriptionScopeProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The response of available scope api containing scopes and their eligibilities. */ +@Fluent +public final class AvailableScopePropertiesInner { + /* + * The scopes checked by the available scope api. + */ + @JsonProperty(value = "properties") + private SubscriptionScopeProperties properties; + + /** Creates an instance of AvailableScopePropertiesInner class. */ + public AvailableScopePropertiesInner() { + } + + /** + * Get the properties property: The scopes checked by the available scope api. + * + * @return the properties value. + */ + public SubscriptionScopeProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The scopes checked by the available scope api. + * + * @param properties the properties value to set. + * @return the AvailableScopePropertiesInner object itself. + */ + public AvailableScopePropertiesInner withProperties(SubscriptionScopeProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CalculateExchangeOperationResultResponseInner.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CalculateExchangeOperationResultResponseInner.java new file mode 100644 index 0000000000000..26dca5a2903d8 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CalculateExchangeOperationResultResponseInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.models.CalculateExchangeOperationResultStatus; +import com.azure.resourcemanager.reservations.models.CalculateExchangeResponseProperties; +import com.azure.resourcemanager.reservations.models.OperationResultError; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** CalculateExchange operation result. */ +@Fluent +public final class CalculateExchangeOperationResultResponseInner { + /* + * It should match what is used to GET the operation result. + */ + @JsonProperty(value = "id") + private String id; + + /* + * It must match the last segment of the id field, and will typically be a GUID / system generated value. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Status of the operation. + */ + @JsonProperty(value = "status") + private CalculateExchangeOperationResultStatus status; + + /* + * CalculateExchange response properties + */ + @JsonProperty(value = "properties") + private CalculateExchangeResponseProperties properties; + + /* + * Required if status == failed or status == canceled. + */ + @JsonProperty(value = "error") + private OperationResultError error; + + /** Creates an instance of CalculateExchangeOperationResultResponseInner class. */ + public CalculateExchangeOperationResultResponseInner() { + } + + /** + * Get the id property: It should match what is used to GET the operation result. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: It should match what is used to GET the operation result. + * + * @param id the id value to set. + * @return the CalculateExchangeOperationResultResponseInner object itself. + */ + public CalculateExchangeOperationResultResponseInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: It must match the last segment of the id field, and will typically be a GUID / system + * generated value. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: It must match the last segment of the id field, and will typically be a GUID / system + * generated value. + * + * @param name the name value to set. + * @return the CalculateExchangeOperationResultResponseInner object itself. + */ + public CalculateExchangeOperationResultResponseInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the status property: Status of the operation. + * + * @return the status value. + */ + public CalculateExchangeOperationResultStatus status() { + return this.status; + } + + /** + * Set the status property: Status of the operation. + * + * @param status the status value to set. + * @return the CalculateExchangeOperationResultResponseInner object itself. + */ + public CalculateExchangeOperationResultResponseInner withStatus(CalculateExchangeOperationResultStatus status) { + this.status = status; + return this; + } + + /** + * Get the properties property: CalculateExchange response properties. + * + * @return the properties value. + */ + public CalculateExchangeResponseProperties properties() { + return this.properties; + } + + /** + * Set the properties property: CalculateExchange response properties. + * + * @param properties the properties value to set. + * @return the CalculateExchangeOperationResultResponseInner object itself. + */ + public CalculateExchangeOperationResultResponseInner withProperties( + CalculateExchangeResponseProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the error property: Required if status == failed or status == canceled. + * + * @return the error value. + */ + public OperationResultError error() { + return this.error; + } + + /** + * Set the error property: Required if status == failed or status == canceled. + * + * @param error the error value to set. + * @return the CalculateExchangeOperationResultResponseInner object itself. + */ + public CalculateExchangeOperationResultResponseInner withError(OperationResultError error) { + this.error = error; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (error() != null) { + error().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CalculatePriceResponseInner.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CalculatePriceResponseInner.java new file mode 100644 index 0000000000000..e7420da3ba59d --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CalculatePriceResponseInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.models.CalculatePriceResponseProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The response of calculate price for reservation. */ +@Fluent +public final class CalculatePriceResponseInner { + /* + * Properties for calculate price response + */ + @JsonProperty(value = "properties") + private CalculatePriceResponseProperties properties; + + /** Creates an instance of CalculatePriceResponseInner class. */ + public CalculatePriceResponseInner() { + } + + /** + * Get the properties property: Properties for calculate price response. + * + * @return the properties value. + */ + public CalculatePriceResponseProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties for calculate price response. + * + * @param properties the properties value to set. + * @return the CalculatePriceResponseInner object itself. + */ + public CalculatePriceResponseInner withProperties(CalculatePriceResponseProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CalculateRefundResponseInner.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CalculateRefundResponseInner.java new file mode 100644 index 0000000000000..d41c5a3882d7d --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CalculateRefundResponseInner.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.models.RefundResponseProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The response of calculate refund containing refund information of reservation. */ +@Fluent +public final class CalculateRefundResponseInner { + /* + * Fully qualified identifier of the reservation being returned + */ + @JsonProperty(value = "id") + private String id; + + /* + * The refund properties of reservation + */ + @JsonProperty(value = "properties") + private RefundResponseProperties properties; + + /** Creates an instance of CalculateRefundResponseInner class. */ + public CalculateRefundResponseInner() { + } + + /** + * Get the id property: Fully qualified identifier of the reservation being returned. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Fully qualified identifier of the reservation being returned. + * + * @param id the id value to set. + * @return the CalculateRefundResponseInner object itself. + */ + public CalculateRefundResponseInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the properties property: The refund properties of reservation. + * + * @return the properties value. + */ + public RefundResponseProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The refund properties of reservation. + * + * @param properties the properties value to set. + * @return the CalculateRefundResponseInner object itself. + */ + public CalculateRefundResponseInner withProperties(RefundResponseProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CatalogInner.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CatalogInner.java new file mode 100644 index 0000000000000..bc8280fb52f9c --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CatalogInner.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.models.CatalogMsrp; +import com.azure.resourcemanager.reservations.models.ReservationBillingPlan; +import com.azure.resourcemanager.reservations.models.ReservationTerm; +import com.azure.resourcemanager.reservations.models.SkuCapability; +import com.azure.resourcemanager.reservations.models.SkuProperty; +import com.azure.resourcemanager.reservations.models.SkuRestriction; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Product details of a type of resource. */ +@Fluent +public final class CatalogInner { + /* + * The type of resource the sku applies to. + */ + @JsonProperty(value = "resourceType", access = JsonProperty.Access.WRITE_ONLY) + private String resourceType; + + /* + * The name of sku + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The billing plan options available for this sku. + */ + @JsonProperty(value = "billingPlans") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map> billingPlans; + + /* + * Available reservation terms for this resource + */ + @JsonProperty(value = "terms", access = JsonProperty.Access.WRITE_ONLY) + private List terms; + + /* + * The locations property. + */ + @JsonProperty(value = "locations", access = JsonProperty.Access.WRITE_ONLY) + private List locations; + + /* + * The skuProperties property. + */ + @JsonProperty(value = "skuProperties", access = JsonProperty.Access.WRITE_ONLY) + private List skuProperties; + + /* + * Pricing information about the sku + */ + @JsonProperty(value = "msrp", access = JsonProperty.Access.WRITE_ONLY) + private CatalogMsrp msrp; + + /* + * The restrictions property. + */ + @JsonProperty(value = "restrictions", access = JsonProperty.Access.WRITE_ONLY) + private List restrictions; + + /* + * The tier of this sku + */ + @JsonProperty(value = "tier", access = JsonProperty.Access.WRITE_ONLY) + private String tier; + + /* + * The size of this sku + */ + @JsonProperty(value = "size", access = JsonProperty.Access.WRITE_ONLY) + private String size; + + /* + * The capabilities property. + */ + @JsonProperty(value = "capabilities", access = JsonProperty.Access.WRITE_ONLY) + private List capabilities; + + /** Creates an instance of CatalogInner class. */ + public CatalogInner() { + } + + /** + * Get the resourceType property: The type of resource the sku applies to. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Get the name property: The name of sku. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the billingPlans property: The billing plan options available for this sku. + * + * @return the billingPlans value. + */ + public Map> billingPlans() { + return this.billingPlans; + } + + /** + * Set the billingPlans property: The billing plan options available for this sku. + * + * @param billingPlans the billingPlans value to set. + * @return the CatalogInner object itself. + */ + public CatalogInner withBillingPlans(Map> billingPlans) { + this.billingPlans = billingPlans; + return this; + } + + /** + * Get the terms property: Available reservation terms for this resource. + * + * @return the terms value. + */ + public List terms() { + return this.terms; + } + + /** + * Get the locations property: The locations property. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Get the skuProperties property: The skuProperties property. + * + * @return the skuProperties value. + */ + public List skuProperties() { + return this.skuProperties; + } + + /** + * Get the msrp property: Pricing information about the sku. + * + * @return the msrp value. + */ + public CatalogMsrp msrp() { + return this.msrp; + } + + /** + * Get the restrictions property: The restrictions property. + * + * @return the restrictions value. + */ + public List restrictions() { + return this.restrictions; + } + + /** + * Get the tier property: The tier of this sku. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Get the size property: The size of this sku. + * + * @return the size value. + */ + public String size() { + return this.size; + } + + /** + * Get the capabilities property: The capabilities property. + * + * @return the capabilities value. + */ + public List capabilities() { + return this.capabilities; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (skuProperties() != null) { + skuProperties().forEach(e -> e.validate()); + } + if (msrp() != null) { + msrp().validate(); + } + if (restrictions() != null) { + restrictions().forEach(e -> e.validate()); + } + if (capabilities() != null) { + capabilities().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ChangeDirectoryResponseInner.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ChangeDirectoryResponseInner.java new file mode 100644 index 0000000000000..0669b8cf21912 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ChangeDirectoryResponseInner.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.models.ChangeDirectoryResult; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Change directory response. */ +@Fluent +public final class ChangeDirectoryResponseInner { + /* + * Change directory result for reservation order or reservation + */ + @JsonProperty(value = "reservationOrder") + private ChangeDirectoryResult reservationOrder; + + /* + * The reservations property. + */ + @JsonProperty(value = "reservations") + private List reservations; + + /** Creates an instance of ChangeDirectoryResponseInner class. */ + public ChangeDirectoryResponseInner() { + } + + /** + * Get the reservationOrder property: Change directory result for reservation order or reservation. + * + * @return the reservationOrder value. + */ + public ChangeDirectoryResult reservationOrder() { + return this.reservationOrder; + } + + /** + * Set the reservationOrder property: Change directory result for reservation order or reservation. + * + * @param reservationOrder the reservationOrder value to set. + * @return the ChangeDirectoryResponseInner object itself. + */ + public ChangeDirectoryResponseInner withReservationOrder(ChangeDirectoryResult reservationOrder) { + this.reservationOrder = reservationOrder; + return this; + } + + /** + * Get the reservations property: The reservations property. + * + * @return the reservations value. + */ + public List reservations() { + return this.reservations; + } + + /** + * Set the reservations property: The reservations property. + * + * @param reservations the reservations value to set. + * @return the ChangeDirectoryResponseInner object itself. + */ + public ChangeDirectoryResponseInner withReservations(List reservations) { + this.reservations = reservations; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (reservationOrder() != null) { + reservationOrder().validate(); + } + if (reservations() != null) { + reservations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CurrentQuotaLimitBaseInner.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CurrentQuotaLimitBaseInner.java new file mode 100644 index 0000000000000..2591fa98358f9 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CurrentQuotaLimitBaseInner.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.reservations.models.QuotaProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Quota properties. */ +@Fluent +public final class CurrentQuotaLimitBaseInner extends ProxyResource { + /* + * Quota properties for the resource. + */ + @JsonProperty(value = "properties") + private QuotaProperties properties; + + /** Creates an instance of CurrentQuotaLimitBaseInner class. */ + public CurrentQuotaLimitBaseInner() { + } + + /** + * Get the properties property: Quota properties for the resource. + * + * @return the properties value. + */ + public QuotaProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Quota properties for the resource. + * + * @param properties the properties value to set. + * @return the CurrentQuotaLimitBaseInner object itself. + */ + public CurrentQuotaLimitBaseInner withProperties(QuotaProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ExchangeOperationResultResponseInner.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ExchangeOperationResultResponseInner.java new file mode 100644 index 0000000000000..6b36d8ff7b96e --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ExchangeOperationResultResponseInner.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.models.ExchangeOperationResultStatus; +import com.azure.resourcemanager.reservations.models.ExchangeResponseProperties; +import com.azure.resourcemanager.reservations.models.OperationResultError; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Exchange operation result. */ +@Fluent +public final class ExchangeOperationResultResponseInner { + /* + * It should match what is used to GET the operation result. + */ + @JsonProperty(value = "id") + private String id; + + /* + * It must match the last segment of the id field, and will typically be a GUID / system generated value. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Status of the operation. + */ + @JsonProperty(value = "status") + private ExchangeOperationResultStatus status; + + /* + * Exchange response properties + */ + @JsonProperty(value = "properties") + private ExchangeResponseProperties properties; + + /* + * Required if status == failed or status == canceled. + */ + @JsonProperty(value = "error") + private OperationResultError error; + + /** Creates an instance of ExchangeOperationResultResponseInner class. */ + public ExchangeOperationResultResponseInner() { + } + + /** + * Get the id property: It should match what is used to GET the operation result. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: It should match what is used to GET the operation result. + * + * @param id the id value to set. + * @return the ExchangeOperationResultResponseInner object itself. + */ + public ExchangeOperationResultResponseInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: It must match the last segment of the id field, and will typically be a GUID / system + * generated value. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: It must match the last segment of the id field, and will typically be a GUID / system + * generated value. + * + * @param name the name value to set. + * @return the ExchangeOperationResultResponseInner object itself. + */ + public ExchangeOperationResultResponseInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the status property: Status of the operation. + * + * @return the status value. + */ + public ExchangeOperationResultStatus status() { + return this.status; + } + + /** + * Set the status property: Status of the operation. + * + * @param status the status value to set. + * @return the ExchangeOperationResultResponseInner object itself. + */ + public ExchangeOperationResultResponseInner withStatus(ExchangeOperationResultStatus status) { + this.status = status; + return this; + } + + /** + * Get the properties property: Exchange response properties. + * + * @return the properties value. + */ + public ExchangeResponseProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Exchange response properties. + * + * @param properties the properties value to set. + * @return the ExchangeOperationResultResponseInner object itself. + */ + public ExchangeOperationResultResponseInner withProperties(ExchangeResponseProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the error property: Required if status == failed or status == canceled. + * + * @return the error value. + */ + public OperationResultError error() { + return this.error; + } + + /** + * Set the error property: Required if status == failed or status == canceled. + * + * @param error the error value to set. + * @return the ExchangeOperationResultResponseInner object itself. + */ + public ExchangeOperationResultResponseInner withError(OperationResultError error) { + this.error = error; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (error() != null) { + error().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/MergeProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/MergeProperties.java new file mode 100644 index 0000000000000..ddc4b9f235fb7 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/MergeProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties for reservation merge. */ +@Fluent +public final class MergeProperties { + /* + * Format of the resource id should be + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} + */ + @JsonProperty(value = "sources") + private List sources; + + /** Creates an instance of MergeProperties class. */ + public MergeProperties() { + } + + /** + * Get the sources property: Format of the resource id should be + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @return the sources value. + */ + public List sources() { + return this.sources; + } + + /** + * Set the sources property: Format of the resource id should be + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @param sources the sources value to set. + * @return the MergeProperties object itself. + */ + public MergeProperties withSources(List sources) { + this.sources = sources; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/OperationResponseInner.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/OperationResponseInner.java new file mode 100644 index 0000000000000..ad70d7e07f7e1 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/OperationResponseInner.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The response containing operation information. */ +@Fluent +public final class OperationResponseInner { + /* + * Name of the operation + */ + @JsonProperty(value = "name") + private String name; + + /* + * Indicates whether the operation is a data action + */ + @JsonProperty(value = "isDataAction") + private Boolean isDataAction; + + /* + * Display of the operation + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * Origin of the operation + */ + @JsonProperty(value = "origin") + private String origin; + + /* + * Properties of the operation + */ + @JsonProperty(value = "properties") + private Object properties; + + /** Creates an instance of OperationResponseInner class. */ + public OperationResponseInner() { + } + + /** + * Get the name property: Name of the operation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the operation. + * + * @param name the name value to set. + * @return the OperationResponseInner object itself. + */ + public OperationResponseInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Set the isDataAction property: Indicates whether the operation is a data action. + * + * @param isDataAction the isDataAction value to set. + * @return the OperationResponseInner object itself. + */ + public OperationResponseInner withIsDataAction(Boolean isDataAction) { + this.isDataAction = isDataAction; + return this; + } + + /** + * Get the display property: Display of the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Display of the operation. + * + * @param display the display value to set. + * @return the OperationResponseInner object itself. + */ + public OperationResponseInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: Origin of the operation. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin property: Origin of the operation. + * + * @param origin the origin value to set. + * @return the OperationResponseInner object itself. + */ + public OperationResponseInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get the properties property: Properties of the operation. + * + * @return the properties value. + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the operation. + * + * @param properties the properties value to set. + * @return the OperationResponseInner object itself. + */ + public OperationResponseInner withProperties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/PatchProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/PatchProperties.java new file mode 100644 index 0000000000000..cbebe5aaff012 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/PatchProperties.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.models.AppliedScopeProperties; +import com.azure.resourcemanager.reservations.models.AppliedScopeType; +import com.azure.resourcemanager.reservations.models.InstanceFlexibility; +import com.azure.resourcemanager.reservations.models.PatchPropertiesRenewProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Properties for reservation patch. */ +@Fluent +public final class PatchProperties { + /* + * Type of the Applied Scope. + */ + @JsonProperty(value = "appliedScopeType") + private AppliedScopeType appliedScopeType; + + /* + * List of the subscriptions that the benefit will be applied. Do not specify if AppliedScopeType is Shared. + */ + @JsonProperty(value = "appliedScopes") + private List appliedScopes; + + /* + * Properties specific to applied scope type. Not required if not applicable. Required and need to provide tenantId + * and managementGroupId if AppliedScopeType is ManagementGroup + */ + @JsonProperty(value = "appliedScopeProperties") + private AppliedScopeProperties appliedScopeProperties; + + /* + * Turning this on will apply the reservation discount to other VMs in the same VM size group. Only specify for + * VirtualMachines reserved resource type. + */ + @JsonProperty(value = "instanceFlexibility") + private InstanceFlexibility instanceFlexibility; + + /* + * Display name of the reservation + */ + @JsonProperty(value = "name") + private String name; + + /* + * Setting this to true will automatically purchase a new reservation on the expiration date time. + */ + @JsonProperty(value = "renew") + private Boolean renew; + + /* + * The renewProperties property. + */ + @JsonProperty(value = "renewProperties") + private PatchPropertiesRenewProperties renewProperties; + + /* + * This is the date-time when the Azure hybrid benefit needs to be reviewed. + */ + @JsonProperty(value = "reviewDateTime") + private OffsetDateTime reviewDateTime; + + /** Creates an instance of PatchProperties class. */ + public PatchProperties() { + } + + /** + * Get the appliedScopeType property: Type of the Applied Scope. + * + * @return the appliedScopeType value. + */ + public AppliedScopeType appliedScopeType() { + return this.appliedScopeType; + } + + /** + * Set the appliedScopeType property: Type of the Applied Scope. + * + * @param appliedScopeType the appliedScopeType value to set. + * @return the PatchProperties object itself. + */ + public PatchProperties withAppliedScopeType(AppliedScopeType appliedScopeType) { + this.appliedScopeType = appliedScopeType; + return this; + } + + /** + * Get the appliedScopes property: List of the subscriptions that the benefit will be applied. Do not specify if + * AppliedScopeType is Shared. + * + * @return the appliedScopes value. + */ + public List appliedScopes() { + return this.appliedScopes; + } + + /** + * Set the appliedScopes property: List of the subscriptions that the benefit will be applied. Do not specify if + * AppliedScopeType is Shared. + * + * @param appliedScopes the appliedScopes value to set. + * @return the PatchProperties object itself. + */ + public PatchProperties withAppliedScopes(List appliedScopes) { + this.appliedScopes = appliedScopes; + return this; + } + + /** + * Get the appliedScopeProperties property: Properties specific to applied scope type. Not required if not + * applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup. + * + * @return the appliedScopeProperties value. + */ + public AppliedScopeProperties appliedScopeProperties() { + return this.appliedScopeProperties; + } + + /** + * Set the appliedScopeProperties property: Properties specific to applied scope type. Not required if not + * applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup. + * + * @param appliedScopeProperties the appliedScopeProperties value to set. + * @return the PatchProperties object itself. + */ + public PatchProperties withAppliedScopeProperties(AppliedScopeProperties appliedScopeProperties) { + this.appliedScopeProperties = appliedScopeProperties; + return this; + } + + /** + * Get the instanceFlexibility property: Turning this on will apply the reservation discount to other VMs in the + * same VM size group. Only specify for VirtualMachines reserved resource type. + * + * @return the instanceFlexibility value. + */ + public InstanceFlexibility instanceFlexibility() { + return this.instanceFlexibility; + } + + /** + * Set the instanceFlexibility property: Turning this on will apply the reservation discount to other VMs in the + * same VM size group. Only specify for VirtualMachines reserved resource type. + * + * @param instanceFlexibility the instanceFlexibility value to set. + * @return the PatchProperties object itself. + */ + public PatchProperties withInstanceFlexibility(InstanceFlexibility instanceFlexibility) { + this.instanceFlexibility = instanceFlexibility; + return this; + } + + /** + * Get the name property: Display name of the reservation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Display name of the reservation. + * + * @param name the name value to set. + * @return the PatchProperties object itself. + */ + public PatchProperties withName(String name) { + this.name = name; + return this; + } + + /** + * Get the renew property: Setting this to true will automatically purchase a new reservation on the expiration date + * time. + * + * @return the renew value. + */ + public Boolean renew() { + return this.renew; + } + + /** + * Set the renew property: Setting this to true will automatically purchase a new reservation on the expiration date + * time. + * + * @param renew the renew value to set. + * @return the PatchProperties object itself. + */ + public PatchProperties withRenew(Boolean renew) { + this.renew = renew; + return this; + } + + /** + * Get the renewProperties property: The renewProperties property. + * + * @return the renewProperties value. + */ + public PatchPropertiesRenewProperties renewProperties() { + return this.renewProperties; + } + + /** + * Set the renewProperties property: The renewProperties property. + * + * @param renewProperties the renewProperties value to set. + * @return the PatchProperties object itself. + */ + public PatchProperties withRenewProperties(PatchPropertiesRenewProperties renewProperties) { + this.renewProperties = renewProperties; + return this; + } + + /** + * Get the reviewDateTime property: This is the date-time when the Azure hybrid benefit needs to be reviewed. + * + * @return the reviewDateTime value. + */ + public OffsetDateTime reviewDateTime() { + return this.reviewDateTime; + } + + /** + * Set the reviewDateTime property: This is the date-time when the Azure hybrid benefit needs to be reviewed. + * + * @param reviewDateTime the reviewDateTime value to set. + * @return the PatchProperties object itself. + */ + public PatchProperties withReviewDateTime(OffsetDateTime reviewDateTime) { + this.reviewDateTime = reviewDateTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (appliedScopeProperties() != null) { + appliedScopeProperties().validate(); + } + if (renewProperties() != null) { + renewProperties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/PurchaseRequestProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/PurchaseRequestProperties.java new file mode 100644 index 0000000000000..eba384e25b628 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/PurchaseRequestProperties.java @@ -0,0 +1,360 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.models.AppliedScopeProperties; +import com.azure.resourcemanager.reservations.models.AppliedScopeType; +import com.azure.resourcemanager.reservations.models.PurchaseRequestPropertiesReservedResourceProperties; +import com.azure.resourcemanager.reservations.models.ReservationBillingPlan; +import com.azure.resourcemanager.reservations.models.ReservationTerm; +import com.azure.resourcemanager.reservations.models.ReservedResourceType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Properties of reservation purchase request. */ +@Fluent +public final class PurchaseRequestProperties { + /* + * The type of the resource that is being reserved. + */ + @JsonProperty(value = "reservedResourceType") + private ReservedResourceType reservedResourceType; + + /* + * Subscription that will be charged for purchasing reservation or savings plan + */ + @JsonProperty(value = "billingScopeId") + private String billingScopeId; + + /* + * Represent the term of reservation. + */ + @JsonProperty(value = "term") + private ReservationTerm term; + + /* + * Represent the billing plans. + */ + @JsonProperty(value = "billingPlan") + private ReservationBillingPlan billingPlan; + + /* + * Quantity of the skus that are part of the reservation. + */ + @JsonProperty(value = "quantity") + private Integer quantity; + + /* + * Friendly name of the reservation + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * Type of the Applied Scope. + */ + @JsonProperty(value = "appliedScopeType") + private AppliedScopeType appliedScopeType; + + /* + * List of the subscriptions that the benefit will be applied. Do not specify if AppliedScopeType is Shared. + */ + @JsonProperty(value = "appliedScopes") + private List appliedScopes; + + /* + * Properties specific to applied scope type. Not required if not applicable. Required and need to provide tenantId + * and managementGroupId if AppliedScopeType is ManagementGroup + */ + @JsonProperty(value = "appliedScopeProperties") + private AppliedScopeProperties appliedScopeProperties; + + /* + * Setting this to true will automatically purchase a new reservation on the expiration date time. + */ + @JsonProperty(value = "renew") + private Boolean renew; + + /* + * Properties specific to each reserved resource type. Not required if not applicable. + */ + @JsonProperty(value = "reservedResourceProperties") + private PurchaseRequestPropertiesReservedResourceProperties reservedResourceProperties; + + /* + * This is the date-time when the Azure hybrid benefit needs to be reviewed. + */ + @JsonProperty(value = "reviewDateTime") + private OffsetDateTime reviewDateTime; + + /** Creates an instance of PurchaseRequestProperties class. */ + public PurchaseRequestProperties() { + } + + /** + * Get the reservedResourceType property: The type of the resource that is being reserved. + * + * @return the reservedResourceType value. + */ + public ReservedResourceType reservedResourceType() { + return this.reservedResourceType; + } + + /** + * Set the reservedResourceType property: The type of the resource that is being reserved. + * + * @param reservedResourceType the reservedResourceType value to set. + * @return the PurchaseRequestProperties object itself. + */ + public PurchaseRequestProperties withReservedResourceType(ReservedResourceType reservedResourceType) { + this.reservedResourceType = reservedResourceType; + return this; + } + + /** + * Get the billingScopeId property: Subscription that will be charged for purchasing reservation or savings plan. + * + * @return the billingScopeId value. + */ + public String billingScopeId() { + return this.billingScopeId; + } + + /** + * Set the billingScopeId property: Subscription that will be charged for purchasing reservation or savings plan. + * + * @param billingScopeId the billingScopeId value to set. + * @return the PurchaseRequestProperties object itself. + */ + public PurchaseRequestProperties withBillingScopeId(String billingScopeId) { + this.billingScopeId = billingScopeId; + return this; + } + + /** + * Get the term property: Represent the term of reservation. + * + * @return the term value. + */ + public ReservationTerm term() { + return this.term; + } + + /** + * Set the term property: Represent the term of reservation. + * + * @param term the term value to set. + * @return the PurchaseRequestProperties object itself. + */ + public PurchaseRequestProperties withTerm(ReservationTerm term) { + this.term = term; + return this; + } + + /** + * Get the billingPlan property: Represent the billing plans. + * + * @return the billingPlan value. + */ + public ReservationBillingPlan billingPlan() { + return this.billingPlan; + } + + /** + * Set the billingPlan property: Represent the billing plans. + * + * @param billingPlan the billingPlan value to set. + * @return the PurchaseRequestProperties object itself. + */ + public PurchaseRequestProperties withBillingPlan(ReservationBillingPlan billingPlan) { + this.billingPlan = billingPlan; + return this; + } + + /** + * Get the quantity property: Quantity of the skus that are part of the reservation. + * + * @return the quantity value. + */ + public Integer quantity() { + return this.quantity; + } + + /** + * Set the quantity property: Quantity of the skus that are part of the reservation. + * + * @param quantity the quantity value to set. + * @return the PurchaseRequestProperties object itself. + */ + public PurchaseRequestProperties withQuantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get the displayName property: Friendly name of the reservation. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Friendly name of the reservation. + * + * @param displayName the displayName value to set. + * @return the PurchaseRequestProperties object itself. + */ + public PurchaseRequestProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the appliedScopeType property: Type of the Applied Scope. + * + * @return the appliedScopeType value. + */ + public AppliedScopeType appliedScopeType() { + return this.appliedScopeType; + } + + /** + * Set the appliedScopeType property: Type of the Applied Scope. + * + * @param appliedScopeType the appliedScopeType value to set. + * @return the PurchaseRequestProperties object itself. + */ + public PurchaseRequestProperties withAppliedScopeType(AppliedScopeType appliedScopeType) { + this.appliedScopeType = appliedScopeType; + return this; + } + + /** + * Get the appliedScopes property: List of the subscriptions that the benefit will be applied. Do not specify if + * AppliedScopeType is Shared. + * + * @return the appliedScopes value. + */ + public List appliedScopes() { + return this.appliedScopes; + } + + /** + * Set the appliedScopes property: List of the subscriptions that the benefit will be applied. Do not specify if + * AppliedScopeType is Shared. + * + * @param appliedScopes the appliedScopes value to set. + * @return the PurchaseRequestProperties object itself. + */ + public PurchaseRequestProperties withAppliedScopes(List appliedScopes) { + this.appliedScopes = appliedScopes; + return this; + } + + /** + * Get the appliedScopeProperties property: Properties specific to applied scope type. Not required if not + * applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup. + * + * @return the appliedScopeProperties value. + */ + public AppliedScopeProperties appliedScopeProperties() { + return this.appliedScopeProperties; + } + + /** + * Set the appliedScopeProperties property: Properties specific to applied scope type. Not required if not + * applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup. + * + * @param appliedScopeProperties the appliedScopeProperties value to set. + * @return the PurchaseRequestProperties object itself. + */ + public PurchaseRequestProperties withAppliedScopeProperties(AppliedScopeProperties appliedScopeProperties) { + this.appliedScopeProperties = appliedScopeProperties; + return this; + } + + /** + * Get the renew property: Setting this to true will automatically purchase a new reservation on the expiration date + * time. + * + * @return the renew value. + */ + public Boolean renew() { + return this.renew; + } + + /** + * Set the renew property: Setting this to true will automatically purchase a new reservation on the expiration date + * time. + * + * @param renew the renew value to set. + * @return the PurchaseRequestProperties object itself. + */ + public PurchaseRequestProperties withRenew(Boolean renew) { + this.renew = renew; + return this; + } + + /** + * Get the reservedResourceProperties property: Properties specific to each reserved resource type. Not required if + * not applicable. + * + * @return the reservedResourceProperties value. + */ + public PurchaseRequestPropertiesReservedResourceProperties reservedResourceProperties() { + return this.reservedResourceProperties; + } + + /** + * Set the reservedResourceProperties property: Properties specific to each reserved resource type. Not required if + * not applicable. + * + * @param reservedResourceProperties the reservedResourceProperties value to set. + * @return the PurchaseRequestProperties object itself. + */ + public PurchaseRequestProperties withReservedResourceProperties( + PurchaseRequestPropertiesReservedResourceProperties reservedResourceProperties) { + this.reservedResourceProperties = reservedResourceProperties; + return this; + } + + /** + * Get the reviewDateTime property: This is the date-time when the Azure hybrid benefit needs to be reviewed. + * + * @return the reviewDateTime value. + */ + public OffsetDateTime reviewDateTime() { + return this.reviewDateTime; + } + + /** + * Set the reviewDateTime property: This is the date-time when the Azure hybrid benefit needs to be reviewed. + * + * @param reviewDateTime the reviewDateTime value to set. + * @return the PurchaseRequestProperties object itself. + */ + public PurchaseRequestProperties withReviewDateTime(OffsetDateTime reviewDateTime) { + this.reviewDateTime = reviewDateTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (appliedScopeProperties() != null) { + appliedScopeProperties().validate(); + } + if (reservedResourceProperties() != null) { + reservedResourceProperties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/QuotaRequestDetailsInner.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/QuotaRequestDetailsInner.java new file mode 100644 index 0000000000000..cb7738a38690b --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/QuotaRequestDetailsInner.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.reservations.models.QuotaRequestState; +import com.azure.resourcemanager.reservations.models.SubRequest; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Quota request details. */ +@Fluent +public final class QuotaRequestDetailsInner extends ProxyResource { + /* + * Quota request details. + */ + @JsonProperty(value = "properties") + private QuotaRequestProperties innerProperties; + + /** Creates an instance of QuotaRequestDetailsInner class. */ + public QuotaRequestDetailsInner() { + } + + /** + * Get the innerProperties property: Quota request details. + * + * @return the innerProperties value. + */ + private QuotaRequestProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the provisioningState property: The quota request status. + * + * @return the provisioningState value. + */ + public QuotaRequestState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Set the provisioningState property: The quota request status. + * + * @param provisioningState the provisioningState value to set. + * @return the QuotaRequestDetailsInner object itself. + */ + public QuotaRequestDetailsInner withProvisioningState(QuotaRequestState provisioningState) { + if (this.innerProperties() == null) { + this.innerProperties = new QuotaRequestProperties(); + } + this.innerProperties().withProvisioningState(provisioningState); + return this; + } + + /** + * Get the message property: User friendly status message. + * + * @return the message value. + */ + public String message() { + return this.innerProperties() == null ? null : this.innerProperties().message(); + } + + /** + * Get the requestSubmitTime property: The time when the quota request was submitted using format: + * yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. + * + * @return the requestSubmitTime value. + */ + public OffsetDateTime requestSubmitTime() { + return this.innerProperties() == null ? null : this.innerProperties().requestSubmitTime(); + } + + /** + * Get the value property: The quotaRequests. + * + * @return the value value. + */ + public List value() { + return this.innerProperties() == null ? null : this.innerProperties().value(); + } + + /** + * Set the value property: The quotaRequests. + * + * @param value the value value to set. + * @return the QuotaRequestDetailsInner object itself. + */ + public QuotaRequestDetailsInner withValue(List value) { + if (this.innerProperties() == null) { + this.innerProperties = new QuotaRequestProperties(); + } + this.innerProperties().withValue(value); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/QuotaRequestProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/QuotaRequestProperties.java new file mode 100644 index 0000000000000..ed50a581f7342 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/QuotaRequestProperties.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.models.QuotaRequestState; +import com.azure.resourcemanager.reservations.models.SubRequest; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The details of quota request. */ +@Fluent +public final class QuotaRequestProperties { + /* + * The quota request status. + */ + @JsonProperty(value = "provisioningState") + private QuotaRequestState provisioningState; + + /* + * User friendly status message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /* + * The time when the quota request was submitted using format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 + * standard. + */ + @JsonProperty(value = "requestSubmitTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime requestSubmitTime; + + /* + * The quotaRequests. + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of QuotaRequestProperties class. */ + public QuotaRequestProperties() { + } + + /** + * Get the provisioningState property: The quota request status. + * + * @return the provisioningState value. + */ + public QuotaRequestState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: The quota request status. + * + * @param provisioningState the provisioningState value to set. + * @return the QuotaRequestProperties object itself. + */ + public QuotaRequestProperties withProvisioningState(QuotaRequestState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the message property: User friendly status message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Get the requestSubmitTime property: The time when the quota request was submitted using format: + * yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. + * + * @return the requestSubmitTime value. + */ + public OffsetDateTime requestSubmitTime() { + return this.requestSubmitTime; + } + + /** + * Get the value property: The quotaRequests. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The quotaRequests. + * + * @param value the value value to set. + * @return the QuotaRequestProperties object itself. + */ + public QuotaRequestProperties withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/QuotaRequestStatusDetails.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/QuotaRequestStatusDetails.java new file mode 100644 index 0000000000000..a9cd4d739a90a --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/QuotaRequestStatusDetails.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.reservations.models.QuotaRequestState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Quota request status details. */ +@Immutable +public final class QuotaRequestStatusDetails { + /* + * The details of the quota request status. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private QuotaRequestState provisioningState; + + /* + * A user friendly message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** Creates an instance of QuotaRequestStatusDetails class. */ + public QuotaRequestStatusDetails() { + } + + /** + * Get the provisioningState property: The details of the quota request status. + * + * @return the provisioningState value. + */ + public QuotaRequestState provisioningState() { + return this.provisioningState; + } + + /** + * Get the message property: A user friendly message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/QuotaRequestSubmitResponse201Inner.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/QuotaRequestSubmitResponse201Inner.java new file mode 100644 index 0000000000000..33c293feb8f11 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/QuotaRequestSubmitResponse201Inner.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.reservations.models.QuotaRequestState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Response with request ID that the quota request was accepted. */ +@Immutable +public final class QuotaRequestSubmitResponse201Inner { + /* + * The quota request ID. Use the requestId parameter to check the request status. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Operation ID + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Resource type + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Quota request status. + */ + @JsonProperty(value = "properties") + private QuotaRequestStatusDetails innerProperties; + + /** Creates an instance of QuotaRequestSubmitResponse201Inner class. */ + public QuotaRequestSubmitResponse201Inner() { + } + + /** + * Get the id property: The quota request ID. Use the requestId parameter to check the request status. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: Operation ID. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: Resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the innerProperties property: Quota request status. + * + * @return the innerProperties value. + */ + private QuotaRequestStatusDetails innerProperties() { + return this.innerProperties; + } + + /** + * Get the provisioningState property: The details of the quota request status. + * + * @return the provisioningState value. + */ + public QuotaRequestState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the message property: A user friendly message. + * + * @return the message value. + */ + public String message() { + return this.innerProperties() == null ? null : this.innerProperties().message(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/RefundResponseInner.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/RefundResponseInner.java new file mode 100644 index 0000000000000..8a3f8859b8c51 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/RefundResponseInner.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.models.RefundResponseProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The response of refund request containing refund information of reservation. */ +@Fluent +public final class RefundResponseInner { + /* + * Fully qualified identifier of the reservation being returned + */ + @JsonProperty(value = "id") + private String id; + + /* + * The refund properties of reservation + */ + @JsonProperty(value = "properties") + private RefundResponseProperties properties; + + /** Creates an instance of RefundResponseInner class. */ + public RefundResponseInner() { + } + + /** + * Get the id property: Fully qualified identifier of the reservation being returned. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Fully qualified identifier of the reservation being returned. + * + * @param id the id value to set. + * @return the RefundResponseInner object itself. + */ + public RefundResponseInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the properties property: The refund properties of reservation. + * + * @return the properties value. + */ + public RefundResponseProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The refund properties of reservation. + * + * @param properties the properties value to set. + * @return the RefundResponseInner object itself. + */ + public RefundResponseInner withProperties(RefundResponseProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ReservationOrderProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ReservationOrderProperties.java new file mode 100644 index 0000000000000..af411bbd6edde --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ReservationOrderProperties.java @@ -0,0 +1,375 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.models.ProvisioningState; +import com.azure.resourcemanager.reservations.models.ReservationBillingPlan; +import com.azure.resourcemanager.reservations.models.ReservationOrderBillingPlanInformation; +import com.azure.resourcemanager.reservations.models.ReservationTerm; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.List; + +/** Properties of a reservation order. */ +@Fluent +public final class ReservationOrderProperties { + /* + * Friendly name for user to easily identified the reservation. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * This is the DateTime when the reservation was initially requested for purchase. + */ + @JsonProperty(value = "requestDateTime") + private OffsetDateTime requestDateTime; + + /* + * This is the DateTime when the reservation was created. + */ + @JsonProperty(value = "createdDateTime") + private OffsetDateTime createdDateTime; + + /* + * This is the date when the reservation will expire. + */ + @JsonProperty(value = "expiryDate") + private LocalDate expiryDate; + + /* + * This is the date-time when the reservation will expire. + */ + @JsonProperty(value = "expiryDateTime") + private OffsetDateTime expiryDateTime; + + /* + * This is the DateTime when the reservation benefit started. + */ + @JsonProperty(value = "benefitStartTime") + private OffsetDateTime benefitStartTime; + + /* + * Total Quantity of the skus purchased in the reservation. + */ + @JsonProperty(value = "originalQuantity") + private Integer originalQuantity; + + /* + * Represent the term of reservation. + */ + @JsonProperty(value = "term") + private ReservationTerm term; + + /* + * Current state of the reservation. + */ + @JsonProperty(value = "provisioningState") + private ProvisioningState provisioningState; + + /* + * Represent the billing plans. + */ + @JsonProperty(value = "billingPlan") + private ReservationBillingPlan billingPlan; + + /* + * Information describing the type of billing plan for this reservation. + */ + @JsonProperty(value = "planInformation") + private ReservationOrderBillingPlanInformation planInformation; + + /* + * The reservations property. + */ + @JsonProperty(value = "reservations") + private List reservations; + + /* + * This is the date-time when the Azure Hybrid Benefit needs to be reviewed. + */ + @JsonProperty(value = "reviewDateTime") + private OffsetDateTime reviewDateTime; + + /** Creates an instance of ReservationOrderProperties class. */ + public ReservationOrderProperties() { + } + + /** + * Get the displayName property: Friendly name for user to easily identified the reservation. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Friendly name for user to easily identified the reservation. + * + * @param displayName the displayName value to set. + * @return the ReservationOrderProperties object itself. + */ + public ReservationOrderProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the requestDateTime property: This is the DateTime when the reservation was initially requested for purchase. + * + * @return the requestDateTime value. + */ + public OffsetDateTime requestDateTime() { + return this.requestDateTime; + } + + /** + * Set the requestDateTime property: This is the DateTime when the reservation was initially requested for purchase. + * + * @param requestDateTime the requestDateTime value to set. + * @return the ReservationOrderProperties object itself. + */ + public ReservationOrderProperties withRequestDateTime(OffsetDateTime requestDateTime) { + this.requestDateTime = requestDateTime; + return this; + } + + /** + * Get the createdDateTime property: This is the DateTime when the reservation was created. + * + * @return the createdDateTime value. + */ + public OffsetDateTime createdDateTime() { + return this.createdDateTime; + } + + /** + * Set the createdDateTime property: This is the DateTime when the reservation was created. + * + * @param createdDateTime the createdDateTime value to set. + * @return the ReservationOrderProperties object itself. + */ + public ReservationOrderProperties withCreatedDateTime(OffsetDateTime createdDateTime) { + this.createdDateTime = createdDateTime; + return this; + } + + /** + * Get the expiryDate property: This is the date when the reservation will expire. + * + * @return the expiryDate value. + */ + public LocalDate expiryDate() { + return this.expiryDate; + } + + /** + * Set the expiryDate property: This is the date when the reservation will expire. + * + * @param expiryDate the expiryDate value to set. + * @return the ReservationOrderProperties object itself. + */ + public ReservationOrderProperties withExpiryDate(LocalDate expiryDate) { + this.expiryDate = expiryDate; + return this; + } + + /** + * Get the expiryDateTime property: This is the date-time when the reservation will expire. + * + * @return the expiryDateTime value. + */ + public OffsetDateTime expiryDateTime() { + return this.expiryDateTime; + } + + /** + * Set the expiryDateTime property: This is the date-time when the reservation will expire. + * + * @param expiryDateTime the expiryDateTime value to set. + * @return the ReservationOrderProperties object itself. + */ + public ReservationOrderProperties withExpiryDateTime(OffsetDateTime expiryDateTime) { + this.expiryDateTime = expiryDateTime; + return this; + } + + /** + * Get the benefitStartTime property: This is the DateTime when the reservation benefit started. + * + * @return the benefitStartTime value. + */ + public OffsetDateTime benefitStartTime() { + return this.benefitStartTime; + } + + /** + * Set the benefitStartTime property: This is the DateTime when the reservation benefit started. + * + * @param benefitStartTime the benefitStartTime value to set. + * @return the ReservationOrderProperties object itself. + */ + public ReservationOrderProperties withBenefitStartTime(OffsetDateTime benefitStartTime) { + this.benefitStartTime = benefitStartTime; + return this; + } + + /** + * Get the originalQuantity property: Total Quantity of the skus purchased in the reservation. + * + * @return the originalQuantity value. + */ + public Integer originalQuantity() { + return this.originalQuantity; + } + + /** + * Set the originalQuantity property: Total Quantity of the skus purchased in the reservation. + * + * @param originalQuantity the originalQuantity value to set. + * @return the ReservationOrderProperties object itself. + */ + public ReservationOrderProperties withOriginalQuantity(Integer originalQuantity) { + this.originalQuantity = originalQuantity; + return this; + } + + /** + * Get the term property: Represent the term of reservation. + * + * @return the term value. + */ + public ReservationTerm term() { + return this.term; + } + + /** + * Set the term property: Represent the term of reservation. + * + * @param term the term value to set. + * @return the ReservationOrderProperties object itself. + */ + public ReservationOrderProperties withTerm(ReservationTerm term) { + this.term = term; + return this; + } + + /** + * Get the provisioningState property: Current state of the reservation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: Current state of the reservation. + * + * @param provisioningState the provisioningState value to set. + * @return the ReservationOrderProperties object itself. + */ + public ReservationOrderProperties withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the billingPlan property: Represent the billing plans. + * + * @return the billingPlan value. + */ + public ReservationBillingPlan billingPlan() { + return this.billingPlan; + } + + /** + * Set the billingPlan property: Represent the billing plans. + * + * @param billingPlan the billingPlan value to set. + * @return the ReservationOrderProperties object itself. + */ + public ReservationOrderProperties withBillingPlan(ReservationBillingPlan billingPlan) { + this.billingPlan = billingPlan; + return this; + } + + /** + * Get the planInformation property: Information describing the type of billing plan for this reservation. + * + * @return the planInformation value. + */ + public ReservationOrderBillingPlanInformation planInformation() { + return this.planInformation; + } + + /** + * Set the planInformation property: Information describing the type of billing plan for this reservation. + * + * @param planInformation the planInformation value to set. + * @return the ReservationOrderProperties object itself. + */ + public ReservationOrderProperties withPlanInformation(ReservationOrderBillingPlanInformation planInformation) { + this.planInformation = planInformation; + return this; + } + + /** + * Get the reservations property: The reservations property. + * + * @return the reservations value. + */ + public List reservations() { + return this.reservations; + } + + /** + * Set the reservations property: The reservations property. + * + * @param reservations the reservations value to set. + * @return the ReservationOrderProperties object itself. + */ + public ReservationOrderProperties withReservations(List reservations) { + this.reservations = reservations; + return this; + } + + /** + * Get the reviewDateTime property: This is the date-time when the Azure Hybrid Benefit needs to be reviewed. + * + * @return the reviewDateTime value. + */ + public OffsetDateTime reviewDateTime() { + return this.reviewDateTime; + } + + /** + * Set the reviewDateTime property: This is the date-time when the Azure Hybrid Benefit needs to be reviewed. + * + * @param reviewDateTime the reviewDateTime value to set. + * @return the ReservationOrderProperties object itself. + */ + public ReservationOrderProperties withReviewDateTime(OffsetDateTime reviewDateTime) { + this.reviewDateTime = reviewDateTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (planInformation() != null) { + planInformation().validate(); + } + if (reservations() != null) { + reservations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ReservationOrderResponseInner.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ReservationOrderResponseInner.java new file mode 100644 index 0000000000000..3a5bfa761e50b --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ReservationOrderResponseInner.java @@ -0,0 +1,391 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.reservations.models.ProvisioningState; +import com.azure.resourcemanager.reservations.models.ReservationBillingPlan; +import com.azure.resourcemanager.reservations.models.ReservationOrderBillingPlanInformation; +import com.azure.resourcemanager.reservations.models.ReservationTerm; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.List; + +/** Details of a reservation order being returned. */ +@Fluent +public final class ReservationOrderResponseInner extends ProxyResource { + /* + * The etag property. + */ + @JsonProperty(value = "etag") + private Integer etag; + + /* + * Properties of a reservation order. + */ + @JsonProperty(value = "properties") + private ReservationOrderProperties innerProperties; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of ReservationOrderResponseInner class. */ + public ReservationOrderResponseInner() { + } + + /** + * Get the etag property: The etag property. + * + * @return the etag value. + */ + public Integer etag() { + return this.etag; + } + + /** + * Set the etag property: The etag property. + * + * @param etag the etag value to set. + * @return the ReservationOrderResponseInner object itself. + */ + public ReservationOrderResponseInner withEtag(Integer etag) { + this.etag = etag; + return this; + } + + /** + * Get the innerProperties property: Properties of a reservation order. + * + * @return the innerProperties value. + */ + private ReservationOrderProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the displayName property: Friendly name for user to easily identified the reservation. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: Friendly name for user to easily identified the reservation. + * + * @param displayName the displayName value to set. + * @return the ReservationOrderResponseInner object itself. + */ + public ReservationOrderResponseInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new ReservationOrderProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the requestDateTime property: This is the DateTime when the reservation was initially requested for purchase. + * + * @return the requestDateTime value. + */ + public OffsetDateTime requestDateTime() { + return this.innerProperties() == null ? null : this.innerProperties().requestDateTime(); + } + + /** + * Set the requestDateTime property: This is the DateTime when the reservation was initially requested for purchase. + * + * @param requestDateTime the requestDateTime value to set. + * @return the ReservationOrderResponseInner object itself. + */ + public ReservationOrderResponseInner withRequestDateTime(OffsetDateTime requestDateTime) { + if (this.innerProperties() == null) { + this.innerProperties = new ReservationOrderProperties(); + } + this.innerProperties().withRequestDateTime(requestDateTime); + return this; + } + + /** + * Get the createdDateTime property: This is the DateTime when the reservation was created. + * + * @return the createdDateTime value. + */ + public OffsetDateTime createdDateTime() { + return this.innerProperties() == null ? null : this.innerProperties().createdDateTime(); + } + + /** + * Set the createdDateTime property: This is the DateTime when the reservation was created. + * + * @param createdDateTime the createdDateTime value to set. + * @return the ReservationOrderResponseInner object itself. + */ + public ReservationOrderResponseInner withCreatedDateTime(OffsetDateTime createdDateTime) { + if (this.innerProperties() == null) { + this.innerProperties = new ReservationOrderProperties(); + } + this.innerProperties().withCreatedDateTime(createdDateTime); + return this; + } + + /** + * Get the expiryDate property: This is the date when the reservation will expire. + * + * @return the expiryDate value. + */ + public LocalDate expiryDate() { + return this.innerProperties() == null ? null : this.innerProperties().expiryDate(); + } + + /** + * Set the expiryDate property: This is the date when the reservation will expire. + * + * @param expiryDate the expiryDate value to set. + * @return the ReservationOrderResponseInner object itself. + */ + public ReservationOrderResponseInner withExpiryDate(LocalDate expiryDate) { + if (this.innerProperties() == null) { + this.innerProperties = new ReservationOrderProperties(); + } + this.innerProperties().withExpiryDate(expiryDate); + return this; + } + + /** + * Get the expiryDateTime property: This is the date-time when the reservation will expire. + * + * @return the expiryDateTime value. + */ + public OffsetDateTime expiryDateTime() { + return this.innerProperties() == null ? null : this.innerProperties().expiryDateTime(); + } + + /** + * Set the expiryDateTime property: This is the date-time when the reservation will expire. + * + * @param expiryDateTime the expiryDateTime value to set. + * @return the ReservationOrderResponseInner object itself. + */ + public ReservationOrderResponseInner withExpiryDateTime(OffsetDateTime expiryDateTime) { + if (this.innerProperties() == null) { + this.innerProperties = new ReservationOrderProperties(); + } + this.innerProperties().withExpiryDateTime(expiryDateTime); + return this; + } + + /** + * Get the benefitStartTime property: This is the DateTime when the reservation benefit started. + * + * @return the benefitStartTime value. + */ + public OffsetDateTime benefitStartTime() { + return this.innerProperties() == null ? null : this.innerProperties().benefitStartTime(); + } + + /** + * Set the benefitStartTime property: This is the DateTime when the reservation benefit started. + * + * @param benefitStartTime the benefitStartTime value to set. + * @return the ReservationOrderResponseInner object itself. + */ + public ReservationOrderResponseInner withBenefitStartTime(OffsetDateTime benefitStartTime) { + if (this.innerProperties() == null) { + this.innerProperties = new ReservationOrderProperties(); + } + this.innerProperties().withBenefitStartTime(benefitStartTime); + return this; + } + + /** + * Get the originalQuantity property: Total Quantity of the skus purchased in the reservation. + * + * @return the originalQuantity value. + */ + public Integer originalQuantity() { + return this.innerProperties() == null ? null : this.innerProperties().originalQuantity(); + } + + /** + * Set the originalQuantity property: Total Quantity of the skus purchased in the reservation. + * + * @param originalQuantity the originalQuantity value to set. + * @return the ReservationOrderResponseInner object itself. + */ + public ReservationOrderResponseInner withOriginalQuantity(Integer originalQuantity) { + if (this.innerProperties() == null) { + this.innerProperties = new ReservationOrderProperties(); + } + this.innerProperties().withOriginalQuantity(originalQuantity); + return this; + } + + /** + * Get the term property: Represent the term of reservation. + * + * @return the term value. + */ + public ReservationTerm term() { + return this.innerProperties() == null ? null : this.innerProperties().term(); + } + + /** + * Set the term property: Represent the term of reservation. + * + * @param term the term value to set. + * @return the ReservationOrderResponseInner object itself. + */ + public ReservationOrderResponseInner withTerm(ReservationTerm term) { + if (this.innerProperties() == null) { + this.innerProperties = new ReservationOrderProperties(); + } + this.innerProperties().withTerm(term); + return this; + } + + /** + * Get the provisioningState property: Current state of the reservation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Set the provisioningState property: Current state of the reservation. + * + * @param provisioningState the provisioningState value to set. + * @return the ReservationOrderResponseInner object itself. + */ + public ReservationOrderResponseInner withProvisioningState(ProvisioningState provisioningState) { + if (this.innerProperties() == null) { + this.innerProperties = new ReservationOrderProperties(); + } + this.innerProperties().withProvisioningState(provisioningState); + return this; + } + + /** + * Get the billingPlan property: Represent the billing plans. + * + * @return the billingPlan value. + */ + public ReservationBillingPlan billingPlan() { + return this.innerProperties() == null ? null : this.innerProperties().billingPlan(); + } + + /** + * Set the billingPlan property: Represent the billing plans. + * + * @param billingPlan the billingPlan value to set. + * @return the ReservationOrderResponseInner object itself. + */ + public ReservationOrderResponseInner withBillingPlan(ReservationBillingPlan billingPlan) { + if (this.innerProperties() == null) { + this.innerProperties = new ReservationOrderProperties(); + } + this.innerProperties().withBillingPlan(billingPlan); + return this; + } + + /** + * Get the planInformation property: Information describing the type of billing plan for this reservation. + * + * @return the planInformation value. + */ + public ReservationOrderBillingPlanInformation planInformation() { + return this.innerProperties() == null ? null : this.innerProperties().planInformation(); + } + + /** + * Set the planInformation property: Information describing the type of billing plan for this reservation. + * + * @param planInformation the planInformation value to set. + * @return the ReservationOrderResponseInner object itself. + */ + public ReservationOrderResponseInner withPlanInformation(ReservationOrderBillingPlanInformation planInformation) { + if (this.innerProperties() == null) { + this.innerProperties = new ReservationOrderProperties(); + } + this.innerProperties().withPlanInformation(planInformation); + return this; + } + + /** + * Get the reservations property: The reservations property. + * + * @return the reservations value. + */ + public List reservations() { + return this.innerProperties() == null ? null : this.innerProperties().reservations(); + } + + /** + * Set the reservations property: The reservations property. + * + * @param reservations the reservations value to set. + * @return the ReservationOrderResponseInner object itself. + */ + public ReservationOrderResponseInner withReservations(List reservations) { + if (this.innerProperties() == null) { + this.innerProperties = new ReservationOrderProperties(); + } + this.innerProperties().withReservations(reservations); + return this; + } + + /** + * Get the reviewDateTime property: This is the date-time when the Azure Hybrid Benefit needs to be reviewed. + * + * @return the reviewDateTime value. + */ + public OffsetDateTime reviewDateTime() { + return this.innerProperties() == null ? null : this.innerProperties().reviewDateTime(); + } + + /** + * Set the reviewDateTime property: This is the date-time when the Azure Hybrid Benefit needs to be reviewed. + * + * @param reviewDateTime the reviewDateTime value to set. + * @return the ReservationOrderResponseInner object itself. + */ + public ReservationOrderResponseInner withReviewDateTime(OffsetDateTime reviewDateTime) { + if (this.innerProperties() == null) { + this.innerProperties = new ReservationOrderProperties(); + } + this.innerProperties().withReviewDateTime(reviewDateTime); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ReservationResponseInner.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ReservationResponseInner.java new file mode 100644 index 0000000000000..a6bbb9964651b --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ReservationResponseInner.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.reservations.models.Kind; +import com.azure.resourcemanager.reservations.models.ReservationsProperties; +import com.azure.resourcemanager.reservations.models.SkuName; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The definition of the reservation. */ +@Fluent +public final class ReservationResponseInner extends ProxyResource { + /* + * The Azure region where the reserved resource lives. + */ + @JsonProperty(value = "location") + private String location; + + /* + * The etag property. + */ + @JsonProperty(value = "etag") + private Integer etag; + + /* + * The sku information associated to this reservation + */ + @JsonProperty(value = "sku") + private SkuName sku; + + /* + * The properties associated to this reservation + */ + @JsonProperty(value = "properties") + private ReservationsProperties properties; + + /* + * Resource Provider type to be reserved. + */ + @JsonProperty(value = "kind") + private Kind kind; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of ReservationResponseInner class. */ + public ReservationResponseInner() { + } + + /** + * Get the location property: The Azure region where the reserved resource lives. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Azure region where the reserved resource lives. + * + * @param location the location value to set. + * @return the ReservationResponseInner object itself. + */ + public ReservationResponseInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the etag property: The etag property. + * + * @return the etag value. + */ + public Integer etag() { + return this.etag; + } + + /** + * Set the etag property: The etag property. + * + * @param etag the etag value to set. + * @return the ReservationResponseInner object itself. + */ + public ReservationResponseInner withEtag(Integer etag) { + this.etag = etag; + return this; + } + + /** + * Get the sku property: The sku information associated to this reservation. + * + * @return the sku value. + */ + public SkuName sku() { + return this.sku; + } + + /** + * Set the sku property: The sku information associated to this reservation. + * + * @param sku the sku value to set. + * @return the ReservationResponseInner object itself. + */ + public ReservationResponseInner withSku(SkuName sku) { + this.sku = sku; + return this; + } + + /** + * Get the properties property: The properties associated to this reservation. + * + * @return the properties value. + */ + public ReservationsProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties associated to this reservation. + * + * @param properties the properties value to set. + * @return the ReservationResponseInner object itself. + */ + public ReservationResponseInner withProperties(ReservationsProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the kind property: Resource Provider type to be reserved. + * + * @return the kind value. + */ + public Kind kind() { + return this.kind; + } + + /** + * Set the kind property: Resource Provider type to be reserved. + * + * @param kind the kind value to set. + * @return the ReservationResponseInner object itself. + */ + public ReservationResponseInner withKind(Kind kind) { + this.kind = kind; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/SavingsPlanPurchaseRequestProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/SavingsPlanPurchaseRequestProperties.java new file mode 100644 index 0000000000000..56276110eada6 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/SavingsPlanPurchaseRequestProperties.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.models.AppliedScopeProperties; +import com.azure.resourcemanager.reservations.models.AppliedScopeType; +import com.azure.resourcemanager.reservations.models.BillingPlan; +import com.azure.resourcemanager.reservations.models.Commitment; +import com.azure.resourcemanager.reservations.models.SavingsPlanTerm; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a savings plan purchase. */ +@Fluent +public final class SavingsPlanPurchaseRequestProperties { + /* + * Friendly name of the savings plan + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * Subscription that will be charged for purchasing reservation or savings plan + */ + @JsonProperty(value = "billingScopeId") + private String billingScopeId; + + /* + * Represent savings plan term in ISO 8601 format. + */ + @JsonProperty(value = "term") + private SavingsPlanTerm term; + + /* + * Represents the billing plan in ISO 8601 format. Required only for monthly billing plans. + */ + @JsonProperty(value = "billingPlan") + private BillingPlan billingPlan; + + /* + * Type of the Applied Scope. + */ + @JsonProperty(value = "appliedScopeType") + private AppliedScopeType appliedScopeType; + + /* + * Properties specific to applied scope type. Not required if not applicable. Required and need to provide tenantId + * and managementGroupId if AppliedScopeType is ManagementGroup + */ + @JsonProperty(value = "appliedScopeProperties") + private AppliedScopeProperties appliedScopeProperties; + + /* + * Commitment towards the benefit. + */ + @JsonProperty(value = "commitment") + private Commitment commitment; + + /** Creates an instance of SavingsPlanPurchaseRequestProperties class. */ + public SavingsPlanPurchaseRequestProperties() { + } + + /** + * Get the displayName property: Friendly name of the savings plan. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Friendly name of the savings plan. + * + * @param displayName the displayName value to set. + * @return the SavingsPlanPurchaseRequestProperties object itself. + */ + public SavingsPlanPurchaseRequestProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the billingScopeId property: Subscription that will be charged for purchasing reservation or savings plan. + * + * @return the billingScopeId value. + */ + public String billingScopeId() { + return this.billingScopeId; + } + + /** + * Set the billingScopeId property: Subscription that will be charged for purchasing reservation or savings plan. + * + * @param billingScopeId the billingScopeId value to set. + * @return the SavingsPlanPurchaseRequestProperties object itself. + */ + public SavingsPlanPurchaseRequestProperties withBillingScopeId(String billingScopeId) { + this.billingScopeId = billingScopeId; + return this; + } + + /** + * Get the term property: Represent savings plan term in ISO 8601 format. + * + * @return the term value. + */ + public SavingsPlanTerm term() { + return this.term; + } + + /** + * Set the term property: Represent savings plan term in ISO 8601 format. + * + * @param term the term value to set. + * @return the SavingsPlanPurchaseRequestProperties object itself. + */ + public SavingsPlanPurchaseRequestProperties withTerm(SavingsPlanTerm term) { + this.term = term; + return this; + } + + /** + * Get the billingPlan property: Represents the billing plan in ISO 8601 format. Required only for monthly billing + * plans. + * + * @return the billingPlan value. + */ + public BillingPlan billingPlan() { + return this.billingPlan; + } + + /** + * Set the billingPlan property: Represents the billing plan in ISO 8601 format. Required only for monthly billing + * plans. + * + * @param billingPlan the billingPlan value to set. + * @return the SavingsPlanPurchaseRequestProperties object itself. + */ + public SavingsPlanPurchaseRequestProperties withBillingPlan(BillingPlan billingPlan) { + this.billingPlan = billingPlan; + return this; + } + + /** + * Get the appliedScopeType property: Type of the Applied Scope. + * + * @return the appliedScopeType value. + */ + public AppliedScopeType appliedScopeType() { + return this.appliedScopeType; + } + + /** + * Set the appliedScopeType property: Type of the Applied Scope. + * + * @param appliedScopeType the appliedScopeType value to set. + * @return the SavingsPlanPurchaseRequestProperties object itself. + */ + public SavingsPlanPurchaseRequestProperties withAppliedScopeType(AppliedScopeType appliedScopeType) { + this.appliedScopeType = appliedScopeType; + return this; + } + + /** + * Get the appliedScopeProperties property: Properties specific to applied scope type. Not required if not + * applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup. + * + * @return the appliedScopeProperties value. + */ + public AppliedScopeProperties appliedScopeProperties() { + return this.appliedScopeProperties; + } + + /** + * Set the appliedScopeProperties property: Properties specific to applied scope type. Not required if not + * applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup. + * + * @param appliedScopeProperties the appliedScopeProperties value to set. + * @return the SavingsPlanPurchaseRequestProperties object itself. + */ + public SavingsPlanPurchaseRequestProperties withAppliedScopeProperties( + AppliedScopeProperties appliedScopeProperties) { + this.appliedScopeProperties = appliedScopeProperties; + return this; + } + + /** + * Get the commitment property: Commitment towards the benefit. + * + * @return the commitment value. + */ + public Commitment commitment() { + return this.commitment; + } + + /** + * Set the commitment property: Commitment towards the benefit. + * + * @param commitment the commitment value to set. + * @return the SavingsPlanPurchaseRequestProperties object itself. + */ + public SavingsPlanPurchaseRequestProperties withCommitment(Commitment commitment) { + this.commitment = commitment; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (appliedScopeProperties() != null) { + appliedScopeProperties().validate(); + } + if (commitment() != null) { + commitment().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/SplitProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/SplitProperties.java new file mode 100644 index 0000000000000..0dc645784a5d2 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/SplitProperties.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties for reservation split. */ +@Fluent +public final class SplitProperties { + /* + * List of the quantities in the new reservations to create. + */ + @JsonProperty(value = "quantities") + private List quantities; + + /* + * Resource id of the reservation to be split. Format of the resource id should be + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} + */ + @JsonProperty(value = "reservationId") + private String reservationId; + + /** Creates an instance of SplitProperties class. */ + public SplitProperties() { + } + + /** + * Get the quantities property: List of the quantities in the new reservations to create. + * + * @return the quantities value. + */ + public List quantities() { + return this.quantities; + } + + /** + * Set the quantities property: List of the quantities in the new reservations to create. + * + * @param quantities the quantities value to set. + * @return the SplitProperties object itself. + */ + public SplitProperties withQuantities(List quantities) { + this.quantities = quantities; + return this; + } + + /** + * Get the reservationId property: Resource id of the reservation to be split. Format of the resource id should be + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @return the reservationId value. + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Set the reservationId property: Resource id of the reservation to be split. Format of the resource id should be + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @param reservationId the reservationId value to set. + * @return the SplitProperties object itself. + */ + public SplitProperties withReservationId(String reservationId) { + this.reservationId = reservationId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/package-info.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/package-info.java new file mode 100644 index 0000000000000..ddf4aa4868f47 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for AzureReservationApi. This API describe Azure Reservation. */ +package com.azure.resourcemanager.reservations.fluent.models; diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/package-info.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/package-info.java new file mode 100644 index 0000000000000..ed64a4ed14f26 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for AzureReservationApi. This API describe Azure Reservation. */ +package com.azure.resourcemanager.reservations.fluent; diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/AppliedReservationsImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/AppliedReservationsImpl.java new file mode 100644 index 0000000000000..efbf747de7216 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/AppliedReservationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.resourcemanager.reservations.fluent.models.AppliedReservationsInner; +import com.azure.resourcemanager.reservations.models.AppliedReservationList; +import com.azure.resourcemanager.reservations.models.AppliedReservations; + +public final class AppliedReservationsImpl implements AppliedReservations { + private AppliedReservationsInner innerObject; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + AppliedReservationsImpl( + AppliedReservationsInner innerObject, + com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public AppliedReservationList reservationOrderIds() { + return this.innerModel().reservationOrderIds(); + } + + public AppliedReservationsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/AvailableScopePropertiesImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/AvailableScopePropertiesImpl.java new file mode 100644 index 0000000000000..9fea6aaad7a75 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/AvailableScopePropertiesImpl.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.resourcemanager.reservations.fluent.models.AvailableScopePropertiesInner; +import com.azure.resourcemanager.reservations.models.AvailableScopeProperties; +import com.azure.resourcemanager.reservations.models.SubscriptionScopeProperties; + +public final class AvailableScopePropertiesImpl implements AvailableScopeProperties { + private AvailableScopePropertiesInner innerObject; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + AvailableScopePropertiesImpl( + AvailableScopePropertiesInner innerObject, + com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public SubscriptionScopeProperties properties() { + return this.innerModel().properties(); + } + + public AvailableScopePropertiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/AzureReservationApiBuilder.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/AzureReservationApiBuilder.java new file mode 100644 index 0000000000000..fb070fec56b8d --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/AzureReservationApiBuilder.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the AzureReservationApiImpl type. */ +@ServiceClientBuilder(serviceClients = {AzureReservationApiImpl.class}) +public final class AzureReservationApiBuilder { + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the AzureReservationApiBuilder. + */ + public AzureReservationApiBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the AzureReservationApiBuilder. + */ + public AzureReservationApiBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the AzureReservationApiBuilder. + */ + public AzureReservationApiBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the AzureReservationApiBuilder. + */ + public AzureReservationApiBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the AzureReservationApiBuilder. + */ + public AzureReservationApiBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of AzureReservationApiImpl with the provided parameters. + * + * @return an instance of AzureReservationApiImpl. + */ + public AzureReservationApiImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = + (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval = + (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = + (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + AzureReservationApiImpl client = + new AzureReservationApiImpl( + localPipeline, localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint); + return client; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/AzureReservationApiImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/AzureReservationApiImpl.java new file mode 100644 index 0000000000000..e38fb2fbbe969 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/AzureReservationApiImpl.java @@ -0,0 +1,388 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.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.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.reservations.fluent.AzureReservationApi; +import com.azure.resourcemanager.reservations.fluent.CalculateExchangesClient; +import com.azure.resourcemanager.reservations.fluent.CalculateRefundsClient; +import com.azure.resourcemanager.reservations.fluent.ExchangesClient; +import com.azure.resourcemanager.reservations.fluent.OperationsClient; +import com.azure.resourcemanager.reservations.fluent.QuotaRequestStatusClient; +import com.azure.resourcemanager.reservations.fluent.QuotasClient; +import com.azure.resourcemanager.reservations.fluent.ReservationOrdersClient; +import com.azure.resourcemanager.reservations.fluent.ReservationsClient; +import com.azure.resourcemanager.reservations.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.reservations.fluent.ReturnsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the AzureReservationApiImpl type. */ +@ServiceClient(builder = AzureReservationApiBuilder.class) +public final class AzureReservationApiImpl implements AzureReservationApi { + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The ReservationsClient object to access its operations. */ + private final ReservationsClient reservations; + + /** + * Gets the ReservationsClient object to access its operations. + * + * @return the ReservationsClient object. + */ + public ReservationsClient getReservations() { + return this.reservations; + } + + /** The ResourceProvidersClient object to access its operations. */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + + /** The ReservationOrdersClient object to access its operations. */ + private final ReservationOrdersClient reservationOrders; + + /** + * Gets the ReservationOrdersClient object to access its operations. + * + * @return the ReservationOrdersClient object. + */ + public ReservationOrdersClient getReservationOrders() { + return this.reservationOrders; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The CalculateRefundsClient object to access its operations. */ + private final CalculateRefundsClient calculateRefunds; + + /** + * Gets the CalculateRefundsClient object to access its operations. + * + * @return the CalculateRefundsClient object. + */ + public CalculateRefundsClient getCalculateRefunds() { + return this.calculateRefunds; + } + + /** The ReturnsClient object to access its operations. */ + private final ReturnsClient returns; + + /** + * Gets the ReturnsClient object to access its operations. + * + * @return the ReturnsClient object. + */ + public ReturnsClient getReturns() { + return this.returns; + } + + /** The CalculateExchangesClient object to access its operations. */ + private final CalculateExchangesClient calculateExchanges; + + /** + * Gets the CalculateExchangesClient object to access its operations. + * + * @return the CalculateExchangesClient object. + */ + public CalculateExchangesClient getCalculateExchanges() { + return this.calculateExchanges; + } + + /** The ExchangesClient object to access its operations. */ + private final ExchangesClient exchanges; + + /** + * Gets the ExchangesClient object to access its operations. + * + * @return the ExchangesClient object. + */ + public ExchangesClient getExchanges() { + return this.exchanges; + } + + /** The QuotasClient object to access its operations. */ + private final QuotasClient quotas; + + /** + * Gets the QuotasClient object to access its operations. + * + * @return the QuotasClient object. + */ + public QuotasClient getQuotas() { + return this.quotas; + } + + /** The QuotaRequestStatusClient object to access its operations. */ + private final QuotaRequestStatusClient quotaRequestStatus; + + /** + * Gets the QuotaRequestStatusClient object to access its operations. + * + * @return the QuotaRequestStatusClient object. + */ + public QuotaRequestStatusClient getQuotaRequestStatus() { + return this.quotaRequestStatus; + } + + /** + * Initializes an instance of AzureReservationApi client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint server parameter. + */ + AzureReservationApiImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.reservations = new ReservationsClientImpl(this); + this.resourceProviders = new ResourceProvidersClientImpl(this); + this.reservationOrders = new ReservationOrdersClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.calculateRefunds = new CalculateRefundsClientImpl(this); + this.returns = new ReturnsClientImpl(this); + this.calculateExchanges = new CalculateExchangesClientImpl(this); + this.exchanges = new ExchangesClientImpl(this); + this.quotas = new QuotasClientImpl(this); + this.quotaRequestStatus = new QuotaRequestStatusClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AzureReservationApiImpl.class); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateExchangeOperationResultResponseImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateExchangeOperationResultResponseImpl.java new file mode 100644 index 0000000000000..f3b7583a8d4d8 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateExchangeOperationResultResponseImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.resourcemanager.reservations.fluent.models.CalculateExchangeOperationResultResponseInner; +import com.azure.resourcemanager.reservations.models.CalculateExchangeOperationResultResponse; +import com.azure.resourcemanager.reservations.models.CalculateExchangeOperationResultStatus; +import com.azure.resourcemanager.reservations.models.CalculateExchangeResponseProperties; +import com.azure.resourcemanager.reservations.models.OperationResultError; + +public final class CalculateExchangeOperationResultResponseImpl implements CalculateExchangeOperationResultResponse { + private CalculateExchangeOperationResultResponseInner innerObject; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + CalculateExchangeOperationResultResponseImpl( + CalculateExchangeOperationResultResponseInner innerObject, + com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public CalculateExchangeOperationResultStatus status() { + return this.innerModel().status(); + } + + public CalculateExchangeResponseProperties properties() { + return this.innerModel().properties(); + } + + public OperationResultError error() { + return this.innerModel().error(); + } + + public CalculateExchangeOperationResultResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateExchangesClientImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateExchangesClientImpl.java new file mode 100644 index 0000000000000..62f1c642e267a --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateExchangesClientImpl.java @@ -0,0 +1,291 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.reservations.fluent.CalculateExchangesClient; +import com.azure.resourcemanager.reservations.fluent.models.CalculateExchangeOperationResultResponseInner; +import com.azure.resourcemanager.reservations.models.CalculateExchangeRequest; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CalculateExchangesClient. */ +public final class CalculateExchangesClientImpl implements CalculateExchangesClient { + /** The proxy service used to perform REST calls. */ + private final CalculateExchangesService service; + + /** The service client containing this operation class. */ + private final AzureReservationApiImpl client; + + /** + * Initializes an instance of CalculateExchangesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CalculateExchangesClientImpl(AzureReservationApiImpl client) { + this.service = + RestProxy.create(CalculateExchangesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureReservationApiCalculateExchanges to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureReservationApiC") + public interface CalculateExchangesService { + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.Capacity/calculateExchange") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> post( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CalculateExchangeRequest body, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Calculates the refund amounts and price of the new purchases. + * + *

Calculates price for exchanging `Reservations` if there are no policy errors. + * + * @param body Request containing purchases and refunds that need to be executed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return calculateExchange operation result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> postWithResponseAsync(CalculateExchangeRequest body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.post(this.client.getEndpoint(), apiVersion, body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Calculates the refund amounts and price of the new purchases. + * + *

Calculates price for exchanging `Reservations` if there are no policy errors. + * + * @param body Request containing purchases and refunds that need to be executed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return calculateExchange operation result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> postWithResponseAsync(CalculateExchangeRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.post(this.client.getEndpoint(), apiVersion, body, accept, context); + } + + /** + * Calculates the refund amounts and price of the new purchases. + * + *

Calculates price for exchanging `Reservations` if there are no policy errors. + * + * @param body Request containing purchases and refunds that need to be executed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 calculateExchange operation result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, CalculateExchangeOperationResultResponseInner> + beginPostAsync(CalculateExchangeRequest body) { + Mono>> mono = postWithResponseAsync(body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CalculateExchangeOperationResultResponseInner.class, + CalculateExchangeOperationResultResponseInner.class, + this.client.getContext()); + } + + /** + * Calculates the refund amounts and price of the new purchases. + * + *

Calculates price for exchanging `Reservations` if there are no policy errors. + * + * @param body Request containing purchases and refunds that need to be executed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 calculateExchange operation result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux< + PollResult, CalculateExchangeOperationResultResponseInner> + beginPostAsync(CalculateExchangeRequest body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = postWithResponseAsync(body, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CalculateExchangeOperationResultResponseInner.class, + CalculateExchangeOperationResultResponseInner.class, + context); + } + + /** + * Calculates the refund amounts and price of the new purchases. + * + *

Calculates price for exchanging `Reservations` if there are no policy errors. + * + * @param body Request containing purchases and refunds that need to be executed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 calculateExchange operation result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, CalculateExchangeOperationResultResponseInner> + beginPost(CalculateExchangeRequest body) { + return this.beginPostAsync(body).getSyncPoller(); + } + + /** + * Calculates the refund amounts and price of the new purchases. + * + *

Calculates price for exchanging `Reservations` if there are no policy errors. + * + * @param body Request containing purchases and refunds that need to be executed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 calculateExchange operation result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller< + PollResult, CalculateExchangeOperationResultResponseInner> + beginPost(CalculateExchangeRequest body, Context context) { + return this.beginPostAsync(body, context).getSyncPoller(); + } + + /** + * Calculates the refund amounts and price of the new purchases. + * + *

Calculates price for exchanging `Reservations` if there are no policy errors. + * + * @param body Request containing purchases and refunds that need to be executed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return calculateExchange operation result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono postAsync(CalculateExchangeRequest body) { + return beginPostAsync(body).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Calculates the refund amounts and price of the new purchases. + * + *

Calculates price for exchanging `Reservations` if there are no policy errors. + * + * @param body Request containing purchases and refunds that need to be executed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return calculateExchange operation result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono postAsync( + CalculateExchangeRequest body, Context context) { + return beginPostAsync(body, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Calculates the refund amounts and price of the new purchases. + * + *

Calculates price for exchanging `Reservations` if there are no policy errors. + * + * @param body Request containing purchases and refunds that need to be executed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return calculateExchange operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CalculateExchangeOperationResultResponseInner post(CalculateExchangeRequest body) { + return postAsync(body).block(); + } + + /** + * Calculates the refund amounts and price of the new purchases. + * + *

Calculates price for exchanging `Reservations` if there are no policy errors. + * + * @param body Request containing purchases and refunds that need to be executed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return calculateExchange operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CalculateExchangeOperationResultResponseInner post(CalculateExchangeRequest body, Context context) { + return postAsync(body, context).block(); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateExchangesImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateExchangesImpl.java new file mode 100644 index 0000000000000..8e0b0e02dd723 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateExchangesImpl.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.reservations.fluent.CalculateExchangesClient; +import com.azure.resourcemanager.reservations.fluent.models.CalculateExchangeOperationResultResponseInner; +import com.azure.resourcemanager.reservations.models.CalculateExchangeOperationResultResponse; +import com.azure.resourcemanager.reservations.models.CalculateExchangeRequest; +import com.azure.resourcemanager.reservations.models.CalculateExchanges; + +public final class CalculateExchangesImpl implements CalculateExchanges { + private static final ClientLogger LOGGER = new ClientLogger(CalculateExchangesImpl.class); + + private final CalculateExchangesClient innerClient; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + public CalculateExchangesImpl( + CalculateExchangesClient innerClient, + com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public CalculateExchangeOperationResultResponse post(CalculateExchangeRequest body) { + CalculateExchangeOperationResultResponseInner inner = this.serviceClient().post(body); + if (inner != null) { + return new CalculateExchangeOperationResultResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public CalculateExchangeOperationResultResponse post(CalculateExchangeRequest body, Context context) { + CalculateExchangeOperationResultResponseInner inner = this.serviceClient().post(body, context); + if (inner != null) { + return new CalculateExchangeOperationResultResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private CalculateExchangesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculatePriceResponseImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculatePriceResponseImpl.java new file mode 100644 index 0000000000000..c5bb28847efe6 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculatePriceResponseImpl.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.resourcemanager.reservations.fluent.models.CalculatePriceResponseInner; +import com.azure.resourcemanager.reservations.models.CalculatePriceResponse; +import com.azure.resourcemanager.reservations.models.CalculatePriceResponseProperties; + +public final class CalculatePriceResponseImpl implements CalculatePriceResponse { + private CalculatePriceResponseInner innerObject; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + CalculatePriceResponseImpl( + CalculatePriceResponseInner innerObject, + com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public CalculatePriceResponseProperties properties() { + return this.innerModel().properties(); + } + + public CalculatePriceResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateRefundResponseImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateRefundResponseImpl.java new file mode 100644 index 0000000000000..398828ae32bac --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateRefundResponseImpl.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.resourcemanager.reservations.fluent.models.CalculateRefundResponseInner; +import com.azure.resourcemanager.reservations.models.CalculateRefundResponse; +import com.azure.resourcemanager.reservations.models.RefundResponseProperties; + +public final class CalculateRefundResponseImpl implements CalculateRefundResponse { + private CalculateRefundResponseInner innerObject; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + CalculateRefundResponseImpl( + CalculateRefundResponseInner innerObject, + com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public RefundResponseProperties properties() { + return this.innerModel().properties(); + } + + public CalculateRefundResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateRefundsClientImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateRefundsClientImpl.java new file mode 100644 index 0000000000000..6f7742fd81634 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateRefundsClientImpl.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.reservations.fluent.CalculateRefundsClient; +import com.azure.resourcemanager.reservations.fluent.models.CalculateRefundResponseInner; +import com.azure.resourcemanager.reservations.models.CalculateRefundRequest; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CalculateRefundsClient. */ +public final class CalculateRefundsClientImpl implements CalculateRefundsClient { + /** The proxy service used to perform REST calls. */ + private final CalculateRefundsService service; + + /** The service client containing this operation class. */ + private final AzureReservationApiImpl client; + + /** + * Initializes an instance of CalculateRefundsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CalculateRefundsClientImpl(AzureReservationApiImpl client) { + this.service = + RestProxy.create(CalculateRefundsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureReservationApiCalculateRefunds to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureReservationApiC") + public interface CalculateRefundsService { + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/calculateRefund") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> post( + @HostParam("$host") String endpoint, + @PathParam("reservationOrderId") String reservationOrderId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CalculateRefundRequest body, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Calculate the refund amount of a reservation order. + * + *

Calculate price for returning `Reservations` if there are no policy errors. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculating refund of a reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of calculate refund containing refund information of reservation along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> postWithResponseAsync( + String reservationOrderId, CalculateRefundRequest body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.post(this.client.getEndpoint(), reservationOrderId, apiVersion, body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Calculate the refund amount of a reservation order. + * + *

Calculate price for returning `Reservations` if there are no policy errors. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculating refund of 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 response of calculate refund containing refund information of reservation along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> postWithResponseAsync( + String reservationOrderId, CalculateRefundRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.post(this.client.getEndpoint(), reservationOrderId, apiVersion, body, accept, context); + } + + /** + * Calculate the refund amount of a reservation order. + * + *

Calculate price for returning `Reservations` if there are no policy errors. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculating refund of a reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of calculate refund containing refund information of reservation on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono postAsync(String reservationOrderId, CalculateRefundRequest body) { + return postWithResponseAsync(reservationOrderId, body).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Calculate the refund amount of a reservation order. + * + *

Calculate price for returning `Reservations` if there are no policy errors. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculating refund of 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 response of calculate refund containing refund information of reservation along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response postWithResponse( + String reservationOrderId, CalculateRefundRequest body, Context context) { + return postWithResponseAsync(reservationOrderId, body, context).block(); + } + + /** + * Calculate the refund amount of a reservation order. + * + *

Calculate price for returning `Reservations` if there are no policy errors. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculating refund of a reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of calculate refund containing refund information of reservation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CalculateRefundResponseInner post(String reservationOrderId, CalculateRefundRequest body) { + return postWithResponse(reservationOrderId, body, Context.NONE).getValue(); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateRefundsImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateRefundsImpl.java new file mode 100644 index 0000000000000..180bbdb055148 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CalculateRefundsImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.reservations.fluent.CalculateRefundsClient; +import com.azure.resourcemanager.reservations.fluent.models.CalculateRefundResponseInner; +import com.azure.resourcemanager.reservations.models.CalculateRefundRequest; +import com.azure.resourcemanager.reservations.models.CalculateRefundResponse; +import com.azure.resourcemanager.reservations.models.CalculateRefunds; + +public final class CalculateRefundsImpl implements CalculateRefunds { + private static final ClientLogger LOGGER = new ClientLogger(CalculateRefundsImpl.class); + + private final CalculateRefundsClient innerClient; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + public CalculateRefundsImpl( + CalculateRefundsClient innerClient, com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response postWithResponse( + String reservationOrderId, CalculateRefundRequest body, Context context) { + Response inner = + this.serviceClient().postWithResponse(reservationOrderId, body, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CalculateRefundResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CalculateRefundResponse post(String reservationOrderId, CalculateRefundRequest body) { + CalculateRefundResponseInner inner = this.serviceClient().post(reservationOrderId, body); + if (inner != null) { + return new CalculateRefundResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private CalculateRefundsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CatalogImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CatalogImpl.java new file mode 100644 index 0000000000000..5945c5f8ed2b0 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CatalogImpl.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.resourcemanager.reservations.fluent.models.CatalogInner; +import com.azure.resourcemanager.reservations.models.Catalog; +import com.azure.resourcemanager.reservations.models.CatalogMsrp; +import com.azure.resourcemanager.reservations.models.ReservationBillingPlan; +import com.azure.resourcemanager.reservations.models.ReservationTerm; +import com.azure.resourcemanager.reservations.models.SkuCapability; +import com.azure.resourcemanager.reservations.models.SkuProperty; +import com.azure.resourcemanager.reservations.models.SkuRestriction; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class CatalogImpl implements Catalog { + private CatalogInner innerObject; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + CatalogImpl(CatalogInner innerObject, com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String resourceType() { + return this.innerModel().resourceType(); + } + + public String name() { + return this.innerModel().name(); + } + + public Map> billingPlans() { + Map> inner = this.innerModel().billingPlans(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public List terms() { + List inner = this.innerModel().terms(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List locations() { + List inner = this.innerModel().locations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List skuProperties() { + List inner = this.innerModel().skuProperties(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public CatalogMsrp msrp() { + return this.innerModel().msrp(); + } + + public List restrictions() { + List inner = this.innerModel().restrictions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String tier() { + return this.innerModel().tier(); + } + + public String size() { + return this.innerModel().size(); + } + + public List capabilities() { + List inner = this.innerModel().capabilities(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public CatalogInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ChangeDirectoryResponseImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ChangeDirectoryResponseImpl.java new file mode 100644 index 0000000000000..fa39096b3dbce --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ChangeDirectoryResponseImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.resourcemanager.reservations.fluent.models.ChangeDirectoryResponseInner; +import com.azure.resourcemanager.reservations.models.ChangeDirectoryResponse; +import com.azure.resourcemanager.reservations.models.ChangeDirectoryResult; +import java.util.Collections; +import java.util.List; + +public final class ChangeDirectoryResponseImpl implements ChangeDirectoryResponse { + private ChangeDirectoryResponseInner innerObject; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + ChangeDirectoryResponseImpl( + ChangeDirectoryResponseInner innerObject, + com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public ChangeDirectoryResult reservationOrder() { + return this.innerModel().reservationOrder(); + } + + public List reservations() { + List inner = this.innerModel().reservations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ChangeDirectoryResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CurrentQuotaLimitBaseImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CurrentQuotaLimitBaseImpl.java new file mode 100644 index 0000000000000..508c858082627 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/CurrentQuotaLimitBaseImpl.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.reservations.fluent.models.CurrentQuotaLimitBaseInner; +import com.azure.resourcemanager.reservations.models.CurrentQuotaLimitBase; +import com.azure.resourcemanager.reservations.models.QuotaProperties; + +public final class CurrentQuotaLimitBaseImpl + implements CurrentQuotaLimitBase, CurrentQuotaLimitBase.Definition, CurrentQuotaLimitBase.Update { + private CurrentQuotaLimitBaseInner innerObject; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public QuotaProperties properties() { + return this.innerModel().properties(); + } + + public CurrentQuotaLimitBaseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } + + private String subscriptionId; + + private String providerId; + + private String location; + + private String resourceName; + + public CurrentQuotaLimitBaseImpl withExistingLocation(String subscriptionId, String providerId, String location) { + this.subscriptionId = subscriptionId; + this.providerId = providerId; + this.location = location; + return this; + } + + public CurrentQuotaLimitBase create() { + this.innerObject = + serviceManager + .serviceClient() + .getQuotas() + .createOrUpdate(subscriptionId, providerId, location, resourceName, this.innerModel(), Context.NONE); + return this; + } + + public CurrentQuotaLimitBase create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getQuotas() + .createOrUpdate(subscriptionId, providerId, location, resourceName, this.innerModel(), context); + return this; + } + + CurrentQuotaLimitBaseImpl(String name, com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerObject = new CurrentQuotaLimitBaseInner(); + this.serviceManager = serviceManager; + this.resourceName = name; + } + + public CurrentQuotaLimitBaseImpl update() { + return this; + } + + public CurrentQuotaLimitBase apply() { + this.innerObject = + serviceManager + .serviceClient() + .getQuotas() + .update(subscriptionId, providerId, location, resourceName, this.innerModel(), Context.NONE); + return this; + } + + public CurrentQuotaLimitBase apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getQuotas() + .update(subscriptionId, providerId, location, resourceName, this.innerModel(), context); + return this; + } + + CurrentQuotaLimitBaseImpl( + CurrentQuotaLimitBaseInner innerObject, + com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.subscriptionId = Utils.getValueFromIdByName(innerObject.id(), "subscriptions"); + this.providerId = Utils.getValueFromIdByName(innerObject.id(), "resourceProviders"); + this.location = Utils.getValueFromIdByName(innerObject.id(), "locations"); + this.resourceName = Utils.getValueFromIdByName(innerObject.id(), "serviceLimits"); + } + + public CurrentQuotaLimitBase refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getQuotas() + .getWithResponse(subscriptionId, providerId, location, resourceName, Context.NONE) + .getValue(); + return this; + } + + public CurrentQuotaLimitBase refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getQuotas() + .getWithResponse(subscriptionId, providerId, location, resourceName, context) + .getValue(); + return this; + } + + public CurrentQuotaLimitBaseImpl withProperties(QuotaProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ExchangeOperationResultResponseImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ExchangeOperationResultResponseImpl.java new file mode 100644 index 0000000000000..e423b53859905 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ExchangeOperationResultResponseImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.resourcemanager.reservations.fluent.models.ExchangeOperationResultResponseInner; +import com.azure.resourcemanager.reservations.models.ExchangeOperationResultResponse; +import com.azure.resourcemanager.reservations.models.ExchangeOperationResultStatus; +import com.azure.resourcemanager.reservations.models.ExchangeResponseProperties; +import com.azure.resourcemanager.reservations.models.OperationResultError; + +public final class ExchangeOperationResultResponseImpl implements ExchangeOperationResultResponse { + private ExchangeOperationResultResponseInner innerObject; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + ExchangeOperationResultResponseImpl( + ExchangeOperationResultResponseInner innerObject, + com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public ExchangeOperationResultStatus status() { + return this.innerModel().status(); + } + + public ExchangeResponseProperties properties() { + return this.innerModel().properties(); + } + + public OperationResultError error() { + return this.innerModel().error(); + } + + public ExchangeOperationResultResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ExchangesClientImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ExchangesClientImpl.java new file mode 100644 index 0000000000000..79d28199d58b7 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ExchangesClientImpl.java @@ -0,0 +1,286 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.reservations.fluent.ExchangesClient; +import com.azure.resourcemanager.reservations.fluent.models.ExchangeOperationResultResponseInner; +import com.azure.resourcemanager.reservations.models.ExchangeRequest; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ExchangesClient. */ +public final class ExchangesClientImpl implements ExchangesClient { + /** The proxy service used to perform REST calls. */ + private final ExchangesService service; + + /** The service client containing this operation class. */ + private final AzureReservationApiImpl client; + + /** + * Initializes an instance of ExchangesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExchangesClientImpl(AzureReservationApiImpl client) { + this.service = + RestProxy.create(ExchangesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureReservationApiExchanges to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureReservationApiE") + public interface ExchangesService { + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.Capacity/exchange") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> post( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ExchangeRequest body, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Exchange Reservation(s) + * + *

Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + * + * @param body Request containing the refunds and purchases that need to be executed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return exchange operation result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> postWithResponseAsync(ExchangeRequest body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.post(this.client.getEndpoint(), apiVersion, body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Exchange Reservation(s) + * + *

Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + * + * @param body Request containing the refunds and purchases that need to be executed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return exchange operation result along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> postWithResponseAsync(ExchangeRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.post(this.client.getEndpoint(), apiVersion, body, accept, context); + } + + /** + * Exchange Reservation(s) + * + *

Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + * + * @param body Request containing the refunds and purchases that need to be executed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 exchange operation result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ExchangeOperationResultResponseInner> + beginPostAsync(ExchangeRequest body) { + Mono>> mono = postWithResponseAsync(body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ExchangeOperationResultResponseInner.class, + ExchangeOperationResultResponseInner.class, + this.client.getContext()); + } + + /** + * Exchange Reservation(s) + * + *

Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + * + * @param body Request containing the refunds and purchases that need to be executed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 exchange operation result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ExchangeOperationResultResponseInner> + beginPostAsync(ExchangeRequest body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = postWithResponseAsync(body, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ExchangeOperationResultResponseInner.class, + ExchangeOperationResultResponseInner.class, + context); + } + + /** + * Exchange Reservation(s) + * + *

Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + * + * @param body Request containing the refunds and purchases that need to be executed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 exchange operation result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ExchangeOperationResultResponseInner> beginPost( + ExchangeRequest body) { + return this.beginPostAsync(body).getSyncPoller(); + } + + /** + * Exchange Reservation(s) + * + *

Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + * + * @param body Request containing the refunds and purchases that need to be executed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 exchange operation result. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ExchangeOperationResultResponseInner> beginPost( + ExchangeRequest body, Context context) { + return this.beginPostAsync(body, context).getSyncPoller(); + } + + /** + * Exchange Reservation(s) + * + *

Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + * + * @param body Request containing the refunds and purchases that need to be executed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return exchange operation result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono postAsync(ExchangeRequest body) { + return beginPostAsync(body).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Exchange Reservation(s) + * + *

Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + * + * @param body Request containing the refunds and purchases that need to be executed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return exchange operation result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono postAsync(ExchangeRequest body, Context context) { + return beginPostAsync(body, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Exchange Reservation(s) + * + *

Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + * + * @param body Request containing the refunds and purchases that need to be executed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return exchange operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExchangeOperationResultResponseInner post(ExchangeRequest body) { + return postAsync(body).block(); + } + + /** + * Exchange Reservation(s) + * + *

Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + * + * @param body Request containing the refunds and purchases that need to be executed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return exchange operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExchangeOperationResultResponseInner post(ExchangeRequest body, Context context) { + return postAsync(body, context).block(); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ExchangesImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ExchangesImpl.java new file mode 100644 index 0000000000000..d03c6f4079c75 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ExchangesImpl.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.reservations.fluent.ExchangesClient; +import com.azure.resourcemanager.reservations.fluent.models.ExchangeOperationResultResponseInner; +import com.azure.resourcemanager.reservations.models.ExchangeOperationResultResponse; +import com.azure.resourcemanager.reservations.models.ExchangeRequest; +import com.azure.resourcemanager.reservations.models.Exchanges; + +public final class ExchangesImpl implements Exchanges { + private static final ClientLogger LOGGER = new ClientLogger(ExchangesImpl.class); + + private final ExchangesClient innerClient; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + public ExchangesImpl( + ExchangesClient innerClient, com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ExchangeOperationResultResponse post(ExchangeRequest body) { + ExchangeOperationResultResponseInner inner = this.serviceClient().post(body); + if (inner != null) { + return new ExchangeOperationResultResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ExchangeOperationResultResponse post(ExchangeRequest body, Context context) { + ExchangeOperationResultResponseInner inner = this.serviceClient().post(body, context); + if (inner != null) { + return new ExchangeOperationResultResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private ExchangesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/OperationResponseImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/OperationResponseImpl.java new file mode 100644 index 0000000000000..c83f82c120e0b --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/OperationResponseImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.resourcemanager.reservations.fluent.models.OperationResponseInner; +import com.azure.resourcemanager.reservations.models.OperationDisplay; +import com.azure.resourcemanager.reservations.models.OperationResponse; + +public final class OperationResponseImpl implements OperationResponse { + private OperationResponseInner innerObject; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + OperationResponseImpl( + OperationResponseInner innerObject, com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public String origin() { + return this.innerModel().origin(); + } + + public Object properties() { + return this.innerModel().properties(); + } + + public OperationResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/OperationsClientImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..e21dc437721a5 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/OperationsClientImpl.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.reservations.fluent.OperationsClient; +import com.azure.resourcemanager.reservations.fluent.models.OperationResponseInner; +import com.azure.resourcemanager.reservations.models.OperationList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final AzureReservationApiImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(AzureReservationApiImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureReservationApiOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureReservationApiO") + public interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Capacity/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get operations. + * + *

List all the operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paginated list of operations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2022-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get operations. + * + *

List all the operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paginated list of operations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2022-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get operations. + * + *

List all the operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paginated list of operations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get operations. + * + *

List all the operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paginated list of operations as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get operations. + * + *

List all the operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paginated list of operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Get operations. + * + *

List all the operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paginated list of operations as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paginated list of operations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paginated list of operations along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/OperationsImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..85c034a855dbe --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.reservations.fluent.OperationsClient; +import com.azure.resourcemanager.reservations.fluent.models.OperationResponseInner; +import com.azure.resourcemanager.reservations.models.OperationResponse; +import com.azure.resourcemanager.reservations.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationResponseImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationResponseImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotaRequestDetailsImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotaRequestDetailsImpl.java new file mode 100644 index 0000000000000..dc1e50bb5b0d7 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotaRequestDetailsImpl.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.resourcemanager.reservations.fluent.models.QuotaRequestDetailsInner; +import com.azure.resourcemanager.reservations.models.QuotaRequestDetails; +import com.azure.resourcemanager.reservations.models.QuotaRequestState; +import com.azure.resourcemanager.reservations.models.SubRequest; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class QuotaRequestDetailsImpl implements QuotaRequestDetails { + private QuotaRequestDetailsInner innerObject; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + QuotaRequestDetailsImpl( + QuotaRequestDetailsInner innerObject, + com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public QuotaRequestState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String message() { + return this.innerModel().message(); + } + + public OffsetDateTime requestSubmitTime() { + return this.innerModel().requestSubmitTime(); + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public QuotaRequestDetailsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotaRequestStatusClientImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotaRequestStatusClientImpl.java new file mode 100644 index 0000000000000..e56580f678c66 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotaRequestStatusClientImpl.java @@ -0,0 +1,599 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.reservations.fluent.QuotaRequestStatusClient; +import com.azure.resourcemanager.reservations.fluent.models.QuotaRequestDetailsInner; +import com.azure.resourcemanager.reservations.models.QuotaRequestDetailsList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in QuotaRequestStatusClient. */ +public final class QuotaRequestStatusClientImpl implements QuotaRequestStatusClient { + /** The proxy service used to perform REST calls. */ + private final QuotaRequestStatusService service; + + /** The service client containing this operation class. */ + private final AzureReservationApiImpl client; + + /** + * Initializes an instance of QuotaRequestStatusClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + QuotaRequestStatusClientImpl(AzureReservationApiImpl client) { + this.service = + RestProxy.create(QuotaRequestStatusService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureReservationApiQuotaRequestStatus to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureReservationApiQ") + public interface QuotaRequestStatusService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations" + + "/{location}/serviceLimitsRequests/{id}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("providerId") String providerId, + @PathParam("location") String location, + @PathParam("id") String id, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations" + + "/{location}/serviceLimitsRequests") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("providerId") String providerId, + @PathParam("location") String location, + @QueryParam("$filter") String filter, + @QueryParam("$top") Integer top, + @QueryParam("$skiptoken") String skiptoken, + @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); + } + + /** + * For the specified Azure region (location), get the details and status of the quota request by the quota request + * ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response + * with the requestId parameter. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param id Quota Request ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota request details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String subscriptionId, String providerId, String location, String id) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (providerId == null) { + return Mono.error(new IllegalArgumentException("Parameter providerId is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (id == null) { + return Mono.error(new IllegalArgumentException("Parameter id is required and cannot be null.")); + } + final String apiVersion = "2020-10-25"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + subscriptionId, + apiVersion, + providerId, + location, + id, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * For the specified Azure region (location), get the details and status of the quota request by the quota request + * ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response + * with the requestId parameter. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param id Quota Request ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota request details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String subscriptionId, String providerId, String location, String id, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (providerId == null) { + return Mono.error(new IllegalArgumentException("Parameter providerId is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (id == null) { + return Mono.error(new IllegalArgumentException("Parameter id is required and cannot be null.")); + } + final String apiVersion = "2020-10-25"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get(this.client.getEndpoint(), subscriptionId, apiVersion, providerId, location, id, accept, context); + } + + /** + * For the specified Azure region (location), get the details and status of the quota request by the quota request + * ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response + * with the requestId parameter. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param id Quota Request ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota request details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String subscriptionId, String providerId, String location, String id) { + return getWithResponseAsync(subscriptionId, providerId, location, id) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * For the specified Azure region (location), get the details and status of the quota request by the quota request + * ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response + * with the requestId parameter. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param id Quota Request ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota request details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String subscriptionId, String providerId, String location, String id, Context context) { + return getWithResponseAsync(subscriptionId, providerId, location, id, context).block(); + } + + /** + * For the specified Azure region (location), get the details and status of the quota request by the quota request + * ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response + * with the requestId parameter. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param id Quota Request ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota request details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public QuotaRequestDetailsInner get(String subscriptionId, String providerId, String location, String id) { + return getWithResponse(subscriptionId, providerId, location, id, Context.NONE).getValue(); + } + + /** + * For the specified Azure region (location), subscription, and resource provider, get the history of the quota + * requests for the past year. To select specific quota requests, use the oData filter. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param filter | Field | Supported operators | |---------------------|------------------------| |requestSubmitTime + * | ge, le, eq, gt, lt |. + * @param top Number of records to return. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element includes a skiptoken parameter that specifies + * a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota request details along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String subscriptionId, String providerId, String location, String filter, Integer top, String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (providerId == null) { + return Mono.error(new IllegalArgumentException("Parameter providerId is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String apiVersion = "2020-10-25"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + subscriptionId, + apiVersion, + providerId, + location, + filter, + top, + skiptoken, + 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())); + } + + /** + * For the specified Azure region (location), subscription, and resource provider, get the history of the quota + * requests for the past year. To select specific quota requests, use the oData filter. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param filter | Field | Supported operators | |---------------------|------------------------| |requestSubmitTime + * | ge, le, eq, gt, lt |. + * @param top Number of records to return. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element includes a skiptoken parameter that specifies + * a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota request details along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String subscriptionId, + String providerId, + String location, + String filter, + Integer top, + String skiptoken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (providerId == null) { + return Mono.error(new IllegalArgumentException("Parameter providerId is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String apiVersion = "2020-10-25"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + subscriptionId, + apiVersion, + providerId, + location, + filter, + top, + skiptoken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * For the specified Azure region (location), subscription, and resource provider, get the history of the quota + * requests for the past year. To select specific quota requests, use the oData filter. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param filter | Field | Supported operators | |---------------------|------------------------| |requestSubmitTime + * | ge, le, eq, gt, lt |. + * @param top Number of records to return. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element includes a skiptoken parameter that specifies + * a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota request details as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String subscriptionId, String providerId, String location, String filter, Integer top, String skiptoken) { + return new PagedFlux<>( + () -> listSinglePageAsync(subscriptionId, providerId, location, filter, top, skiptoken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * For the specified Azure region (location), subscription, and resource provider, get the history of the quota + * requests for the past year. To select specific quota requests, use the oData filter. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota request details as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String subscriptionId, String providerId, String location) { + final String filter = null; + final Integer top = null; + final String skiptoken = null; + return new PagedFlux<>( + () -> listSinglePageAsync(subscriptionId, providerId, location, filter, top, skiptoken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * For the specified Azure region (location), subscription, and resource provider, get the history of the quota + * requests for the past year. To select specific quota requests, use the oData filter. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param filter | Field | Supported operators | |---------------------|------------------------| |requestSubmitTime + * | ge, le, eq, gt, lt |. + * @param top Number of records to return. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element includes a skiptoken parameter that specifies + * a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota request details as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String subscriptionId, + String providerId, + String location, + String filter, + Integer top, + String skiptoken, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(subscriptionId, providerId, location, filter, top, skiptoken, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * For the specified Azure region (location), subscription, and resource provider, get the history of the quota + * requests for the past year. To select specific quota requests, use the oData filter. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota request details as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String subscriptionId, String providerId, String location) { + final String filter = null; + final Integer top = null; + final String skiptoken = null; + return new PagedIterable<>(listAsync(subscriptionId, providerId, location, filter, top, skiptoken)); + } + + /** + * For the specified Azure region (location), subscription, and resource provider, get the history of the quota + * requests for the past year. To select specific quota requests, use the oData filter. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param filter | Field | Supported operators | |---------------------|------------------------| |requestSubmitTime + * | ge, le, eq, gt, lt |. + * @param top Number of records to return. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element includes a skiptoken parameter that specifies + * a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota request details as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String subscriptionId, + String providerId, + String location, + String filter, + Integer top, + String skiptoken, + Context context) { + return new PagedIterable<>(listAsync(subscriptionId, providerId, location, filter, top, skiptoken, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota request details along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota request details along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotaRequestStatusImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotaRequestStatusImpl.java new file mode 100644 index 0000000000000..e3f6c202a592d --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotaRequestStatusImpl.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.reservations.fluent.QuotaRequestStatusClient; +import com.azure.resourcemanager.reservations.fluent.models.QuotaRequestDetailsInner; +import com.azure.resourcemanager.reservations.models.QuotaRequestDetails; +import com.azure.resourcemanager.reservations.models.QuotaRequestStatus; + +public final class QuotaRequestStatusImpl implements QuotaRequestStatus { + private static final ClientLogger LOGGER = new ClientLogger(QuotaRequestStatusImpl.class); + + private final QuotaRequestStatusClient innerClient; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + public QuotaRequestStatusImpl( + QuotaRequestStatusClient innerClient, + com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String subscriptionId, String providerId, String location, String id, Context context) { + Response inner = + this.serviceClient().getWithResponse(subscriptionId, providerId, location, id, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new QuotaRequestDetailsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public QuotaRequestDetails get(String subscriptionId, String providerId, String location, String id) { + QuotaRequestDetailsInner inner = this.serviceClient().get(subscriptionId, providerId, location, id); + if (inner != null) { + return new QuotaRequestDetailsImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String subscriptionId, String providerId, String location) { + PagedIterable inner = this.serviceClient().list(subscriptionId, providerId, location); + return Utils.mapPage(inner, inner1 -> new QuotaRequestDetailsImpl(inner1, this.manager())); + } + + public PagedIterable list( + String subscriptionId, + String providerId, + String location, + String filter, + Integer top, + String skiptoken, + Context context) { + PagedIterable inner = + this.serviceClient().list(subscriptionId, providerId, location, filter, top, skiptoken, context); + return Utils.mapPage(inner, inner1 -> new QuotaRequestDetailsImpl(inner1, this.manager())); + } + + private QuotaRequestStatusClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotaRequestSubmitResponse201Impl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotaRequestSubmitResponse201Impl.java new file mode 100644 index 0000000000000..6f818a6e6dbb5 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotaRequestSubmitResponse201Impl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.resourcemanager.reservations.fluent.models.QuotaRequestSubmitResponse201Inner; +import com.azure.resourcemanager.reservations.models.QuotaRequestState; +import com.azure.resourcemanager.reservations.models.QuotaRequestSubmitResponse201; + +public final class QuotaRequestSubmitResponse201Impl implements QuotaRequestSubmitResponse201 { + private QuotaRequestSubmitResponse201Inner innerObject; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + QuotaRequestSubmitResponse201Impl( + QuotaRequestSubmitResponse201Inner innerObject, + com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public QuotaRequestState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String message() { + return this.innerModel().message(); + } + + public QuotaRequestSubmitResponse201Inner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotasClientImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotasClientImpl.java new file mode 100644 index 0000000000000..de8e268d541e7 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotasClientImpl.java @@ -0,0 +1,1337 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.reservations.fluent.QuotasClient; +import com.azure.resourcemanager.reservations.fluent.models.CurrentQuotaLimitBaseInner; +import com.azure.resourcemanager.reservations.models.QuotasGetResponse; +import com.azure.resourcemanager.reservations.models.QuotasListNextResponse; +import com.azure.resourcemanager.reservations.models.QuotasListResponse; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in QuotasClient. */ +public final class QuotasClientImpl implements QuotasClient { + /** The proxy service used to perform REST calls. */ + private final QuotasService service; + + /** The service client containing this operation class. */ + private final AzureReservationApiImpl client; + + /** + * Initializes an instance of QuotasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + QuotasClientImpl(AzureReservationApiImpl client) { + this.service = RestProxy.create(QuotasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureReservationApiQuotas to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureReservationApiQ") + public interface QuotasService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations" + + "/{location}/serviceLimits/{resourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("providerId") String providerId, + @PathParam("location") String location, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceName") String resourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations" + + "/{location}/serviceLimits/{resourceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("providerId") String providerId, + @PathParam("location") String location, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CurrentQuotaLimitBaseInner createQuotaRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations" + + "/{location}/serviceLimits/{resourceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("providerId") String providerId, + @PathParam("location") String location, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CurrentQuotaLimitBaseInner createQuotaRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations" + + "/{location}/serviceLimits") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("providerId") String providerId, + @PathParam("location") String location, + @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); + } + + /** + * Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to + * submit quota update request. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current quota (service limit) and usage of a resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync( + String subscriptionId, String providerId, String location, String resourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (providerId == null) { + return Mono.error(new IllegalArgumentException("Parameter providerId is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String apiVersion = "2020-10-25"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + subscriptionId, + providerId, + location, + apiVersion, + resourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to + * submit quota update request. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current quota (service limit) and usage of a resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getWithResponseAsync( + String subscriptionId, String providerId, String location, String resourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (providerId == null) { + return Mono.error(new IllegalArgumentException("Parameter providerId is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String apiVersion = "2020-10-25"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + subscriptionId, + providerId, + location, + apiVersion, + resourceName, + accept, + context); + } + + /** + * Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to + * submit quota update request. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current quota (service limit) and usage of a resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String subscriptionId, String providerId, String location, String resourceName) { + return getWithResponseAsync(subscriptionId, providerId, location, resourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to + * submit quota update request. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current quota (service limit) and usage of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public QuotasGetResponse getWithResponse( + String subscriptionId, String providerId, String location, String resourceName, Context context) { + return getWithResponseAsync(subscriptionId, providerId, location, resourceName, context).block(); + } + + /** + * Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to + * submit quota update request. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current quota (service limit) and usage of a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CurrentQuotaLimitBaseInner get( + String subscriptionId, String providerId, String location, String resourceName) { + return getWithResponse(subscriptionId, providerId, location, resourceName, Context.NONE).getValue(); + } + + /** + * Create or update the quota (service limits) of a resource to the requested value. Steps: 1. Make the Get request + * to get the quota information for specific resource. 2. To increase the quota, update the limit field in the + * response from Get request to new value. 3. Submit the JSON to the quota request API to update the quota. The + * Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Quota requests payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota properties along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (providerId == null) { + return Mono.error(new IllegalArgumentException("Parameter providerId is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (createQuotaRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter createQuotaRequest is required and cannot be null.")); + } else { + createQuotaRequest.validate(); + } + final String apiVersion = "2020-10-25"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + subscriptionId, + providerId, + location, + resourceName, + apiVersion, + createQuotaRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update the quota (service limits) of a resource to the requested value. Steps: 1. Make the Get request + * to get the quota information for specific resource. 2. To increase the quota, update the limit field in the + * response from Get request to new value. 3. Submit the JSON to the quota request API to update the quota. The + * Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Quota requests payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota properties along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (providerId == null) { + return Mono.error(new IllegalArgumentException("Parameter providerId is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (createQuotaRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter createQuotaRequest is required and cannot be null.")); + } else { + createQuotaRequest.validate(); + } + final String apiVersion = "2020-10-25"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + subscriptionId, + providerId, + location, + resourceName, + apiVersion, + createQuotaRequest, + accept, + context); + } + + /** + * Create or update the quota (service limits) of a resource to the requested value. Steps: 1. Make the Get request + * to get the quota information for specific resource. 2. To increase the quota, update the limit field in the + * response from Get request to new value. 3. Submit the JSON to the quota request API to update the quota. The + * Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Quota requests payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 quota properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CurrentQuotaLimitBaseInner> beginCreateOrUpdateAsync( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest) { + Mono>> mono = + createOrUpdateWithResponseAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CurrentQuotaLimitBaseInner.class, + CurrentQuotaLimitBaseInner.class, + this.client.getContext()); + } + + /** + * Create or update the quota (service limits) of a resource to the requested value. Steps: 1. Make the Get request + * to get the quota information for specific resource. 2. To increase the quota, update the limit field in the + * response from Get request to new value. 3. Submit the JSON to the quota request API to update the quota. The + * Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Quota requests payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 quota properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CurrentQuotaLimitBaseInner> beginCreateOrUpdateAsync( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + subscriptionId, providerId, location, resourceName, createQuotaRequest, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CurrentQuotaLimitBaseInner.class, + CurrentQuotaLimitBaseInner.class, + context); + } + + /** + * Create or update the quota (service limits) of a resource to the requested value. Steps: 1. Make the Get request + * to get the quota information for specific resource. 2. To increase the quota, update the limit field in the + * response from Get request to new value. 3. Submit the JSON to the quota request API to update the quota. The + * Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Quota requests payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 quota properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CurrentQuotaLimitBaseInner> beginCreateOrUpdate( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest) { + return this + .beginCreateOrUpdateAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest) + .getSyncPoller(); + } + + /** + * Create or update the quota (service limits) of a resource to the requested value. Steps: 1. Make the Get request + * to get the quota information for specific resource. 2. To increase the quota, update the limit field in the + * response from Get request to new value. 3. Submit the JSON to the quota request API to update the quota. The + * Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Quota requests payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 quota properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CurrentQuotaLimitBaseInner> beginCreateOrUpdate( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest, + Context context) { + return this + .beginCreateOrUpdateAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest, context) + .getSyncPoller(); + } + + /** + * Create or update the quota (service limits) of a resource to the requested value. Steps: 1. Make the Get request + * to get the quota information for specific resource. 2. To increase the quota, update the limit field in the + * response from Get request to new value. 3. Submit the JSON to the quota request API to update the quota. The + * Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Quota requests payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota properties on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest) { + return beginCreateOrUpdateAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update the quota (service limits) of a resource to the requested value. Steps: 1. Make the Get request + * to get the quota information for specific resource. 2. To increase the quota, update the limit field in the + * response from Get request to new value. 3. Submit the JSON to the quota request API to update the quota. The + * Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Quota requests payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota properties on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest, + Context context) { + return beginCreateOrUpdateAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update the quota (service limits) of a resource to the requested value. Steps: 1. Make the Get request + * to get the quota information for specific resource. 2. To increase the quota, update the limit field in the + * response from Get request to new value. 3. Submit the JSON to the quota request API to update the quota. The + * Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Quota requests payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CurrentQuotaLimitBaseInner createOrUpdate( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest) { + return createOrUpdateAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest).block(); + } + + /** + * Create or update the quota (service limits) of a resource to the requested value. Steps: 1. Make the Get request + * to get the quota information for specific resource. 2. To increase the quota, update the limit field in the + * response from Get request to new value. 3. Submit the JSON to the quota request API to update the quota. The + * Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Quota requests payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CurrentQuotaLimitBaseInner createOrUpdate( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest, + Context context) { + return createOrUpdateAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest, context) + .block(); + } + + /** + * Update the quota (service limits) of this resource to the requested value. • To get the quota information for + * specific resource, send a GET request. • To increase the quota, update the limit field from the GET response to a + * new value. • To update the quota value, submit the JSON response to the quota request API to update the quota. • + * To update the quota. use the PATCH operation. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Payload for the quota request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota properties along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (providerId == null) { + return Mono.error(new IllegalArgumentException("Parameter providerId is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (createQuotaRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter createQuotaRequest is required and cannot be null.")); + } else { + createQuotaRequest.validate(); + } + final String apiVersion = "2020-10-25"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + subscriptionId, + providerId, + location, + resourceName, + apiVersion, + createQuotaRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update the quota (service limits) of this resource to the requested value. • To get the quota information for + * specific resource, send a GET request. • To increase the quota, update the limit field from the GET response to a + * new value. • To update the quota value, submit the JSON response to the quota request API to update the quota. • + * To update the quota. use the PATCH operation. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Payload for the quota 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 quota properties along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (providerId == null) { + return Mono.error(new IllegalArgumentException("Parameter providerId is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (createQuotaRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter createQuotaRequest is required and cannot be null.")); + } else { + createQuotaRequest.validate(); + } + final String apiVersion = "2020-10-25"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + subscriptionId, + providerId, + location, + resourceName, + apiVersion, + createQuotaRequest, + accept, + context); + } + + /** + * Update the quota (service limits) of this resource to the requested value. • To get the quota information for + * specific resource, send a GET request. • To increase the quota, update the limit field from the GET response to a + * new value. • To update the quota value, submit the JSON response to the quota request API to update the quota. • + * To update the quota. use the PATCH operation. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Payload for the quota request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 quota properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CurrentQuotaLimitBaseInner> beginUpdateAsync( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest) { + Mono>> mono = + updateWithResponseAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CurrentQuotaLimitBaseInner.class, + CurrentQuotaLimitBaseInner.class, + this.client.getContext()); + } + + /** + * Update the quota (service limits) of this resource to the requested value. • To get the quota information for + * specific resource, send a GET request. • To increase the quota, update the limit field from the GET response to a + * new value. • To update the quota value, submit the JSON response to the quota request API to update the quota. • + * To update the quota. use the PATCH operation. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Payload for the quota 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 the {@link PollerFlux} for polling of quota properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CurrentQuotaLimitBaseInner> beginUpdateAsync( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + CurrentQuotaLimitBaseInner.class, + CurrentQuotaLimitBaseInner.class, + context); + } + + /** + * Update the quota (service limits) of this resource to the requested value. • To get the quota information for + * specific resource, send a GET request. • To increase the quota, update the limit field from the GET response to a + * new value. • To update the quota value, submit the JSON response to the quota request API to update the quota. • + * To update the quota. use the PATCH operation. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Payload for the quota request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 quota properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CurrentQuotaLimitBaseInner> beginUpdate( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest) { + return this + .beginUpdateAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest) + .getSyncPoller(); + } + + /** + * Update the quota (service limits) of this resource to the requested value. • To get the quota information for + * specific resource, send a GET request. • To increase the quota, update the limit field from the GET response to a + * new value. • To update the quota value, submit the JSON response to the quota request API to update the quota. • + * To update the quota. use the PATCH operation. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Payload for the quota 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 the {@link SyncPoller} for polling of quota properties. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CurrentQuotaLimitBaseInner> beginUpdate( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest, + Context context) { + return this + .beginUpdateAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest, context) + .getSyncPoller(); + } + + /** + * Update the quota (service limits) of this resource to the requested value. • To get the quota information for + * specific resource, send a GET request. • To increase the quota, update the limit field from the GET response to a + * new value. • To update the quota value, submit the JSON response to the quota request API to update the quota. • + * To update the quota. use the PATCH operation. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Payload for the quota request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota properties on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest) { + return beginUpdateAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update the quota (service limits) of this resource to the requested value. • To get the quota information for + * specific resource, send a GET request. • To increase the quota, update the limit field from the GET response to a + * new value. • To update the quota value, submit the JSON response to the quota request API to update the quota. • + * To update the quota. use the PATCH operation. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Payload for the quota 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 quota properties on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest, + Context context) { + return beginUpdateAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update the quota (service limits) of this resource to the requested value. • To get the quota information for + * specific resource, send a GET request. • To increase the quota, update the limit field from the GET response to a + * new value. • To update the quota value, submit the JSON response to the quota request API to update the quota. • + * To update the quota. use the PATCH operation. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Payload for the quota request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CurrentQuotaLimitBaseInner update( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest) { + return updateAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest).block(); + } + + /** + * Update the quota (service limits) of this resource to the requested value. • To get the quota information for + * specific resource, send a GET request. • To increase the quota, update the limit field from the GET response to a + * new value. • To update the quota value, submit the JSON response to the quota request API to update the quota. • + * To update the quota. use the PATCH operation. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param createQuotaRequest Payload for the quota 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 quota properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CurrentQuotaLimitBaseInner update( + String subscriptionId, + String providerId, + String location, + String resourceName, + CurrentQuotaLimitBaseInner createQuotaRequest, + Context context) { + return updateAsync(subscriptionId, providerId, location, resourceName, createQuotaRequest, context).block(); + } + + /** + * Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota + * operation can be leveraged to request quota updates. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of current quotas (service limits) and usage for all resources along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String subscriptionId, String providerId, String location) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (providerId == null) { + return Mono.error(new IllegalArgumentException("Parameter providerId is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String apiVersion = "2020-10-25"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + subscriptionId, + providerId, + location, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + res.getDeserializedHeaders())) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota + * operation can be leveraged to request quota updates. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of current quotas (service limits) and usage for all resources along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String subscriptionId, String providerId, String location, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (providerId == null) { + return Mono.error(new IllegalArgumentException("Parameter providerId is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String apiVersion = "2020-10-25"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), subscriptionId, providerId, location, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + res.getDeserializedHeaders())); + } + + /** + * Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota + * operation can be leveraged to request quota updates. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of current quotas (service limits) and usage for all resources as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String subscriptionId, String providerId, String location) { + return new PagedFlux<>( + () -> listSinglePageAsync(subscriptionId, providerId, location), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota + * operation can be leveraged to request quota updates. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of current quotas (service limits) and usage for all resources as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String subscriptionId, String providerId, String location, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(subscriptionId, providerId, location, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota + * operation can be leveraged to request quota updates. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of current quotas (service limits) and usage for all resources as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String subscriptionId, String providerId, String location) { + return new PagedIterable<>(listAsync(subscriptionId, providerId, location)); + } + + /** + * Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota + * operation can be leveraged to request quota updates. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of current quotas (service limits) and usage for all resources as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String subscriptionId, String providerId, String location, Context context) { + return new PagedIterable<>(listAsync(subscriptionId, providerId, location, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota limits along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + res.getDeserializedHeaders())) + .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 + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota limits along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + res.getDeserializedHeaders())); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotasImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotasImpl.java new file mode 100644 index 0000000000000..5172563762512 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotasImpl.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.reservations.fluent.QuotasClient; +import com.azure.resourcemanager.reservations.fluent.models.CurrentQuotaLimitBaseInner; +import com.azure.resourcemanager.reservations.models.CurrentQuotaLimitBase; +import com.azure.resourcemanager.reservations.models.Quotas; +import com.azure.resourcemanager.reservations.models.QuotasGetResponse; + +public final class QuotasImpl implements Quotas { + private static final ClientLogger LOGGER = new ClientLogger(QuotasImpl.class); + + private final QuotasClient innerClient; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + public QuotasImpl( + QuotasClient innerClient, com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String subscriptionId, String providerId, String location, String resourceName, Context context) { + QuotasGetResponse inner = + this.serviceClient().getWithResponse(subscriptionId, providerId, location, resourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CurrentQuotaLimitBaseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CurrentQuotaLimitBase get(String subscriptionId, String providerId, String location, String resourceName) { + CurrentQuotaLimitBaseInner inner = this.serviceClient().get(subscriptionId, providerId, location, resourceName); + if (inner != null) { + return new CurrentQuotaLimitBaseImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String subscriptionId, String providerId, String location) { + PagedIterable inner = + this.serviceClient().list(subscriptionId, providerId, location); + return Utils.mapPage(inner, inner1 -> new CurrentQuotaLimitBaseImpl(inner1, this.manager())); + } + + public PagedIterable list( + String subscriptionId, String providerId, String location, Context context) { + PagedIterable inner = + this.serviceClient().list(subscriptionId, providerId, location, context); + return Utils.mapPage(inner, inner1 -> new CurrentQuotaLimitBaseImpl(inner1, this.manager())); + } + + public CurrentQuotaLimitBase getById(String id) { + String subscriptionId = Utils.getValueFromIdByName(id, "subscriptions"); + if (subscriptionId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); + } + String providerId = Utils.getValueFromIdByName(id, "resourceProviders"); + if (providerId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'resourceProviders'.", id))); + } + String location = Utils.getValueFromIdByName(id, "locations"); + if (location == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "serviceLimits"); + if (resourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'serviceLimits'.", id))); + } + return this.getWithResponse(subscriptionId, providerId, location, resourceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String subscriptionId = Utils.getValueFromIdByName(id, "subscriptions"); + if (subscriptionId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'subscriptions'.", id))); + } + String providerId = Utils.getValueFromIdByName(id, "resourceProviders"); + if (providerId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'resourceProviders'.", id))); + } + String location = Utils.getValueFromIdByName(id, "locations"); + if (location == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'locations'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "serviceLimits"); + if (resourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'serviceLimits'.", id))); + } + return this.getWithResponse(subscriptionId, providerId, location, resourceName, context); + } + + private QuotasClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } + + public CurrentQuotaLimitBaseImpl define(String name) { + return new CurrentQuotaLimitBaseImpl(name, this.manager()); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/RefundResponseImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/RefundResponseImpl.java new file mode 100644 index 0000000000000..9d3da896f798e --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/RefundResponseImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.resourcemanager.reservations.fluent.models.RefundResponseInner; +import com.azure.resourcemanager.reservations.models.RefundResponse; +import com.azure.resourcemanager.reservations.models.RefundResponseProperties; + +public final class RefundResponseImpl implements RefundResponse { + private RefundResponseInner innerObject; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + RefundResponseImpl( + RefundResponseInner innerObject, com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public RefundResponseProperties properties() { + return this.innerModel().properties(); + } + + public RefundResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationOrderResponseImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationOrderResponseImpl.java new file mode 100644 index 0000000000000..d33f344a2567c --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationOrderResponseImpl.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.reservations.fluent.models.ReservationOrderResponseInner; +import com.azure.resourcemanager.reservations.fluent.models.ReservationResponseInner; +import com.azure.resourcemanager.reservations.models.ProvisioningState; +import com.azure.resourcemanager.reservations.models.ReservationBillingPlan; +import com.azure.resourcemanager.reservations.models.ReservationOrderBillingPlanInformation; +import com.azure.resourcemanager.reservations.models.ReservationOrderResponse; +import com.azure.resourcemanager.reservations.models.ReservationResponse; +import com.azure.resourcemanager.reservations.models.ReservationTerm; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class ReservationOrderResponseImpl implements ReservationOrderResponse { + private ReservationOrderResponseInner innerObject; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + ReservationOrderResponseImpl( + ReservationOrderResponseInner innerObject, + com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Integer etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public OffsetDateTime requestDateTime() { + return this.innerModel().requestDateTime(); + } + + public OffsetDateTime createdDateTime() { + return this.innerModel().createdDateTime(); + } + + public LocalDate expiryDate() { + return this.innerModel().expiryDate(); + } + + public OffsetDateTime expiryDateTime() { + return this.innerModel().expiryDateTime(); + } + + public OffsetDateTime benefitStartTime() { + return this.innerModel().benefitStartTime(); + } + + public Integer originalQuantity() { + return this.innerModel().originalQuantity(); + } + + public ReservationTerm term() { + return this.innerModel().term(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public ReservationBillingPlan billingPlan() { + return this.innerModel().billingPlan(); + } + + public ReservationOrderBillingPlanInformation planInformation() { + return this.innerModel().planInformation(); + } + + public List reservations() { + List inner = this.innerModel().reservations(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new ReservationResponseImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public OffsetDateTime reviewDateTime() { + return this.innerModel().reviewDateTime(); + } + + public ReservationOrderResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationOrdersClientImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationOrdersClientImpl.java new file mode 100644 index 0000000000000..49bec11ca8083 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationOrdersClientImpl.java @@ -0,0 +1,952 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.reservations.fluent.ReservationOrdersClient; +import com.azure.resourcemanager.reservations.fluent.models.CalculatePriceResponseInner; +import com.azure.resourcemanager.reservations.fluent.models.ChangeDirectoryResponseInner; +import com.azure.resourcemanager.reservations.fluent.models.ReservationOrderResponseInner; +import com.azure.resourcemanager.reservations.models.ChangeDirectoryRequest; +import com.azure.resourcemanager.reservations.models.PurchaseRequest; +import com.azure.resourcemanager.reservations.models.ReservationOrderList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ReservationOrdersClient. */ +public final class ReservationOrdersClientImpl implements ReservationOrdersClient { + /** The proxy service used to perform REST calls. */ + private final ReservationOrdersService service; + + /** The service client containing this operation class. */ + private final AzureReservationApiImpl client; + + /** + * Initializes an instance of ReservationOrdersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ReservationOrdersClientImpl(AzureReservationApiImpl client) { + this.service = + RestProxy.create(ReservationOrdersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureReservationApiReservationOrders to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureReservationApiR") + public interface ReservationOrdersService { + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.Capacity/calculatePrice") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> calculate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PurchaseRequest body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Capacity/reservationOrders") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> purchase( + @HostParam("$host") String endpoint, + @PathParam("reservationOrderId") String reservationOrderId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PurchaseRequest body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("reservationOrderId") String reservationOrderId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$expand") String expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/changeDirectory") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> changeDirectory( + @HostParam("$host") String endpoint, + @PathParam("reservationOrderId") String reservationOrderId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ChangeDirectoryRequest body, + @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); + } + + /** + * Calculate price for a `ReservationOrder`. + * + *

Calculate price for placing a `ReservationOrder`. + * + * @param body Information needed for calculate or purchase reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of calculate price for reservation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> calculateWithResponseAsync(PurchaseRequest body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.calculate(this.client.getEndpoint(), apiVersion, body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Calculate price for a `ReservationOrder`. + * + *

Calculate price for placing a `ReservationOrder`. + * + * @param body Information needed for calculate or purchase 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 response of calculate price for reservation along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> calculateWithResponseAsync( + PurchaseRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.calculate(this.client.getEndpoint(), apiVersion, body, accept, context); + } + + /** + * Calculate price for a `ReservationOrder`. + * + *

Calculate price for placing a `ReservationOrder`. + * + * @param body Information needed for calculate or purchase reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of calculate price for reservation on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono calculateAsync(PurchaseRequest body) { + return calculateWithResponseAsync(body).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Calculate price for a `ReservationOrder`. + * + *

Calculate price for placing a `ReservationOrder`. + * + * @param body Information needed for calculate or purchase 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 response of calculate price for reservation along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response calculateWithResponse(PurchaseRequest body, Context context) { + return calculateWithResponseAsync(body, context).block(); + } + + /** + * Calculate price for a `ReservationOrder`. + * + *

Calculate price for placing a `ReservationOrder`. + * + * @param body Information needed for calculate or purchase reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of calculate price for reservation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CalculatePriceResponseInner calculate(PurchaseRequest body) { + return calculateWithResponse(body, Context.NONE).getValue(); + } + + /** + * Get all `ReservationOrder`s. + * + *

List of all the `ReservationOrder`s that the user has access to in the current tenant. + * + * @throws 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 `ReservationOrder`s along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2022-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get all `ReservationOrder`s. + * + *

List of all the `ReservationOrder`s that the user has access to in the current 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 list of `ReservationOrder`s along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2022-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get all `ReservationOrder`s. + * + *

List of all the `ReservationOrder`s that the user has access to in the current tenant. + * + * @throws 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 `ReservationOrder`s as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get all `ReservationOrder`s. + * + *

List of all the `ReservationOrder`s that the user has access to in the current 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 list of `ReservationOrder`s as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get all `ReservationOrder`s. + * + *

List of all the `ReservationOrder`s that the user has access to in the current tenant. + * + * @throws 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 `ReservationOrder`s as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Get all `ReservationOrder`s. + * + *

List of all the `ReservationOrder`s that the user has access to in the current 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 list of `ReservationOrder`s as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Purchase `ReservationOrder` + * + *

Purchase `ReservationOrder` and create resource under the specified URI. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculate or purchase reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 a reservation order being returned along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> purchaseWithResponseAsync( + String reservationOrderId, PurchaseRequest body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.purchase(this.client.getEndpoint(), reservationOrderId, apiVersion, body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Purchase `ReservationOrder` + * + *

Purchase `ReservationOrder` and create resource under the specified URI. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculate or purchase 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 details of a reservation order being returned along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> purchaseWithResponseAsync( + String reservationOrderId, PurchaseRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.purchase(this.client.getEndpoint(), reservationOrderId, apiVersion, body, accept, context); + } + + /** + * Purchase `ReservationOrder` + * + *

Purchase `ReservationOrder` and create resource under the specified URI. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculate or purchase reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 details of a reservation order being returned. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ReservationOrderResponseInner> beginPurchaseAsync( + String reservationOrderId, PurchaseRequest body) { + Mono>> mono = purchaseWithResponseAsync(reservationOrderId, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ReservationOrderResponseInner.class, + ReservationOrderResponseInner.class, + this.client.getContext()); + } + + /** + * Purchase `ReservationOrder` + * + *

Purchase `ReservationOrder` and create resource under the specified URI. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculate or purchase 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 details of a reservation order being returned. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ReservationOrderResponseInner> beginPurchaseAsync( + String reservationOrderId, PurchaseRequest body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = purchaseWithResponseAsync(reservationOrderId, body, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ReservationOrderResponseInner.class, + ReservationOrderResponseInner.class, + context); + } + + /** + * Purchase `ReservationOrder` + * + *

Purchase `ReservationOrder` and create resource under the specified URI. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculate or purchase reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 details of a reservation order being returned. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ReservationOrderResponseInner> beginPurchase( + String reservationOrderId, PurchaseRequest body) { + return this.beginPurchaseAsync(reservationOrderId, body).getSyncPoller(); + } + + /** + * Purchase `ReservationOrder` + * + *

Purchase `ReservationOrder` and create resource under the specified URI. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculate or purchase 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 SyncPoller} for polling of details of a reservation order being returned. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ReservationOrderResponseInner> beginPurchase( + String reservationOrderId, PurchaseRequest body, Context context) { + return this.beginPurchaseAsync(reservationOrderId, body, context).getSyncPoller(); + } + + /** + * Purchase `ReservationOrder` + * + *

Purchase `ReservationOrder` and create resource under the specified URI. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculate or purchase reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 a reservation order being returned on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono purchaseAsync(String reservationOrderId, PurchaseRequest body) { + return beginPurchaseAsync(reservationOrderId, body).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Purchase `ReservationOrder` + * + *

Purchase `ReservationOrder` and create resource under the specified URI. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculate or purchase 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 details of a reservation order being returned on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono purchaseAsync( + String reservationOrderId, PurchaseRequest body, Context context) { + return beginPurchaseAsync(reservationOrderId, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Purchase `ReservationOrder` + * + *

Purchase `ReservationOrder` and create resource under the specified URI. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculate or purchase reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 a reservation order being returned. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ReservationOrderResponseInner purchase(String reservationOrderId, PurchaseRequest body) { + return purchaseAsync(reservationOrderId, body).block(); + } + + /** + * Purchase `ReservationOrder` + * + *

Purchase `ReservationOrder` and create resource under the specified URI. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculate or purchase 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 details of a reservation order being returned. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ReservationOrderResponseInner purchase(String reservationOrderId, PurchaseRequest body, Context context) { + return purchaseAsync(reservationOrderId, body, context).block(); + } + + /** + * Get a specific `ReservationOrder`. + * + *

Get the details of the `ReservationOrder`. + * + * @param reservationOrderId Order Id of the reservation. + * @param expand May be used to expand the planInformation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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` along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String reservationOrderId, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null.")); + } + final String apiVersion = "2022-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.get(this.client.getEndpoint(), reservationOrderId, apiVersion, expand, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a specific `ReservationOrder`. + * + *

Get the details of the `ReservationOrder`. + * + * @param reservationOrderId Order Id of the reservation. + * @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 the details of the `ReservationOrder` along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + 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 (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null.")); + } + final String apiVersion = "2022-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), reservationOrderId, apiVersion, expand, accept, context); + } + + /** + * Get a specific `ReservationOrder`. + * + *

Get the details of the `ReservationOrder`. + * + * @param reservationOrderId Order Id of the reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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` on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String reservationOrderId) { + final String expand = null; + return getWithResponseAsync(reservationOrderId, expand).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a specific `ReservationOrder`. + * + *

Get the details of the `ReservationOrder`. + * + * @param reservationOrderId Order Id of the reservation. + * @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 the details of the `ReservationOrder` along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String reservationOrderId, String expand, Context context) { + return getWithResponseAsync(reservationOrderId, expand, context).block(); + } + + /** + * Get a specific `ReservationOrder`. + * + *

Get the details of the `ReservationOrder`. + * + * @param reservationOrderId Order Id of the reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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`. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ReservationOrderResponseInner get(String reservationOrderId) { + final String expand = null; + return getWithResponse(reservationOrderId, expand, Context.NONE).getValue(); + } + + /** + * Change directory of `ReservationOrder`. + * + *

Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to change directory of reservation order. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return change directory response along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> changeDirectoryWithResponseAsync( + String reservationOrderId, ChangeDirectoryRequest body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .changeDirectory( + this.client.getEndpoint(), reservationOrderId, apiVersion, body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Change directory of `ReservationOrder`. + * + *

Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to change directory of reservation order. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return change directory response along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> changeDirectoryWithResponseAsync( + String reservationOrderId, ChangeDirectoryRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .changeDirectory(this.client.getEndpoint(), reservationOrderId, apiVersion, body, accept, context); + } + + /** + * Change directory of `ReservationOrder`. + * + *

Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to change directory of reservation order. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return change directory response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono changeDirectoryAsync( + String reservationOrderId, ChangeDirectoryRequest body) { + return changeDirectoryWithResponseAsync(reservationOrderId, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Change directory of `ReservationOrder`. + * + *

Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to change directory of reservation order. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return change directory response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response changeDirectoryWithResponse( + String reservationOrderId, ChangeDirectoryRequest body, Context context) { + return changeDirectoryWithResponseAsync(reservationOrderId, body, context).block(); + } + + /** + * Change directory of `ReservationOrder`. + * + *

Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to change directory of reservation order. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return change directory response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ChangeDirectoryResponseInner changeDirectory(String reservationOrderId, ChangeDirectoryRequest body) { + return changeDirectoryWithResponse(reservationOrderId, body, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of `ReservationOrder`s along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of `ReservationOrder`s along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationOrdersImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationOrdersImpl.java new file mode 100644 index 0000000000000..10f0cd64ad9ca --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationOrdersImpl.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.reservations.fluent.ReservationOrdersClient; +import com.azure.resourcemanager.reservations.fluent.models.CalculatePriceResponseInner; +import com.azure.resourcemanager.reservations.fluent.models.ChangeDirectoryResponseInner; +import com.azure.resourcemanager.reservations.fluent.models.ReservationOrderResponseInner; +import com.azure.resourcemanager.reservations.models.CalculatePriceResponse; +import com.azure.resourcemanager.reservations.models.ChangeDirectoryRequest; +import com.azure.resourcemanager.reservations.models.ChangeDirectoryResponse; +import com.azure.resourcemanager.reservations.models.PurchaseRequest; +import com.azure.resourcemanager.reservations.models.ReservationOrderResponse; +import com.azure.resourcemanager.reservations.models.ReservationOrders; + +public final class ReservationOrdersImpl implements ReservationOrders { + private static final ClientLogger LOGGER = new ClientLogger(ReservationOrdersImpl.class); + + private final ReservationOrdersClient innerClient; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + public ReservationOrdersImpl( + ReservationOrdersClient innerClient, + com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response calculateWithResponse(PurchaseRequest body, Context context) { + Response inner = this.serviceClient().calculateWithResponse(body, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CalculatePriceResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CalculatePriceResponse calculate(PurchaseRequest body) { + CalculatePriceResponseInner inner = this.serviceClient().calculate(body); + if (inner != null) { + return new CalculatePriceResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ReservationOrderResponseImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ReservationOrderResponseImpl(inner1, this.manager())); + } + + public ReservationOrderResponse purchase(String reservationOrderId, PurchaseRequest body) { + ReservationOrderResponseInner inner = this.serviceClient().purchase(reservationOrderId, body); + if (inner != null) { + return new ReservationOrderResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ReservationOrderResponse purchase(String reservationOrderId, PurchaseRequest body, Context context) { + ReservationOrderResponseInner inner = this.serviceClient().purchase(reservationOrderId, body, context); + if (inner != null) { + return new ReservationOrderResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String reservationOrderId, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(reservationOrderId, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ReservationOrderResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ReservationOrderResponse get(String reservationOrderId) { + ReservationOrderResponseInner inner = this.serviceClient().get(reservationOrderId); + if (inner != null) { + return new ReservationOrderResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response changeDirectoryWithResponse( + String reservationOrderId, ChangeDirectoryRequest body, Context context) { + Response inner = + this.serviceClient().changeDirectoryWithResponse(reservationOrderId, body, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ChangeDirectoryResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ChangeDirectoryResponse changeDirectory(String reservationOrderId, ChangeDirectoryRequest body) { + ChangeDirectoryResponseInner inner = this.serviceClient().changeDirectory(reservationOrderId, body); + if (inner != null) { + return new ChangeDirectoryResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private ReservationOrdersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationResponseImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationResponseImpl.java new file mode 100644 index 0000000000000..6aac2881069c4 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationResponseImpl.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.reservations.fluent.models.ReservationResponseInner; +import com.azure.resourcemanager.reservations.models.Kind; +import com.azure.resourcemanager.reservations.models.ReservationResponse; +import com.azure.resourcemanager.reservations.models.ReservationsProperties; +import com.azure.resourcemanager.reservations.models.SkuName; + +public final class ReservationResponseImpl implements ReservationResponse { + private ReservationResponseInner innerObject; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + ReservationResponseImpl( + ReservationResponseInner innerObject, + com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Integer etag() { + return this.innerModel().etag(); + } + + public SkuName sku() { + return this.innerModel().sku(); + } + + public ReservationsProperties properties() { + return this.innerModel().properties(); + } + + public Kind kind() { + return this.innerModel().kind(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ReservationResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationsClientImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationsClientImpl.java new file mode 100644 index 0000000000000..f0d2fb5b9f43d --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationsClientImpl.java @@ -0,0 +1,2478 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.reservations.fluent.ReservationsClient; +import com.azure.resourcemanager.reservations.fluent.models.AvailableScopePropertiesInner; +import com.azure.resourcemanager.reservations.fluent.models.ReservationResponseInner; +import com.azure.resourcemanager.reservations.models.AvailableScopeRequest; +import com.azure.resourcemanager.reservations.models.MergeRequest; +import com.azure.resourcemanager.reservations.models.PatchModel; +import com.azure.resourcemanager.reservations.models.ReservationList; +import com.azure.resourcemanager.reservations.models.ReservationsListResult; +import com.azure.resourcemanager.reservations.models.SplitRequest; +import com.fasterxml.jackson.core.type.TypeReference; +import java.nio.ByteBuffer; +import java.util.List; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ReservationsClient. */ +public final class ReservationsClientImpl implements ReservationsClient { + /** The proxy service used to perform REST calls. */ + private final ReservationsService service; + + /** The service client containing this operation class. */ + private final AzureReservationApiImpl client; + + /** + * Initializes an instance of ReservationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ReservationsClientImpl(AzureReservationApiImpl client) { + this.service = + RestProxy.create(ReservationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureReservationApiReservations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureReservationApiR") + public interface ReservationsService { + @Headers({"Content-Type: application/json"}) + @Post( + "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}" + + "/availableScopes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> availableScopes( + @HostParam("$host") String endpoint, + @PathParam("reservationOrderId") String reservationOrderId, + @PathParam("reservationId") String reservationId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AvailableScopeRequest body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/split") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> split( + @HostParam("$host") String endpoint, + @PathParam("reservationOrderId") String reservationOrderId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SplitRequest body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/merge") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> merge( + @HostParam("$host") String endpoint, + @PathParam("reservationOrderId") String reservationOrderId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") MergeRequest body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("reservationOrderId") String reservationOrderId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("reservationOrderId") String reservationOrderId, + @PathParam("reservationId") String reservationId, + @QueryParam("api-version") String apiVersion, + @QueryParam("$expand") String expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch("/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("reservationOrderId") String reservationOrderId, + @PathParam("reservationId") String reservationId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PatchModel parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/archive") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> archive( + @HostParam("$host") String endpoint, + @PathParam("reservationOrderId") String reservationOrderId, + @PathParam("reservationId") String reservationId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}" + + "/unarchive") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> unarchive( + @HostParam("$host") String endpoint, + @PathParam("reservationOrderId") String reservationOrderId, + @PathParam("reservationId") String reservationId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}" + + "/revisions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listRevisions( + @HostParam("$host") String endpoint, + @PathParam("reservationOrderId") String reservationOrderId, + @PathParam("reservationId") String reservationId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Capacity/reservations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAll( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @QueryParam("$orderby") String orderby, + @QueryParam("refreshSummary") String refreshSummary, + @QueryParam("$skiptoken") Float skiptoken, + @QueryParam("selectedState") String selectedState, + @QueryParam("take") Float take, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listRevisionsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAllNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get Available Scopes for `Reservation`. + * + *

Check whether the scopes from request is valid for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param body Scopes to be checked for eligibility. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of available scope api containing scopes and their eligibilities along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> availableScopesWithResponseAsync( + String reservationOrderId, String reservationId, AvailableScopeRequest body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String apiVersion = "2022-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .availableScopes( + this.client.getEndpoint(), + reservationOrderId, + reservationId, + apiVersion, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get Available Scopes for `Reservation`. + * + *

Check whether the scopes from request is valid for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param body Scopes to be checked for eligibility. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of available scope api containing scopes and their eligibilities along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> availableScopesWithResponseAsync( + String reservationOrderId, String reservationId, AvailableScopeRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String apiVersion = "2022-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .availableScopes( + this.client.getEndpoint(), reservationOrderId, reservationId, apiVersion, body, accept, context); + } + + /** + * Get Available Scopes for `Reservation`. + * + *

Check whether the scopes from request is valid for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param body Scopes to be checked for eligibility. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 response of available scope api containing scopes and their + * eligibilities. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AvailableScopePropertiesInner> + beginAvailableScopesAsync(String reservationOrderId, String reservationId, AvailableScopeRequest body) { + Mono>> mono = + availableScopesWithResponseAsync(reservationOrderId, reservationId, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + AvailableScopePropertiesInner.class, + AvailableScopePropertiesInner.class, + this.client.getContext()); + } + + /** + * Get Available Scopes for `Reservation`. + * + *

Check whether the scopes from request is valid for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param body Scopes to be checked for eligibility. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 response of available scope api containing scopes and their + * eligibilities. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AvailableScopePropertiesInner> + beginAvailableScopesAsync( + String reservationOrderId, String reservationId, AvailableScopeRequest body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + availableScopesWithResponseAsync(reservationOrderId, reservationId, body, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + AvailableScopePropertiesInner.class, + AvailableScopePropertiesInner.class, + context); + } + + /** + * Get Available Scopes for `Reservation`. + * + *

Check whether the scopes from request is valid for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param body Scopes to be checked for eligibility. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 response of available scope api containing scopes and their + * eligibilities. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AvailableScopePropertiesInner> beginAvailableScopes( + String reservationOrderId, String reservationId, AvailableScopeRequest body) { + return this.beginAvailableScopesAsync(reservationOrderId, reservationId, body).getSyncPoller(); + } + + /** + * Get Available Scopes for `Reservation`. + * + *

Check whether the scopes from request is valid for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param body Scopes to be checked for eligibility. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 response of available scope api containing scopes and their + * eligibilities. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AvailableScopePropertiesInner> beginAvailableScopes( + String reservationOrderId, String reservationId, AvailableScopeRequest body, Context context) { + return this.beginAvailableScopesAsync(reservationOrderId, reservationId, body, context).getSyncPoller(); + } + + /** + * Get Available Scopes for `Reservation`. + * + *

Check whether the scopes from request is valid for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param body Scopes to be checked for eligibility. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of available scope api containing scopes and their eligibilities on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono availableScopesAsync( + String reservationOrderId, String reservationId, AvailableScopeRequest body) { + return beginAvailableScopesAsync(reservationOrderId, reservationId, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Get Available Scopes for `Reservation`. + * + *

Check whether the scopes from request is valid for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param body Scopes to be checked for eligibility. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of available scope api containing scopes and their eligibilities on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono availableScopesAsync( + String reservationOrderId, String reservationId, AvailableScopeRequest body, Context context) { + return beginAvailableScopesAsync(reservationOrderId, reservationId, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Get Available Scopes for `Reservation`. + * + *

Check whether the scopes from request is valid for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param body Scopes to be checked for eligibility. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of available scope api containing scopes and their eligibilities. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AvailableScopePropertiesInner availableScopes( + String reservationOrderId, String reservationId, AvailableScopeRequest body) { + return availableScopesAsync(reservationOrderId, reservationId, body).block(); + } + + /** + * Get Available Scopes for `Reservation`. + * + *

Check whether the scopes from request is valid for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param body Scopes to be checked for eligibility. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of available scope api containing scopes and their eligibilities. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AvailableScopePropertiesInner availableScopes( + String reservationOrderId, String reservationId, AvailableScopeRequest body, Context context) { + return availableScopesAsync(reservationOrderId, reservationId, body, context).block(); + } + + /** + * Split the `Reservation`. + * + *

Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to Split a reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 ReservationResponse along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> splitWithResponseAsync(String reservationOrderId, SplitRequest body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.split(this.client.getEndpoint(), reservationOrderId, apiVersion, body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Split the `Reservation`. + * + *

Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to Split a reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 ReservationResponse along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> splitWithResponseAsync( + String reservationOrderId, SplitRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.split(this.client.getEndpoint(), reservationOrderId, apiVersion, body, accept, context); + } + + /** + * Split the `Reservation`. + * + *

Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to Split a reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 array of ReservationResponse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux>, List> beginSplitAsync( + String reservationOrderId, SplitRequest body) { + Mono>> mono = splitWithResponseAsync(reservationOrderId, body); + return this + .client + ., List>getLroResult( + mono, + this.client.getHttpPipeline(), + new TypeReference>() { + }.getType(), + new TypeReference>() { + }.getType(), + this.client.getContext()); + } + + /** + * Split the `Reservation`. + * + *

Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to Split a reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 array of ReservationResponse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux>, List> beginSplitAsync( + String reservationOrderId, SplitRequest body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = splitWithResponseAsync(reservationOrderId, body, context); + return this + .client + ., List>getLroResult( + mono, + this.client.getHttpPipeline(), + new TypeReference>() { + }.getType(), + new TypeReference>() { + }.getType(), + context); + } + + /** + * Split the `Reservation`. + * + *

Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to Split a reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 array of ReservationResponse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller>, List> beginSplit( + String reservationOrderId, SplitRequest body) { + return this.beginSplitAsync(reservationOrderId, body).getSyncPoller(); + } + + /** + * Split the `Reservation`. + * + *

Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to Split a reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 array of ReservationResponse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller>, List> beginSplit( + String reservationOrderId, SplitRequest body, Context context) { + return this.beginSplitAsync(reservationOrderId, body, context).getSyncPoller(); + } + + /** + * Split the `Reservation`. + * + *

Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to Split a reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 ReservationResponse on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> splitAsync(String reservationOrderId, SplitRequest body) { + return beginSplitAsync(reservationOrderId, body).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Split the `Reservation`. + * + *

Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to Split a reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 ReservationResponse on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> splitAsync( + String reservationOrderId, SplitRequest body, Context context) { + return beginSplitAsync(reservationOrderId, body, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Split the `Reservation`. + * + *

Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to Split a reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 ReservationResponse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List split(String reservationOrderId, SplitRequest body) { + return splitAsync(reservationOrderId, body).block(); + } + + /** + * Split the `Reservation`. + * + *

Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to Split a reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 ReservationResponse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List split(String reservationOrderId, SplitRequest body, Context context) { + return splitAsync(reservationOrderId, body, context).block(); + } + + /** + * Merges two `Reservation`s. + * + *

Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have + * same properties. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for commercial request for a reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 ReservationResponse along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> mergeWithResponseAsync(String reservationOrderId, MergeRequest body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.merge(this.client.getEndpoint(), reservationOrderId, apiVersion, body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Merges two `Reservation`s. + * + *

Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have + * same properties. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for commercial request for 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 array of ReservationResponse along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> mergeWithResponseAsync( + String reservationOrderId, MergeRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.merge(this.client.getEndpoint(), reservationOrderId, apiVersion, body, accept, context); + } + + /** + * Merges two `Reservation`s. + * + *

Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have + * same properties. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for commercial request for a reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 array of ReservationResponse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux>, List> beginMergeAsync( + String reservationOrderId, MergeRequest body) { + Mono>> mono = mergeWithResponseAsync(reservationOrderId, body); + return this + .client + ., List>getLroResult( + mono, + this.client.getHttpPipeline(), + new TypeReference>() { + }.getType(), + new TypeReference>() { + }.getType(), + this.client.getContext()); + } + + /** + * Merges two `Reservation`s. + * + *

Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have + * same properties. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for commercial request for 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 array of ReservationResponse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux>, List> beginMergeAsync( + String reservationOrderId, MergeRequest body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = mergeWithResponseAsync(reservationOrderId, body, context); + return this + .client + ., List>getLroResult( + mono, + this.client.getHttpPipeline(), + new TypeReference>() { + }.getType(), + new TypeReference>() { + }.getType(), + context); + } + + /** + * Merges two `Reservation`s. + * + *

Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have + * same properties. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for commercial request for a reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 array of ReservationResponse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller>, List> beginMerge( + String reservationOrderId, MergeRequest body) { + return this.beginMergeAsync(reservationOrderId, body).getSyncPoller(); + } + + /** + * Merges two `Reservation`s. + * + *

Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have + * same properties. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for commercial request for 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 SyncPoller} for polling of array of ReservationResponse. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller>, List> beginMerge( + String reservationOrderId, MergeRequest body, Context context) { + return this.beginMergeAsync(reservationOrderId, body, context).getSyncPoller(); + } + + /** + * Merges two `Reservation`s. + * + *

Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have + * same properties. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for commercial request for a reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 ReservationResponse on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> mergeAsync(String reservationOrderId, MergeRequest body) { + return beginMergeAsync(reservationOrderId, body).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Merges two `Reservation`s. + * + *

Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have + * same properties. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for commercial request for 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 array of ReservationResponse on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> mergeAsync( + String reservationOrderId, MergeRequest body, Context context) { + return beginMergeAsync(reservationOrderId, body, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Merges two `Reservation`s. + * + *

Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have + * same properties. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for commercial request for a reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 ReservationResponse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List merge(String reservationOrderId, MergeRequest body) { + return mergeAsync(reservationOrderId, body).block(); + } + + /** + * Merges two `Reservation`s. + * + *

Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have + * same properties. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for commercial request for 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 array of ReservationResponse. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List merge(String reservationOrderId, MergeRequest body, Context context) { + return mergeAsync(reservationOrderId, body, context).block(); + } + + /** + * Get `Reservation`s in a given reservation Order + * + *

List `Reservation`s within a single `ReservationOrder`. + * + * @param reservationOrderId Order Id of the reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 `Reservation`s along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String reservationOrderId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null.")); + } + final String apiVersion = "2022-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), reservationOrderId, apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get `Reservation`s in a given reservation Order + * + *

List `Reservation`s within a single `ReservationOrder`. + * + * @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 `Reservation`s along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + 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 (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId is required and cannot be null.")); + } + final String apiVersion = "2022-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), reservationOrderId, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get `Reservation`s in a given reservation Order + * + *

List `Reservation`s within a single `ReservationOrder`. + * + * @param reservationOrderId Order Id of the reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 `Reservation`s as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String reservationOrderId) { + return new PagedFlux<>( + () -> listSinglePageAsync(reservationOrderId), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get `Reservation`s in a given reservation Order + * + *

List `Reservation`s within a single `ReservationOrder`. + * + * @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 `Reservation`s as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String reservationOrderId, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(reservationOrderId, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get `Reservation`s in a given reservation Order + * + *

List `Reservation`s within a single `ReservationOrder`. + * + * @param reservationOrderId Order Id of the reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 `Reservation`s as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String reservationOrderId) { + return new PagedIterable<>(listAsync(reservationOrderId)); + } + + /** + * Get `Reservation`s in a given reservation Order + * + *

List `Reservation`s within a single `ReservationOrder`. + * + * @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 `Reservation`s as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String reservationOrderId, Context context) { + return new PagedIterable<>(listAsync(reservationOrderId, context)); + } + + /** + * Get `Reservation` details. + * + *

Get specific `Reservation` details. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param expand Supported value of this query is renewProperties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String reservationOrderId, String reservationId, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + reservationOrderId, + reservationId, + apiVersion, + expand, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get `Reservation` details. + * + *

Get specific `Reservation` details. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param expand Supported value of this query is renewProperties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + 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 (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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get(this.client.getEndpoint(), reservationOrderId, reservationId, apiVersion, expand, accept, context); + } + + /** + * Get `Reservation` details. + * + *

Get specific `Reservation` details. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String reservationOrderId, String reservationId) { + final String expand = null; + return getWithResponseAsync(reservationOrderId, reservationId, expand) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get `Reservation` details. + * + *

Get specific `Reservation` details. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param expand Supported value of this query is renewProperties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String reservationOrderId, String reservationId, String expand, Context context) { + return getWithResponseAsync(reservationOrderId, reservationId, expand, context).block(); + } + + /** + * Get `Reservation` details. + * + *

Get specific `Reservation` details. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ReservationResponseInner get(String reservationOrderId, String reservationId) { + final String expand = null; + return getWithResponse(reservationOrderId, reservationId, expand, Context.NONE).getValue(); + } + + /** + * Updates a `Reservation`. + * + *

Updates the applied scopes of the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param parameters Information needed to patch a reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String reservationOrderId, String reservationId, PatchModel parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + reservationOrderId, + reservationId, + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a `Reservation`. + * + *

Updates the applied scopes of the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param parameters Information needed to patch a reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String reservationOrderId, String reservationId, PatchModel parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), reservationOrderId, reservationId, apiVersion, parameters, accept, context); + } + + /** + * Updates a `Reservation`. + * + *

Updates the applied scopes of the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param parameters Information needed to patch a reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ReservationResponseInner> beginUpdateAsync( + String reservationOrderId, String reservationId, PatchModel parameters) { + Mono>> mono = updateWithResponseAsync(reservationOrderId, reservationId, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ReservationResponseInner.class, + ReservationResponseInner.class, + this.client.getContext()); + } + + /** + * Updates a `Reservation`. + * + *

Updates the applied scopes of the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param parameters Information needed to patch a reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ReservationResponseInner> beginUpdateAsync( + String reservationOrderId, String reservationId, PatchModel parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(reservationOrderId, reservationId, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ReservationResponseInner.class, + ReservationResponseInner.class, + context); + } + + /** + * Updates a `Reservation`. + * + *

Updates the applied scopes of the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param parameters Information needed to patch a reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 definition of the reservation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ReservationResponseInner> beginUpdate( + String reservationOrderId, String reservationId, PatchModel parameters) { + return this.beginUpdateAsync(reservationOrderId, reservationId, parameters).getSyncPoller(); + } + + /** + * Updates a `Reservation`. + * + *

Updates the applied scopes of the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param parameters Information needed to patch a reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 definition of the reservation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ReservationResponseInner> beginUpdate( + String reservationOrderId, String reservationId, PatchModel parameters, Context context) { + return this.beginUpdateAsync(reservationOrderId, reservationId, parameters, context).getSyncPoller(); + } + + /** + * Updates a `Reservation`. + * + *

Updates the applied scopes of the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param parameters Information needed to patch a reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 updateAsync( + String reservationOrderId, String reservationId, PatchModel parameters) { + return beginUpdateAsync(reservationOrderId, reservationId, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a `Reservation`. + * + *

Updates the applied scopes of the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param parameters Information needed to patch a reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 updateAsync( + String reservationOrderId, String reservationId, PatchModel parameters, Context context) { + return beginUpdateAsync(reservationOrderId, reservationId, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a `Reservation`. + * + *

Updates the applied scopes of the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param parameters Information needed to patch a reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ReservationResponseInner update(String reservationOrderId, String reservationId, PatchModel parameters) { + return updateAsync(reservationOrderId, reservationId, parameters).block(); + } + + /** + * Updates a `Reservation`. + * + *

Updates the applied scopes of the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param parameters Information needed to patch a reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ReservationResponseInner update( + String reservationOrderId, String reservationId, PatchModel parameters, Context context) { + return updateAsync(reservationOrderId, reservationId, parameters, context).block(); + } + + /** + * Archive a `Reservation`. + * + *

Archiving a `Reservation` moves it to `Archived` state. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> archiveWithResponseAsync(String reservationOrderId, String reservationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .archive( + this.client.getEndpoint(), reservationOrderId, reservationId, apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Archive a `Reservation`. + * + *

Archiving a `Reservation` moves it to `Archived` state. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> archiveWithResponseAsync( + String reservationOrderId, String reservationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .archive(this.client.getEndpoint(), reservationOrderId, reservationId, apiVersion, accept, context); + } + + /** + * Archive a `Reservation`. + * + *

Archiving a `Reservation` moves it to `Archived` state. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 archiveAsync(String reservationOrderId, String reservationId) { + return archiveWithResponseAsync(reservationOrderId, reservationId).flatMap(ignored -> Mono.empty()); + } + + /** + * Archive a `Reservation`. + * + *

Archiving a `Reservation` moves it to `Archived` state. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response archiveWithResponse(String reservationOrderId, String reservationId, Context context) { + return archiveWithResponseAsync(reservationOrderId, reservationId, context).block(); + } + + /** + * Archive a `Reservation`. + * + *

Archiving a `Reservation` moves it to `Archived` state. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void archive(String reservationOrderId, String reservationId) { + archiveWithResponse(reservationOrderId, reservationId, Context.NONE); + } + + /** + * Unarchive a `Reservation`. + * + *

Restores a `Reservation` to the state it was before archiving. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> unarchiveWithResponseAsync(String reservationOrderId, String reservationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .unarchive( + this.client.getEndpoint(), reservationOrderId, reservationId, apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Unarchive a `Reservation`. + * + *

Restores a `Reservation` to the state it was before archiving. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> unarchiveWithResponseAsync( + String reservationOrderId, String reservationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .unarchive(this.client.getEndpoint(), reservationOrderId, reservationId, apiVersion, accept, context); + } + + /** + * Unarchive a `Reservation`. + * + *

Restores a `Reservation` to the state it was before archiving. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 unarchiveAsync(String reservationOrderId, String reservationId) { + return unarchiveWithResponseAsync(reservationOrderId, reservationId).flatMap(ignored -> Mono.empty()); + } + + /** + * Unarchive a `Reservation`. + * + *

Restores a `Reservation` to the state it was before archiving. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response unarchiveWithResponse(String reservationOrderId, String reservationId, Context context) { + return unarchiveWithResponseAsync(reservationOrderId, reservationId, context).block(); + } + + /** + * Unarchive a `Reservation`. + * + *

Restores a `Reservation` to the state it was before archiving. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void unarchive(String reservationOrderId, String reservationId) { + unarchiveWithResponse(reservationOrderId, reservationId, Context.NONE); + } + + /** + * Get `Reservation` revisions. + * + *

List of all the revisions for the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 `Reservation`s along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRevisionsSinglePageAsync( + String reservationOrderId, String reservationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listRevisions( + this.client.getEndpoint(), reservationOrderId, reservationId, apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get `Reservation` revisions. + * + *

List of all the revisions for the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 `Reservation`s along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRevisionsSinglePageAsync( + String reservationOrderId, String reservationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listRevisions(this.client.getEndpoint(), reservationOrderId, reservationId, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get `Reservation` revisions. + * + *

List of all the revisions for the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 `Reservation`s as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRevisionsAsync(String reservationOrderId, String reservationId) { + return new PagedFlux<>( + () -> listRevisionsSinglePageAsync(reservationOrderId, reservationId), + nextLink -> listRevisionsNextSinglePageAsync(nextLink)); + } + + /** + * Get `Reservation` revisions. + * + *

List of all the revisions for the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 `Reservation`s as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRevisionsAsync( + String reservationOrderId, String reservationId, Context context) { + return new PagedFlux<>( + () -> listRevisionsSinglePageAsync(reservationOrderId, reservationId, context), + nextLink -> listRevisionsNextSinglePageAsync(nextLink, context)); + } + + /** + * Get `Reservation` revisions. + * + *

List of all the revisions for the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 `Reservation`s as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listRevisions(String reservationOrderId, String reservationId) { + return new PagedIterable<>(listRevisionsAsync(reservationOrderId, reservationId)); + } + + /** + * Get `Reservation` revisions. + * + *

List of all the revisions for the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 `Reservation`s as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listRevisions( + String reservationOrderId, String reservationId, Context context) { + return new PagedIterable<>(listRevisionsAsync(reservationOrderId, reservationId, context)); + } + + /** + * List the reservations and the roll up counts of reservations group by provisioning states that the user has + * access to in the current tenant. + * + * @param filter May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does + * not currently support 'ne', 'gt', 'le', 'ge', or 'not'. Reservation properties include sku/name, + * properties/{appliedScopeType, archived, displayName, displayProvisioningState, effectiveDateTime, expiryDate, + * expiryDateTime, provisioningState, quantity, renew, reservedResourceType, term, userFriendlyAppliedScopeType, + * userFriendlyRenewState}. + * @param orderby May be used to sort order by reservation properties. + * @param refreshSummary To indicate whether to refresh the roll up counts of the reservations group by provisioning + * states. + * @param skiptoken The number of reservations to skip from the list before returning results. + * @param selectedState The selected provisioning state. + * @param take To number of reservations to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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> listAllSinglePageAsync( + String filter, String orderby, String refreshSummary, Float skiptoken, String selectedState, Float take) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2022-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listAll( + this.client.getEndpoint(), + apiVersion, + filter, + orderby, + refreshSummary, + skiptoken, + selectedState, + take, + 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())); + } + + /** + * List the reservations and the roll up counts of reservations group by provisioning states that the user has + * access to in the current tenant. + * + * @param filter May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does + * not currently support 'ne', 'gt', 'le', 'ge', or 'not'. Reservation properties include sku/name, + * properties/{appliedScopeType, archived, displayName, displayProvisioningState, effectiveDateTime, expiryDate, + * expiryDateTime, provisioningState, quantity, renew, reservedResourceType, term, userFriendlyAppliedScopeType, + * userFriendlyRenewState}. + * @param orderby May be used to sort order by reservation properties. + * @param refreshSummary To indicate whether to refresh the roll up counts of the reservations group by provisioning + * states. + * @param skiptoken The number of reservations to skip from the list before returning results. + * @param selectedState The selected provisioning state. + * @param take To number of reservations to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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> listAllSinglePageAsync( + String filter, + String orderby, + String refreshSummary, + Float skiptoken, + 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.")); + } + final String apiVersion = "2022-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAll( + this.client.getEndpoint(), + apiVersion, + filter, + orderby, + refreshSummary, + skiptoken, + selectedState, + take, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the reservations and the roll up counts of reservations group by provisioning states that the user has + * access to in the current tenant. + * + * @param filter May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does + * not currently support 'ne', 'gt', 'le', 'ge', or 'not'. Reservation properties include sku/name, + * properties/{appliedScopeType, archived, displayName, displayProvisioningState, effectiveDateTime, expiryDate, + * expiryDateTime, provisioningState, quantity, renew, reservedResourceType, term, userFriendlyAppliedScopeType, + * userFriendlyRenewState}. + * @param orderby May be used to sort order by reservation properties. + * @param refreshSummary To indicate whether to refresh the roll up counts of the reservations group by provisioning + * states. + * @param skiptoken The number of reservations to skip from the list before returning results. + * @param selectedState The selected provisioning state. + * @param take To number of reservations to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAllAsync( + String filter, String orderby, String refreshSummary, Float skiptoken, String selectedState, Float take) { + return new PagedFlux<>( + () -> listAllSinglePageAsync(filter, orderby, refreshSummary, skiptoken, selectedState, take), + nextLink -> listAllNextSinglePageAsync(nextLink)); + } + + /** + * List the reservations and the roll up counts of reservations group by provisioning states that the user has + * access to in the current tenant. + * + * @throws ManagementException thrown if 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}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAllAsync() { + final String filter = null; + final String orderby = null; + final String refreshSummary = null; + final Float skiptoken = null; + final String selectedState = null; + final Float take = null; + return new PagedFlux<>( + () -> listAllSinglePageAsync(filter, orderby, refreshSummary, skiptoken, selectedState, take), + nextLink -> listAllNextSinglePageAsync(nextLink)); + } + + /** + * List the reservations and the roll up counts of reservations group by provisioning states that the user has + * access to in the current tenant. + * + * @param filter May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does + * not currently support 'ne', 'gt', 'le', 'ge', or 'not'. Reservation properties include sku/name, + * properties/{appliedScopeType, archived, displayName, displayProvisioningState, effectiveDateTime, expiryDate, + * expiryDateTime, provisioningState, quantity, renew, reservedResourceType, term, userFriendlyAppliedScopeType, + * userFriendlyRenewState}. + * @param orderby May be used to sort order by reservation properties. + * @param refreshSummary To indicate whether to refresh the roll up counts of the reservations group by provisioning + * states. + * @param skiptoken The number of reservations to skip from the list before returning results. + * @param selectedState The selected provisioning state. + * @param take To number of reservations to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAllAsync( + String filter, + String orderby, + String refreshSummary, + Float skiptoken, + String selectedState, + Float take, + Context context) { + return new PagedFlux<>( + () -> listAllSinglePageAsync(filter, orderby, refreshSummary, skiptoken, selectedState, take, context), + nextLink -> listAllNextSinglePageAsync(nextLink, context)); + } + + /** + * List the reservations and the roll up counts of reservations group by provisioning states that the user has + * access to in the current tenant. + * + * @throws ManagementException thrown if 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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAll() { + final String filter = null; + final String orderby = null; + final String refreshSummary = null; + final Float skiptoken = null; + final String selectedState = null; + final Float take = null; + return new PagedIterable<>(listAllAsync(filter, orderby, refreshSummary, skiptoken, selectedState, take)); + } + + /** + * List the reservations and the roll up counts of reservations group by provisioning states that the user has + * access to in the current tenant. + * + * @param filter May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does + * not currently support 'ne', 'gt', 'le', 'ge', or 'not'. Reservation properties include sku/name, + * properties/{appliedScopeType, archived, displayName, displayProvisioningState, effectiveDateTime, expiryDate, + * expiryDateTime, provisioningState, quantity, renew, reservedResourceType, term, userFriendlyAppliedScopeType, + * userFriendlyRenewState}. + * @param orderby May be used to sort order by reservation properties. + * @param refreshSummary To indicate whether to refresh the roll up counts of the reservations group by provisioning + * states. + * @param skiptoken The number of reservations to skip from the list before returning results. + * @param selectedState The selected provisioning state. + * @param take To number of reservations to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if 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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAll( + String filter, + String orderby, + String refreshSummary, + Float skiptoken, + String selectedState, + Float take, + Context context) { + return new PagedIterable<>( + listAllAsync(filter, orderby, refreshSummary, skiptoken, selectedState, take, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of `Reservation`s along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of `Reservation`s along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of `Reservation`s along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRevisionsNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listRevisionsNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of `Reservation`s along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRevisionsNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listRevisionsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listAllNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAllNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationsImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationsImpl.java new file mode 100644 index 0000000000000..a2cded559f62d --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationsImpl.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.reservations.fluent.ReservationsClient; +import com.azure.resourcemanager.reservations.fluent.models.AvailableScopePropertiesInner; +import com.azure.resourcemanager.reservations.fluent.models.ReservationResponseInner; +import com.azure.resourcemanager.reservations.models.AvailableScopeProperties; +import com.azure.resourcemanager.reservations.models.AvailableScopeRequest; +import com.azure.resourcemanager.reservations.models.MergeRequest; +import com.azure.resourcemanager.reservations.models.PatchModel; +import com.azure.resourcemanager.reservations.models.ReservationResponse; +import com.azure.resourcemanager.reservations.models.Reservations; +import com.azure.resourcemanager.reservations.models.SplitRequest; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class ReservationsImpl implements Reservations { + private static final ClientLogger LOGGER = new ClientLogger(ReservationsImpl.class); + + private final ReservationsClient innerClient; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + public ReservationsImpl( + ReservationsClient innerClient, com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public AvailableScopeProperties availableScopes( + String reservationOrderId, String reservationId, AvailableScopeRequest body) { + AvailableScopePropertiesInner inner = + this.serviceClient().availableScopes(reservationOrderId, reservationId, body); + if (inner != null) { + return new AvailableScopePropertiesImpl(inner, this.manager()); + } else { + return null; + } + } + + public AvailableScopeProperties availableScopes( + String reservationOrderId, String reservationId, AvailableScopeRequest body, Context context) { + AvailableScopePropertiesInner inner = + this.serviceClient().availableScopes(reservationOrderId, reservationId, body, context); + if (inner != null) { + return new AvailableScopePropertiesImpl(inner, this.manager()); + } else { + return null; + } + } + + public List split(String reservationOrderId, SplitRequest body) { + List inner = this.serviceClient().split(reservationOrderId, body); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new ReservationResponseImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public List split(String reservationOrderId, SplitRequest body, Context context) { + List inner = this.serviceClient().split(reservationOrderId, body, context); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new ReservationResponseImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public List merge(String reservationOrderId, MergeRequest body) { + List inner = this.serviceClient().merge(reservationOrderId, body); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new ReservationResponseImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public List merge(String reservationOrderId, MergeRequest body, Context context) { + List inner = this.serviceClient().merge(reservationOrderId, body, context); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new ReservationResponseImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public PagedIterable list(String reservationOrderId) { + PagedIterable inner = this.serviceClient().list(reservationOrderId); + return Utils.mapPage(inner, inner1 -> new ReservationResponseImpl(inner1, this.manager())); + } + + public PagedIterable list(String reservationOrderId, Context context) { + PagedIterable inner = this.serviceClient().list(reservationOrderId, context); + return Utils.mapPage(inner, inner1 -> new ReservationResponseImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String reservationOrderId, String reservationId, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(reservationOrderId, reservationId, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ReservationResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ReservationResponse get(String reservationOrderId, String reservationId) { + ReservationResponseInner inner = this.serviceClient().get(reservationOrderId, reservationId); + if (inner != null) { + return new ReservationResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ReservationResponse update(String reservationOrderId, String reservationId, PatchModel parameters) { + ReservationResponseInner inner = this.serviceClient().update(reservationOrderId, reservationId, parameters); + if (inner != null) { + return new ReservationResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ReservationResponse update( + String reservationOrderId, String reservationId, PatchModel parameters, Context context) { + ReservationResponseInner inner = + this.serviceClient().update(reservationOrderId, reservationId, parameters, context); + if (inner != null) { + return new ReservationResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response archiveWithResponse(String reservationOrderId, String reservationId, Context context) { + return this.serviceClient().archiveWithResponse(reservationOrderId, reservationId, context); + } + + public void archive(String reservationOrderId, String reservationId) { + this.serviceClient().archive(reservationOrderId, reservationId); + } + + public Response unarchiveWithResponse(String reservationOrderId, String reservationId, Context context) { + return this.serviceClient().unarchiveWithResponse(reservationOrderId, reservationId, context); + } + + public void unarchive(String reservationOrderId, String reservationId) { + this.serviceClient().unarchive(reservationOrderId, reservationId); + } + + public PagedIterable listRevisions(String reservationOrderId, String reservationId) { + PagedIterable inner = + this.serviceClient().listRevisions(reservationOrderId, reservationId); + return Utils.mapPage(inner, inner1 -> new ReservationResponseImpl(inner1, this.manager())); + } + + public PagedIterable listRevisions( + String reservationOrderId, String reservationId, Context context) { + PagedIterable inner = + this.serviceClient().listRevisions(reservationOrderId, reservationId, context); + return Utils.mapPage(inner, inner1 -> new ReservationResponseImpl(inner1, this.manager())); + } + + public PagedIterable listAll() { + PagedIterable inner = this.serviceClient().listAll(); + return Utils.mapPage(inner, inner1 -> new ReservationResponseImpl(inner1, this.manager())); + } + + public PagedIterable listAll( + String filter, + String orderby, + String refreshSummary, + Float skiptoken, + String selectedState, + Float take, + Context context) { + PagedIterable inner = + this.serviceClient().listAll(filter, orderby, refreshSummary, skiptoken, selectedState, take, context); + return Utils.mapPage(inner, inner1 -> new ReservationResponseImpl(inner1, this.manager())); + } + + private ReservationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ResourceProvidersClientImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 0000000000000..99bdd100d4e0f --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,624 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.reservations.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.reservations.fluent.models.AppliedReservationsInner; +import com.azure.resourcemanager.reservations.fluent.models.CatalogInner; +import com.azure.resourcemanager.reservations.models.CatalogsResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + /** The proxy service used to perform REST calls. */ + private final ResourceProvidersService service; + + /** The service client containing this operation class. */ + private final AzureReservationApiImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(AzureReservationApiImpl client) { + this.service = + RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureReservationApiResourceProviders to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureReservationApiR") + public interface ResourceProvidersService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("reservedResourceType") String reservedResourceType, + @QueryParam("location") String location, + @QueryParam("publisherId") String publisherId, + @QueryParam("offerId") String offerId, + @QueryParam("planId") String planId, + @QueryParam("$filter") String filter, + @QueryParam("$skip") Float skip, + @QueryParam("$take") Float take, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/appliedReservations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getAppliedReservationList( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getCatalogNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get the regions and skus that are available for RI purchase for the specified Azure subscription. + * + * @param subscriptionId Id of the subscription. + * @param reservedResourceType The type of the resource for which the skus should be provided. + * @param location Filters the skus based on the location specified in this parameter. This can be an Azure region + * or global. + * @param publisherId Publisher id used to get the third party products. + * @param offerId Offer id used to get the third party products. + * @param planId Plan id used to get the third party products. + * @param filter May be used to filter by Catalog properties. The filter supports 'eq', 'or', and 'and'. + * @param skip The number of reservations to skip from the list before returning results. + * @param take To number of reservations to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the regions and skus that are available for RI purchase for the specified Azure subscription along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String subscriptionId, + String reservedResourceType, + String location, + String publisherId, + String offerId, + String planId, + String filter, + Float skip, + Float take) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String apiVersion = "2022-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + subscriptionId, + reservedResourceType, + location, + publisherId, + offerId, + planId, + filter, + skip, + take, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the regions and skus that are available for RI purchase for the specified Azure subscription. + * + * @param subscriptionId Id of the subscription. + * @param reservedResourceType The type of the resource for which the skus should be provided. + * @param location Filters the skus based on the location specified in this parameter. This can be an Azure region + * or global. + * @param publisherId Publisher id used to get the third party products. + * @param offerId Offer id used to get the third party products. + * @param planId Plan id used to get the third party products. + * @param filter May be used to filter by Catalog properties. The filter supports 'eq', 'or', and 'and'. + * @param skip The number of reservations to skip from the list before returning results. + * @param take To number of reservations to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the regions and skus that are available for RI purchase for the specified Azure subscription along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String subscriptionId, + String reservedResourceType, + String location, + String publisherId, + String offerId, + String planId, + String filter, + Float skip, + 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 (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String apiVersion = "2022-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + apiVersion, + subscriptionId, + reservedResourceType, + location, + publisherId, + offerId, + planId, + filter, + skip, + take, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the regions and skus that are available for RI purchase for the specified Azure subscription. + * + * @param subscriptionId Id of the subscription. + * @param reservedResourceType The type of the resource for which the skus should be provided. + * @param location Filters the skus based on the location specified in this parameter. This can be an Azure region + * or global. + * @param publisherId Publisher id used to get the third party products. + * @param offerId Offer id used to get the third party products. + * @param planId Plan id used to get the third party products. + * @param filter May be used to filter by Catalog properties. The filter supports 'eq', 'or', and 'and'. + * @param skip The number of reservations to skip from the list before returning results. + * @param take To number of reservations to return. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the regions and skus that are available for RI purchase for the specified Azure subscription as paginated + * response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String subscriptionId, + String reservedResourceType, + String location, + String publisherId, + String offerId, + String planId, + String filter, + Float skip, + Float take) { + return new PagedFlux<>( + () -> + listSinglePageAsync( + subscriptionId, reservedResourceType, location, publisherId, offerId, planId, filter, skip, take), + nextLink -> getCatalogNextSinglePageAsync(nextLink)); + } + + /** + * Get the regions and skus that are available for RI purchase for the specified Azure subscription. + * + * @param subscriptionId Id of the 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 the regions and skus that are available for RI purchase for the specified Azure subscription as paginated + * response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String subscriptionId) { + final String reservedResourceType = null; + final String location = null; + final String publisherId = null; + final String offerId = null; + final String planId = null; + final String filter = null; + final Float skip = null; + final Float take = null; + return new PagedFlux<>( + () -> + listSinglePageAsync( + subscriptionId, reservedResourceType, location, publisherId, offerId, planId, filter, skip, take), + nextLink -> getCatalogNextSinglePageAsync(nextLink)); + } + + /** + * Get the regions and skus that are available for RI purchase for the specified Azure subscription. + * + * @param subscriptionId Id of the subscription. + * @param reservedResourceType The type of the resource for which the skus should be provided. + * @param location Filters the skus based on the location specified in this parameter. This can be an Azure region + * or global. + * @param publisherId Publisher id used to get the third party products. + * @param offerId Offer id used to get the third party products. + * @param planId Plan id used to get the third party products. + * @param filter May be used to filter by Catalog properties. The filter supports 'eq', 'or', and 'and'. + * @param skip The number of reservations to skip from the list before returning results. + * @param take To number of reservations to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the regions and skus that are available for RI purchase for the specified Azure subscription as paginated + * response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String subscriptionId, + String reservedResourceType, + String location, + String publisherId, + String offerId, + String planId, + String filter, + Float skip, + Float take, + Context context) { + return new PagedFlux<>( + () -> + listSinglePageAsync( + subscriptionId, + reservedResourceType, + location, + publisherId, + offerId, + planId, + filter, + skip, + take, + context), + nextLink -> getCatalogNextSinglePageAsync(nextLink, context)); + } + + /** + * Get the regions and skus that are available for RI purchase for the specified Azure subscription. + * + * @param subscriptionId Id of the 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 the regions and skus that are available for RI purchase for the specified Azure subscription as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String subscriptionId) { + final String reservedResourceType = null; + final String location = null; + final String publisherId = null; + final String offerId = null; + final String planId = null; + final String filter = null; + final Float skip = null; + final Float take = null; + return new PagedIterable<>( + listAsync( + subscriptionId, reservedResourceType, location, publisherId, offerId, planId, filter, skip, take)); + } + + /** + * Get the regions and skus that are available for RI purchase for the specified Azure subscription. + * + * @param subscriptionId Id of the subscription. + * @param reservedResourceType The type of the resource for which the skus should be provided. + * @param location Filters the skus based on the location specified in this parameter. This can be an Azure region + * or global. + * @param publisherId Publisher id used to get the third party products. + * @param offerId Offer id used to get the third party products. + * @param planId Plan id used to get the third party products. + * @param filter May be used to filter by Catalog properties. The filter supports 'eq', 'or', and 'and'. + * @param skip The number of reservations to skip from the list before returning results. + * @param take To number of reservations to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the regions and skus that are available for RI purchase for the specified Azure subscription as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String subscriptionId, + String reservedResourceType, + String location, + String publisherId, + String offerId, + String planId, + String filter, + Float skip, + Float take, + Context context) { + return new PagedIterable<>( + listAsync( + subscriptionId, + reservedResourceType, + location, + publisherId, + offerId, + planId, + filter, + skip, + take, + context)); + } + + /** + * Get list of applicable `Reservation`s. + * + *

Get applicable `Reservation`s that are applied to this subscription or a resource group under this + * subscription. + * + * @param subscriptionId Id of the 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 applicable `Reservation`s that are applied to this subscription or a resource group under this + * subscription along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAppliedReservationListWithResponseAsync(String subscriptionId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String apiVersion = "2022-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getAppliedReservationList( + this.client.getEndpoint(), apiVersion, subscriptionId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get list of applicable `Reservation`s. + * + *

Get applicable `Reservation`s that are applied to this subscription or a resource group under this + * subscription. + * + * @param subscriptionId Id of the 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 applicable `Reservation`s that are applied to this subscription or a resource group under this + * subscription along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAppliedReservationListWithResponseAsync( + String subscriptionId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + final String apiVersion = "2022-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getAppliedReservationList(this.client.getEndpoint(), apiVersion, subscriptionId, accept, context); + } + + /** + * Get list of applicable `Reservation`s. + * + *

Get applicable `Reservation`s that are applied to this subscription or a resource group under this + * subscription. + * + * @param subscriptionId Id of the 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 applicable `Reservation`s that are applied to this subscription or a resource group under this + * subscription on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAppliedReservationListAsync(String subscriptionId) { + return getAppliedReservationListWithResponseAsync(subscriptionId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get list of applicable `Reservation`s. + * + *

Get applicable `Reservation`s that are applied to this subscription or a resource group under this + * subscription. + * + * @param subscriptionId Id of the 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 applicable `Reservation`s that are applied to this subscription or a resource group under this + * subscription along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAppliedReservationListWithResponse( + String subscriptionId, Context context) { + return getAppliedReservationListWithResponseAsync(subscriptionId, context).block(); + } + + /** + * Get list of applicable `Reservation`s. + * + *

Get applicable `Reservation`s that are applied to this subscription or a resource group under this + * subscription. + * + * @param subscriptionId Id of the 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 applicable `Reservation`s that are applied to this subscription or a resource group under this + * subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AppliedReservationsInner getAppliedReservationList(String subscriptionId) { + return getAppliedReservationListWithResponse(subscriptionId, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of catalogs and pagination information along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCatalogNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getCatalogNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of catalogs and pagination information along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCatalogNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getCatalogNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ResourceProvidersImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ResourceProvidersImpl.java new file mode 100644 index 0000000000000..ef5e57d9a9c03 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ResourceProvidersImpl.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.reservations.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.reservations.fluent.models.AppliedReservationsInner; +import com.azure.resourcemanager.reservations.fluent.models.CatalogInner; +import com.azure.resourcemanager.reservations.models.AppliedReservations; +import com.azure.resourcemanager.reservations.models.Catalog; +import com.azure.resourcemanager.reservations.models.ResourceProviders; + +public final class ResourceProvidersImpl implements ResourceProviders { + private static final ClientLogger LOGGER = new ClientLogger(ResourceProvidersImpl.class); + + private final ResourceProvidersClient innerClient; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + public ResourceProvidersImpl( + ResourceProvidersClient innerClient, + com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String subscriptionId) { + PagedIterable inner = this.serviceClient().list(subscriptionId); + return Utils.mapPage(inner, inner1 -> new CatalogImpl(inner1, this.manager())); + } + + public PagedIterable list( + String subscriptionId, + String reservedResourceType, + String location, + String publisherId, + String offerId, + String planId, + String filter, + Float skip, + Float take, + Context context) { + PagedIterable inner = + this + .serviceClient() + .list( + subscriptionId, + reservedResourceType, + location, + publisherId, + offerId, + planId, + filter, + skip, + take, + context); + return Utils.mapPage(inner, inner1 -> new CatalogImpl(inner1, this.manager())); + } + + public Response getAppliedReservationListWithResponse(String subscriptionId, Context context) { + Response inner = + this.serviceClient().getAppliedReservationListWithResponse(subscriptionId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AppliedReservationsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AppliedReservations getAppliedReservationList(String subscriptionId) { + AppliedReservationsInner inner = this.serviceClient().getAppliedReservationList(subscriptionId); + if (inner != null) { + return new AppliedReservationsImpl(inner, this.manager()); + } else { + return null; + } + } + + private ResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReturnsClientImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReturnsClientImpl.java new file mode 100644 index 0000000000000..7b0ac768c4530 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReturnsClientImpl.java @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.reservations.fluent.ReturnsClient; +import com.azure.resourcemanager.reservations.fluent.models.RefundResponseInner; +import com.azure.resourcemanager.reservations.models.RefundRequest; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ReturnsClient. */ +public final class ReturnsClientImpl implements ReturnsClient { + /** The proxy service used to perform REST calls. */ + private final ReturnsService service; + + /** The service client containing this operation class. */ + private final AzureReservationApiImpl client; + + /** + * Initializes an instance of ReturnsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ReturnsClientImpl(AzureReservationApiImpl client) { + this.service = RestProxy.create(ReturnsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureReservationApiReturns to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureReservationApiR") + public interface ReturnsService { + @Headers({"Content-Type: application/json"}) + @Post("/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/return") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> post( + @HostParam("$host") String endpoint, + @PathParam("reservationOrderId") String reservationOrderId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RefundRequest body, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Return a reservation. + * + *

Return a reservation and get refund information. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for returning reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of refund request containing refund information of reservation along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> postWithResponseAsync(String reservationOrderId, RefundRequest body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.post(this.client.getEndpoint(), reservationOrderId, apiVersion, body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Return a reservation. + * + *

Return a reservation and get refund information. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for returning 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 response of refund request containing refund information of reservation along with {@link Response} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> postWithResponseAsync( + String reservationOrderId, RefundRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (reservationOrderId == null) { + return Mono + .error(new IllegalArgumentException("Parameter reservationOrderId 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 apiVersion = "2022-11-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.post(this.client.getEndpoint(), reservationOrderId, apiVersion, body, accept, context); + } + + /** + * Return a reservation. + * + *

Return a reservation and get refund information. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for returning reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 response of refund request containing refund information of + * reservation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RefundResponseInner> beginPostAsync( + String reservationOrderId, RefundRequest body) { + Mono>> mono = postWithResponseAsync(reservationOrderId, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + RefundResponseInner.class, + RefundResponseInner.class, + this.client.getContext()); + } + + /** + * Return a reservation. + * + *

Return a reservation and get refund information. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for returning 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 response of refund request containing refund information of + * reservation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RefundResponseInner> beginPostAsync( + String reservationOrderId, RefundRequest body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = postWithResponseAsync(reservationOrderId, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), RefundResponseInner.class, RefundResponseInner.class, context); + } + + /** + * Return a reservation. + * + *

Return a reservation and get refund information. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for returning reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 response of refund request containing refund information of + * reservation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RefundResponseInner> beginPost( + String reservationOrderId, RefundRequest body) { + return this.beginPostAsync(reservationOrderId, body).getSyncPoller(); + } + + /** + * Return a reservation. + * + *

Return a reservation and get refund information. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for returning 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 SyncPoller} for polling of the response of refund request containing refund information of + * reservation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RefundResponseInner> beginPost( + String reservationOrderId, RefundRequest body, Context context) { + return this.beginPostAsync(reservationOrderId, body, context).getSyncPoller(); + } + + /** + * Return a reservation. + * + *

Return a reservation and get refund information. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for returning reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of refund request containing refund information of reservation on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono postAsync(String reservationOrderId, RefundRequest body) { + return beginPostAsync(reservationOrderId, body).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Return a reservation. + * + *

Return a reservation and get refund information. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for returning 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 response of refund request containing refund information of reservation on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono postAsync(String reservationOrderId, RefundRequest body, Context context) { + return beginPostAsync(reservationOrderId, body, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Return a reservation. + * + *

Return a reservation and get refund information. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for returning reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of refund request containing refund information of reservation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RefundResponseInner post(String reservationOrderId, RefundRequest body) { + return postAsync(reservationOrderId, body).block(); + } + + /** + * Return a reservation. + * + *

Return a reservation and get refund information. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for returning 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 response of refund request containing refund information of reservation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RefundResponseInner post(String reservationOrderId, RefundRequest body, Context context) { + return postAsync(reservationOrderId, body, context).block(); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReturnsImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReturnsImpl.java new file mode 100644 index 0000000000000..bef8a306fb471 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReturnsImpl.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.reservations.fluent.ReturnsClient; +import com.azure.resourcemanager.reservations.fluent.models.RefundResponseInner; +import com.azure.resourcemanager.reservations.models.RefundRequest; +import com.azure.resourcemanager.reservations.models.RefundResponse; +import com.azure.resourcemanager.reservations.models.Returns; + +public final class ReturnsImpl implements Returns { + private static final ClientLogger LOGGER = new ClientLogger(ReturnsImpl.class); + + private final ReturnsClient innerClient; + + private final com.azure.resourcemanager.reservations.ReservationsManager serviceManager; + + public ReturnsImpl( + ReturnsClient innerClient, com.azure.resourcemanager.reservations.ReservationsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public RefundResponse post(String reservationOrderId, RefundRequest body) { + RefundResponseInner inner = this.serviceClient().post(reservationOrderId, body); + if (inner != null) { + return new RefundResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public RefundResponse post(String reservationOrderId, RefundRequest body, Context context) { + RefundResponseInner inner = this.serviceClient().post(reservationOrderId, body, context); + if (inner != null) { + return new RefundResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private ReturnsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.reservations.ReservationsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/Utils.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/Utils.java new file mode 100644 index 0000000000000..1c6ca34e3ce11 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/package-info.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/package-info.java new file mode 100644 index 0000000000000..53a70372f0832 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for AzureReservationApi. This API describe Azure Reservation. */ +package com.azure.resourcemanager.reservations.implementation; diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AppliedReservationList.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AppliedReservationList.java new file mode 100644 index 0000000000000..b450251e8fea8 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AppliedReservationList.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Paginated list of applied reservations. */ +@Fluent +public final class AppliedReservationList { + /* + * The value property. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Url to get the next page of reservations + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of AppliedReservationList class. */ + public AppliedReservationList() { + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the AppliedReservationList object itself. + */ + public AppliedReservationList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Url to get the next page of reservations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Url to get the next page of reservations. + * + * @param nextLink the nextLink value to set. + * @return the AppliedReservationList object itself. + */ + public AppliedReservationList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AppliedReservations.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AppliedReservations.java new file mode 100644 index 0000000000000..15aead7f63aea --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AppliedReservations.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.resourcemanager.reservations.fluent.models.AppliedReservationsInner; + +/** An immutable client-side representation of AppliedReservations. */ +public interface AppliedReservations { + /** + * Gets the id property: Identifier of the applied reservations. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: Name of resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: Type of resource. "Microsoft.Capacity/AppliedReservations". + * + * @return the type value. + */ + String type(); + + /** + * Gets the reservationOrderIds property: Paginated list of applied reservations. + * + * @return the reservationOrderIds value. + */ + AppliedReservationList reservationOrderIds(); + + /** + * Gets the inner com.azure.resourcemanager.reservations.fluent.models.AppliedReservationsInner object. + * + * @return the inner object. + */ + AppliedReservationsInner innerModel(); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AppliedScopeProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AppliedScopeProperties.java new file mode 100644 index 0000000000000..762edf148247d --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AppliedScopeProperties.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties specific to applied scope type. Not required if not applicable. Required and need to provide tenantId and + * managementGroupId if AppliedScopeType is ManagementGroup. + */ +@Fluent +public final class AppliedScopeProperties { + /* + * Tenant ID where the savings plan should apply benefit. + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /* + * Fully-qualified identifier of the management group where the benefit must be applied. + */ + @JsonProperty(value = "managementGroupId") + private String managementGroupId; + + /* + * Fully-qualified identifier of the subscription. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /* + * Fully-qualified identifier of the resource group. + */ + @JsonProperty(value = "resourceGroupId") + private String resourceGroupId; + + /* + * Display name + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** Creates an instance of AppliedScopeProperties class. */ + public AppliedScopeProperties() { + } + + /** + * Get the tenantId property: Tenant ID where the savings plan should apply benefit. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: Tenant ID where the savings plan should apply benefit. + * + * @param tenantId the tenantId value to set. + * @return the AppliedScopeProperties object itself. + */ + public AppliedScopeProperties withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the managementGroupId property: Fully-qualified identifier of the management group where the benefit must be + * applied. + * + * @return the managementGroupId value. + */ + public String managementGroupId() { + return this.managementGroupId; + } + + /** + * Set the managementGroupId property: Fully-qualified identifier of the management group where the benefit must be + * applied. + * + * @param managementGroupId the managementGroupId value to set. + * @return the AppliedScopeProperties object itself. + */ + public AppliedScopeProperties withManagementGroupId(String managementGroupId) { + this.managementGroupId = managementGroupId; + return this; + } + + /** + * Get the subscriptionId property: Fully-qualified identifier of the subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: Fully-qualified identifier of the subscription. + * + * @param subscriptionId the subscriptionId value to set. + * @return the AppliedScopeProperties object itself. + */ + public AppliedScopeProperties withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the resourceGroupId property: Fully-qualified identifier of the resource group. + * + * @return the resourceGroupId value. + */ + public String resourceGroupId() { + return this.resourceGroupId; + } + + /** + * Set the resourceGroupId property: Fully-qualified identifier of the resource group. + * + * @param resourceGroupId the resourceGroupId value to set. + * @return the AppliedScopeProperties object itself. + */ + public AppliedScopeProperties withResourceGroupId(String resourceGroupId) { + this.resourceGroupId = resourceGroupId; + return this; + } + + /** + * Get the displayName property: Display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Display name. + * + * @param displayName the displayName value to set. + * @return the AppliedScopeProperties object itself. + */ + public AppliedScopeProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AppliedScopeType.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AppliedScopeType.java new file mode 100644 index 0000000000000..454166aaeb103 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AppliedScopeType.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Type of the Applied Scope. */ +public final class AppliedScopeType extends ExpandableStringEnum { + /** Static value Single for AppliedScopeType. */ + public static final AppliedScopeType SINGLE = fromString("Single"); + + /** Static value Shared for AppliedScopeType. */ + public static final AppliedScopeType SHARED = fromString("Shared"); + + /** Static value ManagementGroup for AppliedScopeType. */ + public static final AppliedScopeType MANAGEMENT_GROUP = fromString("ManagementGroup"); + + /** + * Creates a new instance of AppliedScopeType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AppliedScopeType() { + } + + /** + * Creates or finds a AppliedScopeType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AppliedScopeType. + */ + @JsonCreator + public static AppliedScopeType fromString(String name) { + return fromString(name, AppliedScopeType.class); + } + + /** + * Gets known AppliedScopeType values. + * + * @return known AppliedScopeType values. + */ + public static Collection values() { + return values(AppliedScopeType.class); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AvailableScopeProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AvailableScopeProperties.java new file mode 100644 index 0000000000000..74de198c4d54f --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AvailableScopeProperties.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.resourcemanager.reservations.fluent.models.AvailableScopePropertiesInner; + +/** An immutable client-side representation of AvailableScopeProperties. */ +public interface AvailableScopeProperties { + /** + * Gets the properties property: The scopes checked by the available scope api. + * + * @return the properties value. + */ + SubscriptionScopeProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.reservations.fluent.models.AvailableScopePropertiesInner object. + * + * @return the inner object. + */ + AvailableScopePropertiesInner innerModel(); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AvailableScopeRequest.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AvailableScopeRequest.java new file mode 100644 index 0000000000000..462e68a5b208e --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AvailableScopeRequest.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Available scope. */ +@Fluent +public final class AvailableScopeRequest { + /* + * Available scope request properties + */ + @JsonProperty(value = "properties") + private AvailableScopeRequestProperties properties; + + /** Creates an instance of AvailableScopeRequest class. */ + public AvailableScopeRequest() { + } + + /** + * Get the properties property: Available scope request properties. + * + * @return the properties value. + */ + public AvailableScopeRequestProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Available scope request properties. + * + * @param properties the properties value to set. + * @return the AvailableScopeRequest object itself. + */ + public AvailableScopeRequest withProperties(AvailableScopeRequestProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AvailableScopeRequestProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AvailableScopeRequestProperties.java new file mode 100644 index 0000000000000..bab7cbe83df8c --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AvailableScopeRequestProperties.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Available scope request properties. */ +@Fluent +public final class AvailableScopeRequestProperties { + /* + * The scopes property. + */ + @JsonProperty(value = "scopes") + private List scopes; + + /** Creates an instance of AvailableScopeRequestProperties class. */ + public AvailableScopeRequestProperties() { + } + + /** + * Get the scopes property: The scopes property. + * + * @return the scopes value. + */ + public List scopes() { + return this.scopes; + } + + /** + * Set the scopes property: The scopes property. + * + * @param scopes the scopes value to set. + * @return the AvailableScopeRequestProperties object itself. + */ + public AvailableScopeRequestProperties withScopes(List scopes) { + this.scopes = scopes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/BillingInformation.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/BillingInformation.java new file mode 100644 index 0000000000000..ce5a59942865a --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/BillingInformation.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** billing information. */ +@Fluent +public final class BillingInformation { + /* + * Pricing information containing the amount and the currency code + */ + @JsonProperty(value = "billingCurrencyTotalPaidAmount") + private Price billingCurrencyTotalPaidAmount; + + /* + * Pricing information containing the amount and the currency code + */ + @JsonProperty(value = "billingCurrencyProratedAmount") + private Price billingCurrencyProratedAmount; + + /* + * Pricing information containing the amount and the currency code + */ + @JsonProperty(value = "billingCurrencyRemainingCommitmentAmount") + private Price billingCurrencyRemainingCommitmentAmount; + + /** Creates an instance of BillingInformation class. */ + public BillingInformation() { + } + + /** + * Get the billingCurrencyTotalPaidAmount property: Pricing information containing the amount and the currency code. + * + * @return the billingCurrencyTotalPaidAmount value. + */ + public Price billingCurrencyTotalPaidAmount() { + return this.billingCurrencyTotalPaidAmount; + } + + /** + * Set the billingCurrencyTotalPaidAmount property: Pricing information containing the amount and the currency code. + * + * @param billingCurrencyTotalPaidAmount the billingCurrencyTotalPaidAmount value to set. + * @return the BillingInformation object itself. + */ + public BillingInformation withBillingCurrencyTotalPaidAmount(Price billingCurrencyTotalPaidAmount) { + this.billingCurrencyTotalPaidAmount = billingCurrencyTotalPaidAmount; + return this; + } + + /** + * Get the billingCurrencyProratedAmount property: Pricing information containing the amount and the currency code. + * + * @return the billingCurrencyProratedAmount value. + */ + public Price billingCurrencyProratedAmount() { + return this.billingCurrencyProratedAmount; + } + + /** + * Set the billingCurrencyProratedAmount property: Pricing information containing the amount and the currency code. + * + * @param billingCurrencyProratedAmount the billingCurrencyProratedAmount value to set. + * @return the BillingInformation object itself. + */ + public BillingInformation withBillingCurrencyProratedAmount(Price billingCurrencyProratedAmount) { + this.billingCurrencyProratedAmount = billingCurrencyProratedAmount; + return this; + } + + /** + * Get the billingCurrencyRemainingCommitmentAmount property: Pricing information containing the amount and the + * currency code. + * + * @return the billingCurrencyRemainingCommitmentAmount value. + */ + public Price billingCurrencyRemainingCommitmentAmount() { + return this.billingCurrencyRemainingCommitmentAmount; + } + + /** + * Set the billingCurrencyRemainingCommitmentAmount property: Pricing information containing the amount and the + * currency code. + * + * @param billingCurrencyRemainingCommitmentAmount the billingCurrencyRemainingCommitmentAmount value to set. + * @return the BillingInformation object itself. + */ + public BillingInformation withBillingCurrencyRemainingCommitmentAmount( + Price billingCurrencyRemainingCommitmentAmount) { + this.billingCurrencyRemainingCommitmentAmount = billingCurrencyRemainingCommitmentAmount; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (billingCurrencyTotalPaidAmount() != null) { + billingCurrencyTotalPaidAmount().validate(); + } + if (billingCurrencyProratedAmount() != null) { + billingCurrencyProratedAmount().validate(); + } + if (billingCurrencyRemainingCommitmentAmount() != null) { + billingCurrencyRemainingCommitmentAmount().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/BillingPlan.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/BillingPlan.java new file mode 100644 index 0000000000000..32eda4df48dba --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/BillingPlan.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Represents the billing plan in ISO 8601 format. Required only for monthly billing plans. */ +public final class BillingPlan extends ExpandableStringEnum { + /** Static value P1M for BillingPlan. */ + public static final BillingPlan P1M = fromString("P1M"); + + /** + * Creates a new instance of BillingPlan value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public BillingPlan() { + } + + /** + * Creates or finds a BillingPlan from its string representation. + * + * @param name a name to look for. + * @return the corresponding BillingPlan. + */ + @JsonCreator + public static BillingPlan fromString(String name) { + return fromString(name, BillingPlan.class); + } + + /** + * Gets known BillingPlan values. + * + * @return known BillingPlan values. + */ + public static Collection values() { + return values(BillingPlan.class); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeOperationResultResponse.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeOperationResultResponse.java new file mode 100644 index 0000000000000..6850125d64e3b --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeOperationResultResponse.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.resourcemanager.reservations.fluent.models.CalculateExchangeOperationResultResponseInner; + +/** An immutable client-side representation of CalculateExchangeOperationResultResponse. */ +public interface CalculateExchangeOperationResultResponse { + /** + * Gets the id property: It should match what is used to GET the operation result. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: It must match the last segment of the id field, and will typically be a GUID / system + * generated value. + * + * @return the name value. + */ + String name(); + + /** + * Gets the status property: Status of the operation. + * + * @return the status value. + */ + CalculateExchangeOperationResultStatus status(); + + /** + * Gets the properties property: CalculateExchange response properties. + * + * @return the properties value. + */ + CalculateExchangeResponseProperties properties(); + + /** + * Gets the error property: Required if status == failed or status == canceled. + * + * @return the error value. + */ + OperationResultError error(); + + /** + * Gets the inner com.azure.resourcemanager.reservations.fluent.models.CalculateExchangeOperationResultResponseInner + * object. + * + * @return the inner object. + */ + CalculateExchangeOperationResultResponseInner innerModel(); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeOperationResultStatus.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeOperationResultStatus.java new file mode 100644 index 0000000000000..24742de4c82b1 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeOperationResultStatus.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Status of the operation. */ +public final class CalculateExchangeOperationResultStatus + extends ExpandableStringEnum { + /** Static value Succeeded for CalculateExchangeOperationResultStatus. */ + public static final CalculateExchangeOperationResultStatus SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for CalculateExchangeOperationResultStatus. */ + public static final CalculateExchangeOperationResultStatus FAILED = fromString("Failed"); + + /** Static value Cancelled for CalculateExchangeOperationResultStatus. */ + public static final CalculateExchangeOperationResultStatus CANCELLED = fromString("Cancelled"); + + /** Static value Pending for CalculateExchangeOperationResultStatus. */ + public static final CalculateExchangeOperationResultStatus PENDING = fromString("Pending"); + + /** + * Creates a new instance of CalculateExchangeOperationResultStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CalculateExchangeOperationResultStatus() { + } + + /** + * Creates or finds a CalculateExchangeOperationResultStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding CalculateExchangeOperationResultStatus. + */ + @JsonCreator + public static CalculateExchangeOperationResultStatus fromString(String name) { + return fromString(name, CalculateExchangeOperationResultStatus.class); + } + + /** + * Gets known CalculateExchangeOperationResultStatus values. + * + * @return known CalculateExchangeOperationResultStatus values. + */ + public static Collection values() { + return values(CalculateExchangeOperationResultStatus.class); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeRequest.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeRequest.java new file mode 100644 index 0000000000000..3d546b41db709 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeRequest.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Calculate exchange request. */ +@Fluent +public final class CalculateExchangeRequest { + /* + * Calculate exchange request properties + */ + @JsonProperty(value = "properties") + private CalculateExchangeRequestProperties properties; + + /** Creates an instance of CalculateExchangeRequest class. */ + public CalculateExchangeRequest() { + } + + /** + * Get the properties property: Calculate exchange request properties. + * + * @return the properties value. + */ + public CalculateExchangeRequestProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Calculate exchange request properties. + * + * @param properties the properties value to set. + * @return the CalculateExchangeRequest object itself. + */ + public CalculateExchangeRequest withProperties(CalculateExchangeRequestProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeRequestProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeRequestProperties.java new file mode 100644 index 0000000000000..4fcf5709dac50 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeRequestProperties.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Calculate exchange request properties. */ +@Fluent +public final class CalculateExchangeRequestProperties { + /* + * List of reservations that are being purchased in this exchange. + */ + @JsonProperty(value = "reservationsToPurchase") + private List reservationsToPurchase; + + /* + * List of savings plans that are being purchased in this exchange. + */ + @JsonProperty(value = "savingsPlansToPurchase") + private List savingsPlansToPurchase; + + /* + * List of reservations that are being returned in this exchange. + */ + @JsonProperty(value = "reservationsToExchange") + private List reservationsToExchange; + + /** Creates an instance of CalculateExchangeRequestProperties class. */ + public CalculateExchangeRequestProperties() { + } + + /** + * Get the reservationsToPurchase property: List of reservations that are being purchased in this exchange. + * + * @return the reservationsToPurchase value. + */ + public List reservationsToPurchase() { + return this.reservationsToPurchase; + } + + /** + * Set the reservationsToPurchase property: List of reservations that are being purchased in this exchange. + * + * @param reservationsToPurchase the reservationsToPurchase value to set. + * @return the CalculateExchangeRequestProperties object itself. + */ + public CalculateExchangeRequestProperties withReservationsToPurchase(List reservationsToPurchase) { + this.reservationsToPurchase = reservationsToPurchase; + return this; + } + + /** + * Get the savingsPlansToPurchase property: List of savings plans that are being purchased in this exchange. + * + * @return the savingsPlansToPurchase value. + */ + public List savingsPlansToPurchase() { + return this.savingsPlansToPurchase; + } + + /** + * Set the savingsPlansToPurchase property: List of savings plans that are being purchased in this exchange. + * + * @param savingsPlansToPurchase the savingsPlansToPurchase value to set. + * @return the CalculateExchangeRequestProperties object itself. + */ + public CalculateExchangeRequestProperties withSavingsPlansToPurchase( + List savingsPlansToPurchase) { + this.savingsPlansToPurchase = savingsPlansToPurchase; + return this; + } + + /** + * Get the reservationsToExchange property: List of reservations that are being returned in this exchange. + * + * @return the reservationsToExchange value. + */ + public List reservationsToExchange() { + return this.reservationsToExchange; + } + + /** + * Set the reservationsToExchange property: List of reservations that are being returned in this exchange. + * + * @param reservationsToExchange the reservationsToExchange value to set. + * @return the CalculateExchangeRequestProperties object itself. + */ + public CalculateExchangeRequestProperties withReservationsToExchange( + List reservationsToExchange) { + this.reservationsToExchange = reservationsToExchange; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (reservationsToPurchase() != null) { + reservationsToPurchase().forEach(e -> e.validate()); + } + if (savingsPlansToPurchase() != null) { + savingsPlansToPurchase().forEach(e -> e.validate()); + } + if (reservationsToExchange() != null) { + reservationsToExchange().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeResponseProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeResponseProperties.java new file mode 100644 index 0000000000000..1c534a224a010 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeResponseProperties.java @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** CalculateExchange response properties. */ +@Fluent +public final class CalculateExchangeResponseProperties { + /* + * Exchange session identifier + */ + @JsonProperty(value = "sessionId") + private String sessionId; + + /* + * Pricing information containing the amount and the currency code + */ + @JsonProperty(value = "netPayable") + private Price netPayable; + + /* + * Pricing information containing the amount and the currency code + */ + @JsonProperty(value = "refundsTotal") + private Price refundsTotal; + + /* + * Pricing information containing the amount and the currency code + */ + @JsonProperty(value = "purchasesTotal") + private Price purchasesTotal; + + /* + * Details of the reservations being purchased + */ + @JsonProperty(value = "reservationsToPurchase") + private List reservationsToPurchase; + + /* + * Details of the savings plans being purchased + */ + @JsonProperty(value = "savingsPlansToPurchase") + private List savingsPlansToPurchase; + + /* + * Details of the reservations being returned + */ + @JsonProperty(value = "reservationsToExchange") + private List reservationsToExchange; + + /* + * Exchange policy errors + */ + @JsonProperty(value = "policyResult") + private ExchangePolicyErrors policyResult; + + /** Creates an instance of CalculateExchangeResponseProperties class. */ + public CalculateExchangeResponseProperties() { + } + + /** + * Get the sessionId property: Exchange session identifier. + * + * @return the sessionId value. + */ + public String sessionId() { + return this.sessionId; + } + + /** + * Set the sessionId property: Exchange session identifier. + * + * @param sessionId the sessionId value to set. + * @return the CalculateExchangeResponseProperties object itself. + */ + public CalculateExchangeResponseProperties withSessionId(String sessionId) { + this.sessionId = sessionId; + return this; + } + + /** + * Get the netPayable property: Pricing information containing the amount and the currency code. + * + * @return the netPayable value. + */ + public Price netPayable() { + return this.netPayable; + } + + /** + * Set the netPayable property: Pricing information containing the amount and the currency code. + * + * @param netPayable the netPayable value to set. + * @return the CalculateExchangeResponseProperties object itself. + */ + public CalculateExchangeResponseProperties withNetPayable(Price netPayable) { + this.netPayable = netPayable; + return this; + } + + /** + * Get the refundsTotal property: Pricing information containing the amount and the currency code. + * + * @return the refundsTotal value. + */ + public Price refundsTotal() { + return this.refundsTotal; + } + + /** + * Set the refundsTotal property: Pricing information containing the amount and the currency code. + * + * @param refundsTotal the refundsTotal value to set. + * @return the CalculateExchangeResponseProperties object itself. + */ + public CalculateExchangeResponseProperties withRefundsTotal(Price refundsTotal) { + this.refundsTotal = refundsTotal; + return this; + } + + /** + * Get the purchasesTotal property: Pricing information containing the amount and the currency code. + * + * @return the purchasesTotal value. + */ + public Price purchasesTotal() { + return this.purchasesTotal; + } + + /** + * Set the purchasesTotal property: Pricing information containing the amount and the currency code. + * + * @param purchasesTotal the purchasesTotal value to set. + * @return the CalculateExchangeResponseProperties object itself. + */ + public CalculateExchangeResponseProperties withPurchasesTotal(Price purchasesTotal) { + this.purchasesTotal = purchasesTotal; + return this; + } + + /** + * Get the reservationsToPurchase property: Details of the reservations being purchased. + * + * @return the reservationsToPurchase value. + */ + public List reservationsToPurchase() { + return this.reservationsToPurchase; + } + + /** + * Set the reservationsToPurchase property: Details of the reservations being purchased. + * + * @param reservationsToPurchase the reservationsToPurchase value to set. + * @return the CalculateExchangeResponseProperties object itself. + */ + public CalculateExchangeResponseProperties withReservationsToPurchase( + List reservationsToPurchase) { + this.reservationsToPurchase = reservationsToPurchase; + return this; + } + + /** + * Get the savingsPlansToPurchase property: Details of the savings plans being purchased. + * + * @return the savingsPlansToPurchase value. + */ + public List savingsPlansToPurchase() { + return this.savingsPlansToPurchase; + } + + /** + * Set the savingsPlansToPurchase property: Details of the savings plans being purchased. + * + * @param savingsPlansToPurchase the savingsPlansToPurchase value to set. + * @return the CalculateExchangeResponseProperties object itself. + */ + public CalculateExchangeResponseProperties withSavingsPlansToPurchase( + List savingsPlansToPurchase) { + this.savingsPlansToPurchase = savingsPlansToPurchase; + return this; + } + + /** + * Get the reservationsToExchange property: Details of the reservations being returned. + * + * @return the reservationsToExchange value. + */ + public List reservationsToExchange() { + return this.reservationsToExchange; + } + + /** + * Set the reservationsToExchange property: Details of the reservations being returned. + * + * @param reservationsToExchange the reservationsToExchange value to set. + * @return the CalculateExchangeResponseProperties object itself. + */ + public CalculateExchangeResponseProperties withReservationsToExchange( + List reservationsToExchange) { + this.reservationsToExchange = reservationsToExchange; + return this; + } + + /** + * Get the policyResult property: Exchange policy errors. + * + * @return the policyResult value. + */ + public ExchangePolicyErrors policyResult() { + return this.policyResult; + } + + /** + * Set the policyResult property: Exchange policy errors. + * + * @param policyResult the policyResult value to set. + * @return the CalculateExchangeResponseProperties object itself. + */ + public CalculateExchangeResponseProperties withPolicyResult(ExchangePolicyErrors policyResult) { + this.policyResult = policyResult; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (netPayable() != null) { + netPayable().validate(); + } + if (refundsTotal() != null) { + refundsTotal().validate(); + } + if (purchasesTotal() != null) { + purchasesTotal().validate(); + } + if (reservationsToPurchase() != null) { + reservationsToPurchase().forEach(e -> e.validate()); + } + if (savingsPlansToPurchase() != null) { + savingsPlansToPurchase().forEach(e -> e.validate()); + } + if (reservationsToExchange() != null) { + reservationsToExchange().forEach(e -> e.validate()); + } + if (policyResult() != null) { + policyResult().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchanges.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchanges.java new file mode 100644 index 0000000000000..7928d5bb33588 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchanges.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.util.Context; + +/** Resource collection API of CalculateExchanges. */ +public interface CalculateExchanges { + /** + * Calculates the refund amounts and price of the new purchases. + * + *

Calculates price for exchanging `Reservations` if there are no policy errors. + * + * @param body Request containing purchases and refunds that need to be executed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return calculateExchange operation result. + */ + CalculateExchangeOperationResultResponse post(CalculateExchangeRequest body); + + /** + * Calculates the refund amounts and price of the new purchases. + * + *

Calculates price for exchanging `Reservations` if there are no policy errors. + * + * @param body Request containing purchases and refunds that need to be executed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return calculateExchange operation result. + */ + CalculateExchangeOperationResultResponse post(CalculateExchangeRequest body, Context context); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculatePriceResponse.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculatePriceResponse.java new file mode 100644 index 0000000000000..d36a1a90d7002 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculatePriceResponse.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.resourcemanager.reservations.fluent.models.CalculatePriceResponseInner; + +/** An immutable client-side representation of CalculatePriceResponse. */ +public interface CalculatePriceResponse { + /** + * Gets the properties property: Properties for calculate price response. + * + * @return the properties value. + */ + CalculatePriceResponseProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.reservations.fluent.models.CalculatePriceResponseInner object. + * + * @return the inner object. + */ + CalculatePriceResponseInner innerModel(); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculatePriceResponseProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculatePriceResponseProperties.java new file mode 100644 index 0000000000000..607b3c33f7ee7 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculatePriceResponseProperties.java @@ -0,0 +1,330 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties for calculate price response. */ +@Fluent +public final class CalculatePriceResponseProperties { + /* + * Currency and amount that customer will be charged in customer's local currency. Tax is not included. + */ + @JsonProperty(value = "billingCurrencyTotal") + private CalculatePriceResponsePropertiesBillingCurrencyTotal billingCurrencyTotal; + + /* + * Net total amount in pricing currency. + */ + @JsonProperty(value = "netTotal") + private Double netTotal; + + /* + * Tax amount in pricing currency. + */ + @JsonProperty(value = "taxTotal") + private Double taxTotal; + + /* + * Total amount in pricing currency. + */ + @JsonProperty(value = "grandTotal") + private Double grandTotal; + + /* + * Whether or not tax is included in grand total + */ + @JsonProperty(value = "isTaxIncluded") + private Boolean isTaxIncluded; + + /* + * True if billing is managed by Microsoft Partner. Used only for CSP accounts. + */ + @JsonProperty(value = "isBillingPartnerManaged") + private Boolean isBillingPartnerManaged; + + /* + * GUID that represents reservation order that can be placed after calculating price. + */ + @JsonProperty(value = "reservationOrderId") + private String reservationOrderId; + + /* + * Title of sku that is being purchased. + */ + @JsonProperty(value = "skuTitle") + private String skuTitle; + + /* + * Description of sku that is being purchased. + */ + @JsonProperty(value = "skuDescription") + private String skuDescription; + + /* + * Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. + */ + @JsonProperty(value = "pricingCurrencyTotal") + private CalculatePriceResponsePropertiesPricingCurrencyTotal pricingCurrencyTotal; + + /* + * The paymentSchedule property. + */ + @JsonProperty(value = "paymentSchedule") + private List paymentSchedule; + + /** Creates an instance of CalculatePriceResponseProperties class. */ + public CalculatePriceResponseProperties() { + } + + /** + * Get the billingCurrencyTotal property: Currency and amount that customer will be charged in customer's local + * currency. Tax is not included. + * + * @return the billingCurrencyTotal value. + */ + public CalculatePriceResponsePropertiesBillingCurrencyTotal billingCurrencyTotal() { + return this.billingCurrencyTotal; + } + + /** + * Set the billingCurrencyTotal property: Currency and amount that customer will be charged in customer's local + * currency. Tax is not included. + * + * @param billingCurrencyTotal the billingCurrencyTotal value to set. + * @return the CalculatePriceResponseProperties object itself. + */ + public CalculatePriceResponseProperties withBillingCurrencyTotal( + CalculatePriceResponsePropertiesBillingCurrencyTotal billingCurrencyTotal) { + this.billingCurrencyTotal = billingCurrencyTotal; + return this; + } + + /** + * Get the netTotal property: Net total amount in pricing currency. + * + * @return the netTotal value. + */ + public Double netTotal() { + return this.netTotal; + } + + /** + * Set the netTotal property: Net total amount in pricing currency. + * + * @param netTotal the netTotal value to set. + * @return the CalculatePriceResponseProperties object itself. + */ + public CalculatePriceResponseProperties withNetTotal(Double netTotal) { + this.netTotal = netTotal; + return this; + } + + /** + * Get the taxTotal property: Tax amount in pricing currency. + * + * @return the taxTotal value. + */ + public Double taxTotal() { + return this.taxTotal; + } + + /** + * Set the taxTotal property: Tax amount in pricing currency. + * + * @param taxTotal the taxTotal value to set. + * @return the CalculatePriceResponseProperties object itself. + */ + public CalculatePriceResponseProperties withTaxTotal(Double taxTotal) { + this.taxTotal = taxTotal; + return this; + } + + /** + * Get the grandTotal property: Total amount in pricing currency. + * + * @return the grandTotal value. + */ + public Double grandTotal() { + return this.grandTotal; + } + + /** + * Set the grandTotal property: Total amount in pricing currency. + * + * @param grandTotal the grandTotal value to set. + * @return the CalculatePriceResponseProperties object itself. + */ + public CalculatePriceResponseProperties withGrandTotal(Double grandTotal) { + this.grandTotal = grandTotal; + return this; + } + + /** + * Get the isTaxIncluded property: Whether or not tax is included in grand total. + * + * @return the isTaxIncluded value. + */ + public Boolean isTaxIncluded() { + return this.isTaxIncluded; + } + + /** + * Set the isTaxIncluded property: Whether or not tax is included in grand total. + * + * @param isTaxIncluded the isTaxIncluded value to set. + * @return the CalculatePriceResponseProperties object itself. + */ + public CalculatePriceResponseProperties withIsTaxIncluded(Boolean isTaxIncluded) { + this.isTaxIncluded = isTaxIncluded; + return this; + } + + /** + * Get the isBillingPartnerManaged property: True if billing is managed by Microsoft Partner. Used only for CSP + * accounts. + * + * @return the isBillingPartnerManaged value. + */ + public Boolean isBillingPartnerManaged() { + return this.isBillingPartnerManaged; + } + + /** + * Set the isBillingPartnerManaged property: True if billing is managed by Microsoft Partner. Used only for CSP + * accounts. + * + * @param isBillingPartnerManaged the isBillingPartnerManaged value to set. + * @return the CalculatePriceResponseProperties object itself. + */ + public CalculatePriceResponseProperties withIsBillingPartnerManaged(Boolean isBillingPartnerManaged) { + this.isBillingPartnerManaged = isBillingPartnerManaged; + return this; + } + + /** + * Get the reservationOrderId property: GUID that represents reservation order that can be placed after calculating + * price. + * + * @return the reservationOrderId value. + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Set the reservationOrderId property: GUID that represents reservation order that can be placed after calculating + * price. + * + * @param reservationOrderId the reservationOrderId value to set. + * @return the CalculatePriceResponseProperties object itself. + */ + public CalculatePriceResponseProperties withReservationOrderId(String reservationOrderId) { + this.reservationOrderId = reservationOrderId; + return this; + } + + /** + * Get the skuTitle property: Title of sku that is being purchased. + * + * @return the skuTitle value. + */ + public String skuTitle() { + return this.skuTitle; + } + + /** + * Set the skuTitle property: Title of sku that is being purchased. + * + * @param skuTitle the skuTitle value to set. + * @return the CalculatePriceResponseProperties object itself. + */ + public CalculatePriceResponseProperties withSkuTitle(String skuTitle) { + this.skuTitle = skuTitle; + return this; + } + + /** + * Get the skuDescription property: Description of sku that is being purchased. + * + * @return the skuDescription value. + */ + public String skuDescription() { + return this.skuDescription; + } + + /** + * Set the skuDescription property: Description of sku that is being purchased. + * + * @param skuDescription the skuDescription value to set. + * @return the CalculatePriceResponseProperties object itself. + */ + public CalculatePriceResponseProperties withSkuDescription(String skuDescription) { + this.skuDescription = skuDescription; + return this; + } + + /** + * Get the pricingCurrencyTotal property: Amount that Microsoft uses for record. Used during refund for calculating + * refund limit. Tax is not included. + * + * @return the pricingCurrencyTotal value. + */ + public CalculatePriceResponsePropertiesPricingCurrencyTotal pricingCurrencyTotal() { + return this.pricingCurrencyTotal; + } + + /** + * Set the pricingCurrencyTotal property: Amount that Microsoft uses for record. Used during refund for calculating + * refund limit. Tax is not included. + * + * @param pricingCurrencyTotal the pricingCurrencyTotal value to set. + * @return the CalculatePriceResponseProperties object itself. + */ + public CalculatePriceResponseProperties withPricingCurrencyTotal( + CalculatePriceResponsePropertiesPricingCurrencyTotal pricingCurrencyTotal) { + this.pricingCurrencyTotal = pricingCurrencyTotal; + return this; + } + + /** + * Get the paymentSchedule property: The paymentSchedule property. + * + * @return the paymentSchedule value. + */ + public List paymentSchedule() { + return this.paymentSchedule; + } + + /** + * Set the paymentSchedule property: The paymentSchedule property. + * + * @param paymentSchedule the paymentSchedule value to set. + * @return the CalculatePriceResponseProperties object itself. + */ + public CalculatePriceResponseProperties withPaymentSchedule(List paymentSchedule) { + this.paymentSchedule = paymentSchedule; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (billingCurrencyTotal() != null) { + billingCurrencyTotal().validate(); + } + if (pricingCurrencyTotal() != null) { + pricingCurrencyTotal().validate(); + } + if (paymentSchedule() != null) { + paymentSchedule().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculatePriceResponsePropertiesBillingCurrencyTotal.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculatePriceResponsePropertiesBillingCurrencyTotal.java new file mode 100644 index 0000000000000..0c0e01d17343f --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculatePriceResponsePropertiesBillingCurrencyTotal.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Currency and amount that customer will be charged in customer's local currency. Tax is not included. */ +@Fluent +public final class CalculatePriceResponsePropertiesBillingCurrencyTotal { + /* + * The ISO 4217 3-letter currency code for the currency used by this purchase record. + */ + @JsonProperty(value = "currencyCode") + private String currencyCode; + + /* + * Amount in pricing currency. Tax is not included. + */ + @JsonProperty(value = "amount") + private Double amount; + + /** Creates an instance of CalculatePriceResponsePropertiesBillingCurrencyTotal class. */ + public CalculatePriceResponsePropertiesBillingCurrencyTotal() { + } + + /** + * Get the currencyCode property: The ISO 4217 3-letter currency code for the currency used by this purchase record. + * + * @return the currencyCode value. + */ + public String currencyCode() { + return this.currencyCode; + } + + /** + * Set the currencyCode property: The ISO 4217 3-letter currency code for the currency used by this purchase record. + * + * @param currencyCode the currencyCode value to set. + * @return the CalculatePriceResponsePropertiesBillingCurrencyTotal object itself. + */ + public CalculatePriceResponsePropertiesBillingCurrencyTotal withCurrencyCode(String currencyCode) { + this.currencyCode = currencyCode; + return this; + } + + /** + * Get the amount property: Amount in pricing currency. Tax is not included. + * + * @return the amount value. + */ + public Double amount() { + return this.amount; + } + + /** + * Set the amount property: Amount in pricing currency. Tax is not included. + * + * @param amount the amount value to set. + * @return the CalculatePriceResponsePropertiesBillingCurrencyTotal object itself. + */ + public CalculatePriceResponsePropertiesBillingCurrencyTotal withAmount(Double amount) { + this.amount = amount; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculatePriceResponsePropertiesPricingCurrencyTotal.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculatePriceResponsePropertiesPricingCurrencyTotal.java new file mode 100644 index 0000000000000..bb819b686c290 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculatePriceResponsePropertiesPricingCurrencyTotal.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. */ +@Fluent +public final class CalculatePriceResponsePropertiesPricingCurrencyTotal { + /* + * The ISO 4217 3-letter currency code for the currency used by this purchase record. + */ + @JsonProperty(value = "currencyCode") + private String currencyCode; + + /* + * The amount property. + */ + @JsonProperty(value = "amount") + private Float amount; + + /** Creates an instance of CalculatePriceResponsePropertiesPricingCurrencyTotal class. */ + public CalculatePriceResponsePropertiesPricingCurrencyTotal() { + } + + /** + * Get the currencyCode property: The ISO 4217 3-letter currency code for the currency used by this purchase record. + * + * @return the currencyCode value. + */ + public String currencyCode() { + return this.currencyCode; + } + + /** + * Set the currencyCode property: The ISO 4217 3-letter currency code for the currency used by this purchase record. + * + * @param currencyCode the currencyCode value to set. + * @return the CalculatePriceResponsePropertiesPricingCurrencyTotal object itself. + */ + public CalculatePriceResponsePropertiesPricingCurrencyTotal withCurrencyCode(String currencyCode) { + this.currencyCode = currencyCode; + return this; + } + + /** + * Get the amount property: The amount property. + * + * @return the amount value. + */ + public Float amount() { + return this.amount; + } + + /** + * Set the amount property: The amount property. + * + * @param amount the amount value to set. + * @return the CalculatePriceResponsePropertiesPricingCurrencyTotal object itself. + */ + public CalculatePriceResponsePropertiesPricingCurrencyTotal withAmount(Float amount) { + this.amount = amount; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateRefundRequest.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateRefundRequest.java new file mode 100644 index 0000000000000..f4ff49c4d5da1 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateRefundRequest.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Request containing information needed for calculating refund. */ +@Fluent +public final class CalculateRefundRequest { + /* + * Fully qualified identifier of the reservation order being returned + */ + @JsonProperty(value = "id") + private String id; + + /* + * Properties needed for calculate refund including the scope and the reservation to be returned. + */ + @JsonProperty(value = "properties") + private CalculateRefundRequestProperties properties; + + /** Creates an instance of CalculateRefundRequest class. */ + public CalculateRefundRequest() { + } + + /** + * Get the id property: Fully qualified identifier of the reservation order being returned. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Fully qualified identifier of the reservation order being returned. + * + * @param id the id value to set. + * @return the CalculateRefundRequest object itself. + */ + public CalculateRefundRequest withId(String id) { + this.id = id; + return this; + } + + /** + * Get the properties property: Properties needed for calculate refund including the scope and the reservation to be + * returned. + * + * @return the properties value. + */ + public CalculateRefundRequestProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties needed for calculate refund including the scope and the reservation to be + * returned. + * + * @param properties the properties value to set. + * @return the CalculateRefundRequest object itself. + */ + public CalculateRefundRequest withProperties(CalculateRefundRequestProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateRefundRequestProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateRefundRequestProperties.java new file mode 100644 index 0000000000000..d733e0b154f20 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateRefundRequestProperties.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties needed for calculate refund including the scope and the reservation to be returned. */ +@Fluent +public final class CalculateRefundRequestProperties { + /* + * The scope of the refund, e.g. Reservation + */ + @JsonProperty(value = "scope") + private String scope; + + /* + * Reservation to return + */ + @JsonProperty(value = "reservationToReturn") + private ReservationToReturn reservationToReturn; + + /** Creates an instance of CalculateRefundRequestProperties class. */ + public CalculateRefundRequestProperties() { + } + + /** + * Get the scope property: The scope of the refund, e.g. Reservation. + * + * @return the scope value. + */ + public String scope() { + return this.scope; + } + + /** + * Set the scope property: The scope of the refund, e.g. Reservation. + * + * @param scope the scope value to set. + * @return the CalculateRefundRequestProperties object itself. + */ + public CalculateRefundRequestProperties withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Get the reservationToReturn property: Reservation to return. + * + * @return the reservationToReturn value. + */ + public ReservationToReturn reservationToReturn() { + return this.reservationToReturn; + } + + /** + * Set the reservationToReturn property: Reservation to return. + * + * @param reservationToReturn the reservationToReturn value to set. + * @return the CalculateRefundRequestProperties object itself. + */ + public CalculateRefundRequestProperties withReservationToReturn(ReservationToReturn reservationToReturn) { + this.reservationToReturn = reservationToReturn; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (reservationToReturn() != null) { + reservationToReturn().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateRefundResponse.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateRefundResponse.java new file mode 100644 index 0000000000000..f80a57d1401a5 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateRefundResponse.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.resourcemanager.reservations.fluent.models.CalculateRefundResponseInner; + +/** An immutable client-side representation of CalculateRefundResponse. */ +public interface CalculateRefundResponse { + /** + * Gets the id property: Fully qualified identifier of the reservation being returned. + * + * @return the id value. + */ + String id(); + + /** + * Gets the properties property: The refund properties of reservation. + * + * @return the properties value. + */ + RefundResponseProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.reservations.fluent.models.CalculateRefundResponseInner object. + * + * @return the inner object. + */ + CalculateRefundResponseInner innerModel(); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateRefunds.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateRefunds.java new file mode 100644 index 0000000000000..5543414c2fbc4 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateRefunds.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of CalculateRefunds. */ +public interface CalculateRefunds { + /** + * Calculate the refund amount of a reservation order. + * + *

Calculate price for returning `Reservations` if there are no policy errors. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculating refund of a reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of calculate refund containing refund information of reservation along with {@link + * Response}. + */ + Response postWithResponse( + String reservationOrderId, CalculateRefundRequest body, Context context); + + /** + * Calculate the refund amount of a reservation order. + * + *

Calculate price for returning `Reservations` if there are no policy errors. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculating refund of a reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of calculate refund containing refund information of reservation. + */ + CalculateRefundResponse post(String reservationOrderId, CalculateRefundRequest body); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Catalog.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Catalog.java new file mode 100644 index 0000000000000..10034cb7a62bb --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Catalog.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.resourcemanager.reservations.fluent.models.CatalogInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of Catalog. */ +public interface Catalog { + /** + * Gets the resourceType property: The type of resource the sku applies to. + * + * @return the resourceType value. + */ + String resourceType(); + + /** + * Gets the name property: The name of sku. + * + * @return the name value. + */ + String name(); + + /** + * Gets the billingPlans property: The billing plan options available for this sku. + * + * @return the billingPlans value. + */ + Map> billingPlans(); + + /** + * Gets the terms property: Available reservation terms for this resource. + * + * @return the terms value. + */ + List terms(); + + /** + * Gets the locations property: The locations property. + * + * @return the locations value. + */ + List locations(); + + /** + * Gets the skuProperties property: The skuProperties property. + * + * @return the skuProperties value. + */ + List skuProperties(); + + /** + * Gets the msrp property: Pricing information about the sku. + * + * @return the msrp value. + */ + CatalogMsrp msrp(); + + /** + * Gets the restrictions property: The restrictions property. + * + * @return the restrictions value. + */ + List restrictions(); + + /** + * Gets the tier property: The tier of this sku. + * + * @return the tier value. + */ + String tier(); + + /** + * Gets the size property: The size of this sku. + * + * @return the size value. + */ + String size(); + + /** + * Gets the capabilities property: The capabilities property. + * + * @return the capabilities value. + */ + List capabilities(); + + /** + * Gets the inner com.azure.resourcemanager.reservations.fluent.models.CatalogInner object. + * + * @return the inner object. + */ + CatalogInner innerModel(); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CatalogMsrp.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CatalogMsrp.java new file mode 100644 index 0000000000000..ad52bd3c3b1ec --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CatalogMsrp.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Pricing information about the sku. */ +@Fluent +public final class CatalogMsrp { + /* + * Amount in pricing currency. Tax not included. + */ + @JsonProperty(value = "p1Y") + private Price p1Y; + + /** Creates an instance of CatalogMsrp class. */ + public CatalogMsrp() { + } + + /** + * Get the p1Y property: Amount in pricing currency. Tax not included. + * + * @return the p1Y value. + */ + public Price p1Y() { + return this.p1Y; + } + + /** + * Set the p1Y property: Amount in pricing currency. Tax not included. + * + * @param p1Y the p1Y value to set. + * @return the CatalogMsrp object itself. + */ + public CatalogMsrp withP1Y(Price p1Y) { + this.p1Y = p1Y; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (p1Y() != null) { + p1Y().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CatalogsResult.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CatalogsResult.java new file mode 100644 index 0000000000000..6cc55702e05d7 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CatalogsResult.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.fluent.models.CatalogInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of catalogs and pagination information. */ +@Fluent +public final class CatalogsResult { + /* + * The list of catalogs. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /* + * The total amount of catalog items. + */ + @JsonProperty(value = "totalItems") + private Long totalItems; + + /** Creates an instance of CatalogsResult class. */ + public CatalogsResult() { + } + + /** + * Get the value property: The list of catalogs. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the totalItems property: The total amount of catalog items. + * + * @return the totalItems value. + */ + public Long totalItems() { + return this.totalItems; + } + + /** + * Set the totalItems property: The total amount of catalog items. + * + * @param totalItems the totalItems value to set. + * @return the CatalogsResult object itself. + */ + public CatalogsResult withTotalItems(Long totalItems) { + this.totalItems = totalItems; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ChangeDirectoryRequest.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ChangeDirectoryRequest.java new file mode 100644 index 0000000000000..e037ffc5e27e6 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ChangeDirectoryRequest.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Request body for change directory of a reservation. */ +@Fluent +public final class ChangeDirectoryRequest { + /* + * Tenant id GUID that reservation order is to be transferred to + */ + @JsonProperty(value = "destinationTenantId") + private String destinationTenantId; + + /** Creates an instance of ChangeDirectoryRequest class. */ + public ChangeDirectoryRequest() { + } + + /** + * Get the destinationTenantId property: Tenant id GUID that reservation order is to be transferred to. + * + * @return the destinationTenantId value. + */ + public String destinationTenantId() { + return this.destinationTenantId; + } + + /** + * Set the destinationTenantId property: Tenant id GUID that reservation order is to be transferred to. + * + * @param destinationTenantId the destinationTenantId value to set. + * @return the ChangeDirectoryRequest object itself. + */ + public ChangeDirectoryRequest withDestinationTenantId(String destinationTenantId) { + this.destinationTenantId = destinationTenantId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ChangeDirectoryResponse.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ChangeDirectoryResponse.java new file mode 100644 index 0000000000000..15229fa5763d5 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ChangeDirectoryResponse.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.resourcemanager.reservations.fluent.models.ChangeDirectoryResponseInner; +import java.util.List; + +/** An immutable client-side representation of ChangeDirectoryResponse. */ +public interface ChangeDirectoryResponse { + /** + * Gets the reservationOrder property: Change directory result for reservation order or reservation. + * + * @return the reservationOrder value. + */ + ChangeDirectoryResult reservationOrder(); + + /** + * Gets the reservations property: The reservations property. + * + * @return the reservations value. + */ + List reservations(); + + /** + * Gets the inner com.azure.resourcemanager.reservations.fluent.models.ChangeDirectoryResponseInner object. + * + * @return the inner object. + */ + ChangeDirectoryResponseInner innerModel(); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ChangeDirectoryResult.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ChangeDirectoryResult.java new file mode 100644 index 0000000000000..00d7ba476ae8c --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ChangeDirectoryResult.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Change directory result for reservation order or reservation. */ +@Fluent +public final class ChangeDirectoryResult { + /* + * Identifier of the reservation order or reservation + */ + @JsonProperty(value = "id") + private String id; + + /* + * Name of the reservation order or reservation + */ + @JsonProperty(value = "name") + private String name; + + /* + * True if change directory operation succeeded on this reservation order or reservation + */ + @JsonProperty(value = "isSucceeded") + private Boolean isSucceeded; + + /* + * Error reason if operation failed. Null otherwise + */ + @JsonProperty(value = "error") + private String error; + + /** Creates an instance of ChangeDirectoryResult class. */ + public ChangeDirectoryResult() { + } + + /** + * Get the id property: Identifier of the reservation order or reservation. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Identifier of the reservation order or reservation. + * + * @param id the id value to set. + * @return the ChangeDirectoryResult object itself. + */ + public ChangeDirectoryResult withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: Name of the reservation order or reservation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the reservation order or reservation. + * + * @param name the name value to set. + * @return the ChangeDirectoryResult object itself. + */ + public ChangeDirectoryResult withName(String name) { + this.name = name; + return this; + } + + /** + * Get the isSucceeded property: True if change directory operation succeeded on this reservation order or + * reservation. + * + * @return the isSucceeded value. + */ + public Boolean isSucceeded() { + return this.isSucceeded; + } + + /** + * Set the isSucceeded property: True if change directory operation succeeded on this reservation order or + * reservation. + * + * @param isSucceeded the isSucceeded value to set. + * @return the ChangeDirectoryResult object itself. + */ + public ChangeDirectoryResult withIsSucceeded(Boolean isSucceeded) { + this.isSucceeded = isSucceeded; + return this; + } + + /** + * Get the error property: Error reason if operation failed. Null otherwise. + * + * @return the error value. + */ + public String error() { + return this.error; + } + + /** + * Set the error property: Error reason if operation failed. Null otherwise. + * + * @param error the error value to set. + * @return the ChangeDirectoryResult object itself. + */ + public ChangeDirectoryResult withError(String error) { + this.error = error; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Commitment.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Commitment.java new file mode 100644 index 0000000000000..712e6901641f1 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Commitment.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Commitment towards the benefit. */ +@Fluent +public final class Commitment extends Price { + /* + * Commitment grain. + */ + @JsonProperty(value = "grain") + private CommitmentGrain grain; + + /** Creates an instance of Commitment class. */ + public Commitment() { + } + + /** + * Get the grain property: Commitment grain. + * + * @return the grain value. + */ + public CommitmentGrain grain() { + return this.grain; + } + + /** + * Set the grain property: Commitment grain. + * + * @param grain the grain value to set. + * @return the Commitment object itself. + */ + public Commitment withGrain(CommitmentGrain grain) { + this.grain = grain; + return this; + } + + /** {@inheritDoc} */ + @Override + public Commitment withCurrencyCode(String currencyCode) { + super.withCurrencyCode(currencyCode); + return this; + } + + /** {@inheritDoc} */ + @Override + public Commitment withAmount(Double amount) { + super.withAmount(amount); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CommitmentGrain.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CommitmentGrain.java new file mode 100644 index 0000000000000..ebd8c04cad091 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CommitmentGrain.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Commitment grain. */ +public final class CommitmentGrain extends ExpandableStringEnum { + /** Static value Hourly for CommitmentGrain. */ + public static final CommitmentGrain HOURLY = fromString("Hourly"); + + /** + * Creates a new instance of CommitmentGrain value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CommitmentGrain() { + } + + /** + * Creates or finds a CommitmentGrain from its string representation. + * + * @param name a name to look for. + * @return the corresponding CommitmentGrain. + */ + @JsonCreator + public static CommitmentGrain fromString(String name) { + return fromString(name, CommitmentGrain.class); + } + + /** + * Gets known CommitmentGrain values. + * + * @return known CommitmentGrain values. + */ + public static Collection values() { + return values(CommitmentGrain.class); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CurrentQuotaLimitBase.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CurrentQuotaLimitBase.java new file mode 100644 index 0000000000000..17cc5728bba7e --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CurrentQuotaLimitBase.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.reservations.fluent.models.CurrentQuotaLimitBaseInner; + +/** An immutable client-side representation of CurrentQuotaLimitBase. */ +public interface CurrentQuotaLimitBase { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: Quota properties for the resource. + * + * @return the properties value. + */ + QuotaProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.reservations.fluent.models.CurrentQuotaLimitBaseInner object. + * + * @return the inner object. + */ + CurrentQuotaLimitBaseInner innerModel(); + + /** The entirety of the CurrentQuotaLimitBase definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The CurrentQuotaLimitBase definition stages. */ + interface DefinitionStages { + /** The first stage of the CurrentQuotaLimitBase definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the CurrentQuotaLimitBase definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies subscriptionId, providerId, location. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @return the next definition stage. + */ + WithCreate withExistingLocation(String subscriptionId, String providerId, String location); + } + /** + * The stage of the CurrentQuotaLimitBase definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + CurrentQuotaLimitBase create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CurrentQuotaLimitBase create(Context context); + } + /** The stage of the CurrentQuotaLimitBase definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Quota properties for the resource.. + * + * @param properties Quota properties for the resource. + * @return the next definition stage. + */ + WithCreate withProperties(QuotaProperties properties); + } + } + /** + * Begins update for the CurrentQuotaLimitBase resource. + * + * @return the stage of resource update. + */ + CurrentQuotaLimitBase.Update update(); + + /** The template for CurrentQuotaLimitBase update. */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CurrentQuotaLimitBase apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CurrentQuotaLimitBase apply(Context context); + } + /** The CurrentQuotaLimitBase update stages. */ + interface UpdateStages { + /** The stage of the CurrentQuotaLimitBase update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Quota properties for the resource.. + * + * @param properties Quota properties for the resource. + * @return the next definition stage. + */ + Update withProperties(QuotaProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CurrentQuotaLimitBase refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CurrentQuotaLimitBase refresh(Context context); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ErrorResponseCode.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ErrorResponseCode.java new file mode 100644 index 0000000000000..b4a9291a55eba --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ErrorResponseCode.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Error code describing the reason that service is not able to process the incoming request. */ +public final class ErrorResponseCode extends ExpandableStringEnum { + /** Static value NotSpecified for ErrorResponseCode. */ + public static final ErrorResponseCode NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value InternalServerError for ErrorResponseCode. */ + public static final ErrorResponseCode INTERNAL_SERVER_ERROR = fromString("InternalServerError"); + + /** Static value ServerTimeout for ErrorResponseCode. */ + public static final ErrorResponseCode SERVER_TIMEOUT = fromString("ServerTimeout"); + + /** Static value AuthorizationFailed for ErrorResponseCode. */ + public static final ErrorResponseCode AUTHORIZATION_FAILED = fromString("AuthorizationFailed"); + + /** Static value BadRequest for ErrorResponseCode. */ + public static final ErrorResponseCode BAD_REQUEST = fromString("BadRequest"); + + /** Static value ClientCertificateThumbprintNotSet for ErrorResponseCode. */ + public static final ErrorResponseCode CLIENT_CERTIFICATE_THUMBPRINT_NOT_SET = + fromString("ClientCertificateThumbprintNotSet"); + + /** Static value InvalidRequestContent for ErrorResponseCode. */ + public static final ErrorResponseCode INVALID_REQUEST_CONTENT = fromString("InvalidRequestContent"); + + /** Static value OperationFailed for ErrorResponseCode. */ + public static final ErrorResponseCode OPERATION_FAILED = fromString("OperationFailed"); + + /** Static value HttpMethodNotSupported for ErrorResponseCode. */ + public static final ErrorResponseCode HTTP_METHOD_NOT_SUPPORTED = fromString("HttpMethodNotSupported"); + + /** Static value InvalidRequestUri for ErrorResponseCode. */ + public static final ErrorResponseCode INVALID_REQUEST_URI = fromString("InvalidRequestUri"); + + /** Static value MissingTenantId for ErrorResponseCode. */ + public static final ErrorResponseCode MISSING_TENANT_ID = fromString("MissingTenantId"); + + /** Static value InvalidTenantId for ErrorResponseCode. */ + public static final ErrorResponseCode INVALID_TENANT_ID = fromString("InvalidTenantId"); + + /** Static value InvalidReservationOrderId for ErrorResponseCode. */ + public static final ErrorResponseCode INVALID_RESERVATION_ORDER_ID = fromString("InvalidReservationOrderId"); + + /** Static value InvalidReservationId for ErrorResponseCode. */ + public static final ErrorResponseCode INVALID_RESERVATION_ID = fromString("InvalidReservationId"); + + /** Static value ReservationIdNotInReservationOrder for ErrorResponseCode. */ + public static final ErrorResponseCode RESERVATION_ID_NOT_IN_RESERVATION_ORDER = + fromString("ReservationIdNotInReservationOrder"); + + /** Static value ReservationOrderNotFound for ErrorResponseCode. */ + public static final ErrorResponseCode RESERVATION_ORDER_NOT_FOUND = fromString("ReservationOrderNotFound"); + + /** Static value InvalidSubscriptionId for ErrorResponseCode. */ + public static final ErrorResponseCode INVALID_SUBSCRIPTION_ID = fromString("InvalidSubscriptionId"); + + /** Static value InvalidAccessToken for ErrorResponseCode. */ + public static final ErrorResponseCode INVALID_ACCESS_TOKEN = fromString("InvalidAccessToken"); + + /** Static value InvalidLocationId for ErrorResponseCode. */ + public static final ErrorResponseCode INVALID_LOCATION_ID = fromString("InvalidLocationId"); + + /** Static value UnauthenticatedRequestsThrottled for ErrorResponseCode. */ + public static final ErrorResponseCode UNAUTHENTICATED_REQUESTS_THROTTLED = + fromString("UnauthenticatedRequestsThrottled"); + + /** Static value InvalidHealthCheckType for ErrorResponseCode. */ + public static final ErrorResponseCode INVALID_HEALTH_CHECK_TYPE = fromString("InvalidHealthCheckType"); + + /** Static value Forbidden for ErrorResponseCode. */ + public static final ErrorResponseCode FORBIDDEN = fromString("Forbidden"); + + /** Static value BillingScopeIdCannotBeChanged for ErrorResponseCode. */ + public static final ErrorResponseCode BILLING_SCOPE_ID_CANNOT_BE_CHANGED = + fromString("BillingScopeIdCannotBeChanged"); + + /** Static value AppliedScopesNotAssociatedWithCommerceAccount for ErrorResponseCode. */ + public static final ErrorResponseCode APPLIED_SCOPES_NOT_ASSOCIATED_WITH_COMMERCE_ACCOUNT = + fromString("AppliedScopesNotAssociatedWithCommerceAccount"); + + /** Static value PatchValuesSameAsExisting for ErrorResponseCode. */ + public static final ErrorResponseCode PATCH_VALUES_SAME_AS_EXISTING = fromString("PatchValuesSameAsExisting"); + + /** Static value RoleAssignmentCreationFailed for ErrorResponseCode. */ + public static final ErrorResponseCode ROLE_ASSIGNMENT_CREATION_FAILED = fromString("RoleAssignmentCreationFailed"); + + /** Static value ReservationOrderCreationFailed for ErrorResponseCode. */ + public static final ErrorResponseCode RESERVATION_ORDER_CREATION_FAILED = + fromString("ReservationOrderCreationFailed"); + + /** Static value ReservationOrderNotEnabled for ErrorResponseCode. */ + public static final ErrorResponseCode RESERVATION_ORDER_NOT_ENABLED = fromString("ReservationOrderNotEnabled"); + + /** Static value CapacityUpdateScopesFailed for ErrorResponseCode. */ + public static final ErrorResponseCode CAPACITY_UPDATE_SCOPES_FAILED = fromString("CapacityUpdateScopesFailed"); + + /** Static value UnsupportedReservationTerm for ErrorResponseCode. */ + public static final ErrorResponseCode UNSUPPORTED_RESERVATION_TERM = fromString("UnsupportedReservationTerm"); + + /** Static value ReservationOrderIdAlreadyExists for ErrorResponseCode. */ + public static final ErrorResponseCode RESERVATION_ORDER_ID_ALREADY_EXISTS = + fromString("ReservationOrderIdAlreadyExists"); + + /** Static value RiskCheckFailed for ErrorResponseCode. */ + public static final ErrorResponseCode RISK_CHECK_FAILED = fromString("RiskCheckFailed"); + + /** Static value CreateQuoteFailed for ErrorResponseCode. */ + public static final ErrorResponseCode CREATE_QUOTE_FAILED = fromString("CreateQuoteFailed"); + + /** Static value ActivateQuoteFailed for ErrorResponseCode. */ + public static final ErrorResponseCode ACTIVATE_QUOTE_FAILED = fromString("ActivateQuoteFailed"); + + /** Static value NonsupportedAccountId for ErrorResponseCode. */ + public static final ErrorResponseCode NONSUPPORTED_ACCOUNT_ID = fromString("NonsupportedAccountId"); + + /** Static value PaymentInstrumentNotFound for ErrorResponseCode. */ + public static final ErrorResponseCode PAYMENT_INSTRUMENT_NOT_FOUND = fromString("PaymentInstrumentNotFound"); + + /** Static value MissingAppliedScopesForSingle for ErrorResponseCode. */ + public static final ErrorResponseCode MISSING_APPLIED_SCOPES_FOR_SINGLE = + fromString("MissingAppliedScopesForSingle"); + + /** Static value NoValidReservationsToReRate for ErrorResponseCode. */ + public static final ErrorResponseCode NO_VALID_RESERVATIONS_TO_RE_RATE = fromString("NoValidReservationsToReRate"); + + /** Static value ReRateOnlyAllowedForEA for ErrorResponseCode. */ + public static final ErrorResponseCode RE_RATE_ONLY_ALLOWED_FOR_EA = fromString("ReRateOnlyAllowedForEA"); + + /** Static value OperationCannotBePerformedInCurrentState for ErrorResponseCode. */ + public static final ErrorResponseCode OPERATION_CANNOT_BE_PERFORMED_IN_CURRENT_STATE = + fromString("OperationCannotBePerformedInCurrentState"); + + /** Static value InvalidSingleAppliedScopesCount for ErrorResponseCode. */ + public static final ErrorResponseCode INVALID_SINGLE_APPLIED_SCOPES_COUNT = + fromString("InvalidSingleAppliedScopesCount"); + + /** Static value InvalidFulfillmentRequestParameters for ErrorResponseCode. */ + public static final ErrorResponseCode INVALID_FULFILLMENT_REQUEST_PARAMETERS = + fromString("InvalidFulfillmentRequestParameters"); + + /** Static value NotSupportedCountry for ErrorResponseCode. */ + public static final ErrorResponseCode NOT_SUPPORTED_COUNTRY = fromString("NotSupportedCountry"); + + /** Static value InvalidRefundQuantity for ErrorResponseCode. */ + public static final ErrorResponseCode INVALID_REFUND_QUANTITY = fromString("InvalidRefundQuantity"); + + /** Static value PurchaseError for ErrorResponseCode. */ + public static final ErrorResponseCode PURCHASE_ERROR = fromString("PurchaseError"); + + /** Static value BillingCustomerInputError for ErrorResponseCode. */ + public static final ErrorResponseCode BILLING_CUSTOMER_INPUT_ERROR = fromString("BillingCustomerInputError"); + + /** Static value BillingPaymentInstrumentSoftError for ErrorResponseCode. */ + public static final ErrorResponseCode BILLING_PAYMENT_INSTRUMENT_SOFT_ERROR = + fromString("BillingPaymentInstrumentSoftError"); + + /** Static value BillingPaymentInstrumentHardError for ErrorResponseCode. */ + public static final ErrorResponseCode BILLING_PAYMENT_INSTRUMENT_HARD_ERROR = + fromString("BillingPaymentInstrumentHardError"); + + /** Static value BillingTransientError for ErrorResponseCode. */ + public static final ErrorResponseCode BILLING_TRANSIENT_ERROR = fromString("BillingTransientError"); + + /** Static value BillingError for ErrorResponseCode. */ + public static final ErrorResponseCode BILLING_ERROR = fromString("BillingError"); + + /** Static value FulfillmentConfigurationError for ErrorResponseCode. */ + public static final ErrorResponseCode FULFILLMENT_CONFIGURATION_ERROR = fromString("FulfillmentConfigurationError"); + + /** Static value FulfillmentOutOfStockError for ErrorResponseCode. */ + public static final ErrorResponseCode FULFILLMENT_OUT_OF_STOCK_ERROR = fromString("FulfillmentOutOfStockError"); + + /** Static value FulfillmentTransientError for ErrorResponseCode. */ + public static final ErrorResponseCode FULFILLMENT_TRANSIENT_ERROR = fromString("FulfillmentTransientError"); + + /** Static value FulfillmentError for ErrorResponseCode. */ + public static final ErrorResponseCode FULFILLMENT_ERROR = fromString("FulfillmentError"); + + /** Static value CalculatePriceFailed for ErrorResponseCode. */ + public static final ErrorResponseCode CALCULATE_PRICE_FAILED = fromString("CalculatePriceFailed"); + + /** Static value AppliedScopesSameAsExisting for ErrorResponseCode. */ + public static final ErrorResponseCode APPLIED_SCOPES_SAME_AS_EXISTING = fromString("AppliedScopesSameAsExisting"); + + /** Static value SelfServiceRefundNotSupported for ErrorResponseCode. */ + public static final ErrorResponseCode SELF_SERVICE_REFUND_NOT_SUPPORTED = + fromString("SelfServiceRefundNotSupported"); + + /** Static value RefundLimitExceeded for ErrorResponseCode. */ + public static final ErrorResponseCode REFUND_LIMIT_EXCEEDED = fromString("RefundLimitExceeded"); + + /** + * Creates a new instance of ErrorResponseCode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ErrorResponseCode() { + } + + /** + * Creates or finds a ErrorResponseCode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ErrorResponseCode. + */ + @JsonCreator + public static ErrorResponseCode fromString(String name) { + return fromString(name, ErrorResponseCode.class); + } + + /** + * Gets known ErrorResponseCode values. + * + * @return known ErrorResponseCode values. + */ + public static Collection values() { + return values(ErrorResponseCode.class); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeOperationResultResponse.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeOperationResultResponse.java new file mode 100644 index 0000000000000..0c595a60876fe --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeOperationResultResponse.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.resourcemanager.reservations.fluent.models.ExchangeOperationResultResponseInner; + +/** An immutable client-side representation of ExchangeOperationResultResponse. */ +public interface ExchangeOperationResultResponse { + /** + * Gets the id property: It should match what is used to GET the operation result. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: It must match the last segment of the id field, and will typically be a GUID / system + * generated value. + * + * @return the name value. + */ + String name(); + + /** + * Gets the status property: Status of the operation. + * + * @return the status value. + */ + ExchangeOperationResultStatus status(); + + /** + * Gets the properties property: Exchange response properties. + * + * @return the properties value. + */ + ExchangeResponseProperties properties(); + + /** + * Gets the error property: Required if status == failed or status == canceled. + * + * @return the error value. + */ + OperationResultError error(); + + /** + * Gets the inner com.azure.resourcemanager.reservations.fluent.models.ExchangeOperationResultResponseInner object. + * + * @return the inner object. + */ + ExchangeOperationResultResponseInner innerModel(); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeOperationResultStatus.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeOperationResultStatus.java new file mode 100644 index 0000000000000..d6d7ca21be311 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeOperationResultStatus.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Status of the operation. */ +public final class ExchangeOperationResultStatus extends ExpandableStringEnum { + /** Static value Succeeded for ExchangeOperationResultStatus. */ + public static final ExchangeOperationResultStatus SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ExchangeOperationResultStatus. */ + public static final ExchangeOperationResultStatus FAILED = fromString("Failed"); + + /** Static value Cancelled for ExchangeOperationResultStatus. */ + public static final ExchangeOperationResultStatus CANCELLED = fromString("Cancelled"); + + /** Static value PendingRefunds for ExchangeOperationResultStatus. */ + public static final ExchangeOperationResultStatus PENDING_REFUNDS = fromString("PendingRefunds"); + + /** Static value PendingPurchases for ExchangeOperationResultStatus. */ + public static final ExchangeOperationResultStatus PENDING_PURCHASES = fromString("PendingPurchases"); + + /** + * Creates a new instance of ExchangeOperationResultStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ExchangeOperationResultStatus() { + } + + /** + * Creates or finds a ExchangeOperationResultStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ExchangeOperationResultStatus. + */ + @JsonCreator + public static ExchangeOperationResultStatus fromString(String name) { + return fromString(name, ExchangeOperationResultStatus.class); + } + + /** + * Gets known ExchangeOperationResultStatus values. + * + * @return known ExchangeOperationResultStatus values. + */ + public static Collection values() { + return values(ExchangeOperationResultStatus.class); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangePolicyError.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangePolicyError.java new file mode 100644 index 0000000000000..e7a864934b2db --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangePolicyError.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** error details. */ +@Fluent +public final class ExchangePolicyError { + /* + * The code property. + */ + @JsonProperty(value = "code") + private String code; + + /* + * The message property. + */ + @JsonProperty(value = "message") + private String message; + + /** Creates an instance of ExchangePolicyError class. */ + public ExchangePolicyError() { + } + + /** + * Get the code property: The code property. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: The code property. + * + * @param code the code value to set. + * @return the ExchangePolicyError object itself. + */ + public ExchangePolicyError withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message property: The message property. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The message property. + * + * @param message the message value to set. + * @return the ExchangePolicyError object itself. + */ + public ExchangePolicyError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangePolicyErrors.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangePolicyErrors.java new file mode 100644 index 0000000000000..debaa165e502d --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangePolicyErrors.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Exchange policy errors. */ +@Fluent +public final class ExchangePolicyErrors { + /* + * Exchange Policy errors + */ + @JsonProperty(value = "policyErrors") + private List policyErrors; + + /** Creates an instance of ExchangePolicyErrors class. */ + public ExchangePolicyErrors() { + } + + /** + * Get the policyErrors property: Exchange Policy errors. + * + * @return the policyErrors value. + */ + public List policyErrors() { + return this.policyErrors; + } + + /** + * Set the policyErrors property: Exchange Policy errors. + * + * @param policyErrors the policyErrors value to set. + * @return the ExchangePolicyErrors object itself. + */ + public ExchangePolicyErrors withPolicyErrors(List policyErrors) { + this.policyErrors = policyErrors; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (policyErrors() != null) { + policyErrors().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeRequest.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeRequest.java new file mode 100644 index 0000000000000..75aa570b93581 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeRequest.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Exchange request. */ +@Fluent +public final class ExchangeRequest { + /* + * Exchange request properties + */ + @JsonProperty(value = "properties") + private ExchangeRequestProperties properties; + + /** Creates an instance of ExchangeRequest class. */ + public ExchangeRequest() { + } + + /** + * Get the properties property: Exchange request properties. + * + * @return the properties value. + */ + public ExchangeRequestProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Exchange request properties. + * + * @param properties the properties value to set. + * @return the ExchangeRequest object itself. + */ + public ExchangeRequest withProperties(ExchangeRequestProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeRequestProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeRequestProperties.java new file mode 100644 index 0000000000000..0c5a983efd05f --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeRequestProperties.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Exchange request properties. */ +@Fluent +public final class ExchangeRequestProperties { + /* + * SessionId that was returned by CalculateExchange API. + */ + @JsonProperty(value = "sessionId") + private String sessionId; + + /** Creates an instance of ExchangeRequestProperties class. */ + public ExchangeRequestProperties() { + } + + /** + * Get the sessionId property: SessionId that was returned by CalculateExchange API. + * + * @return the sessionId value. + */ + public String sessionId() { + return this.sessionId; + } + + /** + * Set the sessionId property: SessionId that was returned by CalculateExchange API. + * + * @param sessionId the sessionId value to set. + * @return the ExchangeRequestProperties object itself. + */ + public ExchangeRequestProperties withSessionId(String sessionId) { + this.sessionId = sessionId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeResponseProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeResponseProperties.java new file mode 100644 index 0000000000000..ba878a0a8de23 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeResponseProperties.java @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Exchange response properties. */ +@Fluent +public final class ExchangeResponseProperties { + /* + * Exchange session identifier + */ + @JsonProperty(value = "sessionId") + private String sessionId; + + /* + * Pricing information containing the amount and the currency code + */ + @JsonProperty(value = "netPayable") + private Price netPayable; + + /* + * Pricing information containing the amount and the currency code + */ + @JsonProperty(value = "refundsTotal") + private Price refundsTotal; + + /* + * Pricing information containing the amount and the currency code + */ + @JsonProperty(value = "purchasesTotal") + private Price purchasesTotal; + + /* + * Details of the reservations being purchased + */ + @JsonProperty(value = "reservationsToPurchase") + private List reservationsToPurchase; + + /* + * Details of the savings plans being purchased + */ + @JsonProperty(value = "savingsPlansToPurchase") + private List savingsPlansToPurchase; + + /* + * Details of the reservations being returned + */ + @JsonProperty(value = "reservationsToExchange") + private List reservationsToExchange; + + /* + * Exchange policy errors + */ + @JsonProperty(value = "policyResult") + private ExchangePolicyErrors policyResult; + + /** Creates an instance of ExchangeResponseProperties class. */ + public ExchangeResponseProperties() { + } + + /** + * Get the sessionId property: Exchange session identifier. + * + * @return the sessionId value. + */ + public String sessionId() { + return this.sessionId; + } + + /** + * Set the sessionId property: Exchange session identifier. + * + * @param sessionId the sessionId value to set. + * @return the ExchangeResponseProperties object itself. + */ + public ExchangeResponseProperties withSessionId(String sessionId) { + this.sessionId = sessionId; + return this; + } + + /** + * Get the netPayable property: Pricing information containing the amount and the currency code. + * + * @return the netPayable value. + */ + public Price netPayable() { + return this.netPayable; + } + + /** + * Set the netPayable property: Pricing information containing the amount and the currency code. + * + * @param netPayable the netPayable value to set. + * @return the ExchangeResponseProperties object itself. + */ + public ExchangeResponseProperties withNetPayable(Price netPayable) { + this.netPayable = netPayable; + return this; + } + + /** + * Get the refundsTotal property: Pricing information containing the amount and the currency code. + * + * @return the refundsTotal value. + */ + public Price refundsTotal() { + return this.refundsTotal; + } + + /** + * Set the refundsTotal property: Pricing information containing the amount and the currency code. + * + * @param refundsTotal the refundsTotal value to set. + * @return the ExchangeResponseProperties object itself. + */ + public ExchangeResponseProperties withRefundsTotal(Price refundsTotal) { + this.refundsTotal = refundsTotal; + return this; + } + + /** + * Get the purchasesTotal property: Pricing information containing the amount and the currency code. + * + * @return the purchasesTotal value. + */ + public Price purchasesTotal() { + return this.purchasesTotal; + } + + /** + * Set the purchasesTotal property: Pricing information containing the amount and the currency code. + * + * @param purchasesTotal the purchasesTotal value to set. + * @return the ExchangeResponseProperties object itself. + */ + public ExchangeResponseProperties withPurchasesTotal(Price purchasesTotal) { + this.purchasesTotal = purchasesTotal; + return this; + } + + /** + * Get the reservationsToPurchase property: Details of the reservations being purchased. + * + * @return the reservationsToPurchase value. + */ + public List reservationsToPurchase() { + return this.reservationsToPurchase; + } + + /** + * Set the reservationsToPurchase property: Details of the reservations being purchased. + * + * @param reservationsToPurchase the reservationsToPurchase value to set. + * @return the ExchangeResponseProperties object itself. + */ + public ExchangeResponseProperties withReservationsToPurchase( + List reservationsToPurchase) { + this.reservationsToPurchase = reservationsToPurchase; + return this; + } + + /** + * Get the savingsPlansToPurchase property: Details of the savings plans being purchased. + * + * @return the savingsPlansToPurchase value. + */ + public List savingsPlansToPurchase() { + return this.savingsPlansToPurchase; + } + + /** + * Set the savingsPlansToPurchase property: Details of the savings plans being purchased. + * + * @param savingsPlansToPurchase the savingsPlansToPurchase value to set. + * @return the ExchangeResponseProperties object itself. + */ + public ExchangeResponseProperties withSavingsPlansToPurchase( + List savingsPlansToPurchase) { + this.savingsPlansToPurchase = savingsPlansToPurchase; + return this; + } + + /** + * Get the reservationsToExchange property: Details of the reservations being returned. + * + * @return the reservationsToExchange value. + */ + public List reservationsToExchange() { + return this.reservationsToExchange; + } + + /** + * Set the reservationsToExchange property: Details of the reservations being returned. + * + * @param reservationsToExchange the reservationsToExchange value to set. + * @return the ExchangeResponseProperties object itself. + */ + public ExchangeResponseProperties withReservationsToExchange( + List reservationsToExchange) { + this.reservationsToExchange = reservationsToExchange; + return this; + } + + /** + * Get the policyResult property: Exchange policy errors. + * + * @return the policyResult value. + */ + public ExchangePolicyErrors policyResult() { + return this.policyResult; + } + + /** + * Set the policyResult property: Exchange policy errors. + * + * @param policyResult the policyResult value to set. + * @return the ExchangeResponseProperties object itself. + */ + public ExchangeResponseProperties withPolicyResult(ExchangePolicyErrors policyResult) { + this.policyResult = policyResult; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (netPayable() != null) { + netPayable().validate(); + } + if (refundsTotal() != null) { + refundsTotal().validate(); + } + if (purchasesTotal() != null) { + purchasesTotal().validate(); + } + if (reservationsToPurchase() != null) { + reservationsToPurchase().forEach(e -> e.validate()); + } + if (savingsPlansToPurchase() != null) { + savingsPlansToPurchase().forEach(e -> e.validate()); + } + if (reservationsToExchange() != null) { + reservationsToExchange().forEach(e -> e.validate()); + } + if (policyResult() != null) { + policyResult().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Exchanges.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Exchanges.java new file mode 100644 index 0000000000000..a583ea9b00b4f --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Exchanges.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.util.Context; + +/** Resource collection API of Exchanges. */ +public interface Exchanges { + /** + * Exchange Reservation(s) + * + *

Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + * + * @param body Request containing the refunds and purchases that need to be executed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return exchange operation result. + */ + ExchangeOperationResultResponse post(ExchangeRequest body); + + /** + * Exchange Reservation(s) + * + *

Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + * + * @param body Request containing the refunds and purchases that need to be executed. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return exchange operation result. + */ + ExchangeOperationResultResponse post(ExchangeRequest body, Context context); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExtendedStatusInfo.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExtendedStatusInfo.java new file mode 100644 index 0000000000000..0b4f77930e7cb --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExtendedStatusInfo.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ExtendedStatusInfo model. */ +@Fluent +public final class ExtendedStatusInfo { + /* + * The statusCode property. + */ + @JsonProperty(value = "statusCode") + private ReservationStatusCode statusCode; + + /* + * The message giving detailed information about the status code. + */ + @JsonProperty(value = "message") + private String message; + + /** Creates an instance of ExtendedStatusInfo class. */ + public ExtendedStatusInfo() { + } + + /** + * Get the statusCode property: The statusCode property. + * + * @return the statusCode value. + */ + public ReservationStatusCode statusCode() { + return this.statusCode; + } + + /** + * Set the statusCode property: The statusCode property. + * + * @param statusCode the statusCode value to set. + * @return the ExtendedStatusInfo object itself. + */ + public ExtendedStatusInfo withStatusCode(ReservationStatusCode statusCode) { + this.statusCode = statusCode; + return this; + } + + /** + * Get the message property: The message giving detailed information about the status code. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The message giving detailed information about the status code. + * + * @param message the message value to set. + * @return the ExtendedStatusInfo object itself. + */ + public ExtendedStatusInfo withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/InstanceFlexibility.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/InstanceFlexibility.java new file mode 100644 index 0000000000000..2cfa50bf8223a --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/InstanceFlexibility.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Turning this on will apply the reservation discount to other VMs in the same VM size group. Only specify for + * VirtualMachines reserved resource type. + */ +public final class InstanceFlexibility extends ExpandableStringEnum { + /** Static value On for InstanceFlexibility. */ + public static final InstanceFlexibility ON = fromString("On"); + + /** Static value Off for InstanceFlexibility. */ + public static final InstanceFlexibility OFF = fromString("Off"); + + /** + * Creates a new instance of InstanceFlexibility value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public InstanceFlexibility() { + } + + /** + * Creates or finds a InstanceFlexibility from its string representation. + * + * @param name a name to look for. + * @return the corresponding InstanceFlexibility. + */ + @JsonCreator + public static InstanceFlexibility fromString(String name) { + return fromString(name, InstanceFlexibility.class); + } + + /** + * Gets known InstanceFlexibility values. + * + * @return known InstanceFlexibility values. + */ + public static Collection values() { + return values(InstanceFlexibility.class); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Kind.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Kind.java new file mode 100644 index 0000000000000..25c0d8aa887ae --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Kind.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Resource Provider type to be reserved. */ +public enum Kind { + /** Enum value Microsoft.Compute. */ + MICROSOFT_COMPUTE("Microsoft.Compute"); + + /** The actual serialized value for a Kind instance. */ + private final String value; + + Kind(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a Kind instance. + * + * @param value the serialized value to parse. + * @return the parsed Kind object, or null if unable to parse. + */ + @JsonCreator + public static Kind fromString(String value) { + if (value == null) { + return null; + } + Kind[] items = Kind.values(); + for (Kind item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/MergeRequest.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/MergeRequest.java new file mode 100644 index 0000000000000..be75932f84c33 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/MergeRequest.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.fluent.models.MergeProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The request for reservation merge. */ +@Fluent +public final class MergeRequest { + /* + * Properties for reservation merge + */ + @JsonProperty(value = "properties") + private MergeProperties innerProperties; + + /** Creates an instance of MergeRequest class. */ + public MergeRequest() { + } + + /** + * Get the innerProperties property: Properties for reservation merge. + * + * @return the innerProperties value. + */ + private MergeProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the sources property: Format of the resource id should be + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @return the sources value. + */ + public List sources() { + return this.innerProperties() == null ? null : this.innerProperties().sources(); + } + + /** + * Set the sources property: Format of the resource id should be + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @param sources the sources value to set. + * @return the MergeRequest object itself. + */ + public MergeRequest withSources(List sources) { + if (this.innerProperties() == null) { + this.innerProperties = new MergeProperties(); + } + this.innerProperties().withSources(sources); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationDisplay.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationDisplay.java new file mode 100644 index 0000000000000..a35c070c0b075 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Information about an operation. */ +@Fluent +public final class OperationDisplay { + /* + * The provider property. + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * The resource property. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * The operation property. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * The description property. + */ + @JsonProperty(value = "description") + private String description; + + /** Creates an instance of OperationDisplay class. */ + public OperationDisplay() { + } + + /** + * Get the provider property: The provider property. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: The provider property. + * + * @param provider the provider value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: The resource property. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: The resource property. + * + * @param resource the resource value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: The operation property. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: The operation property. + * + * @param operation the operation value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: The description property. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description property. + * + * @param description the description value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationList.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationList.java new file mode 100644 index 0000000000000..9e4fe21a77a3b --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.fluent.models.OperationResponseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Paginated list of operations. */ +@Fluent +public final class OperationList { + /* + * The value property. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Url to get the next page of items. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of OperationList class. */ + public OperationList() { + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the OperationList object itself. + */ + public OperationList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Url to get the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Url to get the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the OperationList object itself. + */ + public OperationList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationResponse.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationResponse.java new file mode 100644 index 0000000000000..d027569a000df --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationResponse.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.resourcemanager.reservations.fluent.models.OperationResponseInner; + +/** An immutable client-side representation of OperationResponse. */ +public interface OperationResponse { + /** + * Gets the name property: Name of the operation. + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Display of the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: Origin of the operation. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the properties property: Properties of the operation. + * + * @return the properties value. + */ + Object properties(); + + /** + * Gets the inner com.azure.resourcemanager.reservations.fluent.models.OperationResponseInner object. + * + * @return the inner object. + */ + OperationResponseInner innerModel(); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationResultError.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationResultError.java new file mode 100644 index 0000000000000..cbf5ee7cf5082 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationResultError.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Required if status == failed or status == canceled. */ +@Fluent +public final class OperationResultError { + /* + * Required if status == failed or status == cancelled. If status == failed, provide an invariant error code used + * for error troubleshooting, aggregation, and analysis. + */ + @JsonProperty(value = "code") + private String code; + + /* + * Required if status == failed. Localized. If status == failed, provide an actionable error message indicating + * what error occurred, and what the user can do to address the issue. + */ + @JsonProperty(value = "message") + private String message; + + /** Creates an instance of OperationResultError class. */ + public OperationResultError() { + } + + /** + * Get the code property: Required if status == failed or status == cancelled. If status == failed, provide an + * invariant error code used for error troubleshooting, aggregation, and analysis. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: Required if status == failed or status == cancelled. If status == failed, provide an + * invariant error code used for error troubleshooting, aggregation, and analysis. + * + * @param code the code value to set. + * @return the OperationResultError object itself. + */ + public OperationResultError withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message property: Required if status == failed. Localized. If status == failed, provide an actionable + * error message indicating what error occurred, and what the user can do to address the issue. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Required if status == failed. Localized. If status == failed, provide an actionable + * error message indicating what error occurred, and what the user can do to address the issue. + * + * @param message the message value to set. + * @return the OperationResultError object itself. + */ + public OperationResultError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationStatus.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationStatus.java new file mode 100644 index 0000000000000..42333ec664a50 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationStatus.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Status of the individual operation. */ +public final class OperationStatus extends ExpandableStringEnum { + /** Static value Succeeded for OperationStatus. */ + public static final OperationStatus SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for OperationStatus. */ + public static final OperationStatus FAILED = fromString("Failed"); + + /** Static value Cancelled for OperationStatus. */ + public static final OperationStatus CANCELLED = fromString("Cancelled"); + + /** Static value Pending for OperationStatus. */ + public static final OperationStatus PENDING = fromString("Pending"); + + /** + * Creates a new instance of OperationStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OperationStatus() { + } + + /** + * Creates or finds a OperationStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperationStatus. + */ + @JsonCreator + public static OperationStatus fromString(String name) { + return fromString(name, OperationStatus.class); + } + + /** + * Gets known OperationStatus values. + * + * @return known OperationStatus values. + */ + public static Collection values() { + return values(OperationStatus.class); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Operations.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Operations.java new file mode 100644 index 0000000000000..6f5370b0ed57a --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Get operations. + * + *

List all the operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paginated list of operations as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Get operations. + * + *

List all the operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paginated list of operations as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PatchModel.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PatchModel.java new file mode 100644 index 0000000000000..a05db42b72b2c --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PatchModel.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.fluent.models.PatchProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The request for reservation patch. */ +@Fluent +public final class PatchModel { + /* + * Properties for reservation patch + */ + @JsonProperty(value = "properties") + private PatchProperties innerProperties; + + /** Creates an instance of PatchModel class. */ + public PatchModel() { + } + + /** + * Get the innerProperties property: Properties for reservation patch. + * + * @return the innerProperties value. + */ + private PatchProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the appliedScopeType property: Type of the Applied Scope. + * + * @return the appliedScopeType value. + */ + public AppliedScopeType appliedScopeType() { + return this.innerProperties() == null ? null : this.innerProperties().appliedScopeType(); + } + + /** + * Set the appliedScopeType property: Type of the Applied Scope. + * + * @param appliedScopeType the appliedScopeType value to set. + * @return the PatchModel object itself. + */ + public PatchModel withAppliedScopeType(AppliedScopeType appliedScopeType) { + if (this.innerProperties() == null) { + this.innerProperties = new PatchProperties(); + } + this.innerProperties().withAppliedScopeType(appliedScopeType); + return this; + } + + /** + * Get the appliedScopes property: List of the subscriptions that the benefit will be applied. Do not specify if + * AppliedScopeType is Shared. + * + * @return the appliedScopes value. + */ + public List appliedScopes() { + return this.innerProperties() == null ? null : this.innerProperties().appliedScopes(); + } + + /** + * Set the appliedScopes property: List of the subscriptions that the benefit will be applied. Do not specify if + * AppliedScopeType is Shared. + * + * @param appliedScopes the appliedScopes value to set. + * @return the PatchModel object itself. + */ + public PatchModel withAppliedScopes(List appliedScopes) { + if (this.innerProperties() == null) { + this.innerProperties = new PatchProperties(); + } + this.innerProperties().withAppliedScopes(appliedScopes); + return this; + } + + /** + * Get the appliedScopeProperties property: Properties specific to applied scope type. Not required if not + * applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup. + * + * @return the appliedScopeProperties value. + */ + public AppliedScopeProperties appliedScopeProperties() { + return this.innerProperties() == null ? null : this.innerProperties().appliedScopeProperties(); + } + + /** + * Set the appliedScopeProperties property: Properties specific to applied scope type. Not required if not + * applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup. + * + * @param appliedScopeProperties the appliedScopeProperties value to set. + * @return the PatchModel object itself. + */ + public PatchModel withAppliedScopeProperties(AppliedScopeProperties appliedScopeProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new PatchProperties(); + } + this.innerProperties().withAppliedScopeProperties(appliedScopeProperties); + return this; + } + + /** + * Get the instanceFlexibility property: Turning this on will apply the reservation discount to other VMs in the + * same VM size group. Only specify for VirtualMachines reserved resource type. + * + * @return the instanceFlexibility value. + */ + public InstanceFlexibility instanceFlexibility() { + return this.innerProperties() == null ? null : this.innerProperties().instanceFlexibility(); + } + + /** + * Set the instanceFlexibility property: Turning this on will apply the reservation discount to other VMs in the + * same VM size group. Only specify for VirtualMachines reserved resource type. + * + * @param instanceFlexibility the instanceFlexibility value to set. + * @return the PatchModel object itself. + */ + public PatchModel withInstanceFlexibility(InstanceFlexibility instanceFlexibility) { + if (this.innerProperties() == null) { + this.innerProperties = new PatchProperties(); + } + this.innerProperties().withInstanceFlexibility(instanceFlexibility); + return this; + } + + /** + * Get the name property: Display name of the reservation. + * + * @return the name value. + */ + public String name() { + return this.innerProperties() == null ? null : this.innerProperties().name(); + } + + /** + * Set the name property: Display name of the reservation. + * + * @param name the name value to set. + * @return the PatchModel object itself. + */ + public PatchModel withName(String name) { + if (this.innerProperties() == null) { + this.innerProperties = new PatchProperties(); + } + this.innerProperties().withName(name); + return this; + } + + /** + * Get the renew property: Setting this to true will automatically purchase a new reservation on the expiration date + * time. + * + * @return the renew value. + */ + public Boolean renew() { + return this.innerProperties() == null ? null : this.innerProperties().renew(); + } + + /** + * Set the renew property: Setting this to true will automatically purchase a new reservation on the expiration date + * time. + * + * @param renew the renew value to set. + * @return the PatchModel object itself. + */ + public PatchModel withRenew(Boolean renew) { + if (this.innerProperties() == null) { + this.innerProperties = new PatchProperties(); + } + this.innerProperties().withRenew(renew); + return this; + } + + /** + * Get the renewProperties property: The renewProperties property. + * + * @return the renewProperties value. + */ + public PatchPropertiesRenewProperties renewProperties() { + return this.innerProperties() == null ? null : this.innerProperties().renewProperties(); + } + + /** + * Set the renewProperties property: The renewProperties property. + * + * @param renewProperties the renewProperties value to set. + * @return the PatchModel object itself. + */ + public PatchModel withRenewProperties(PatchPropertiesRenewProperties renewProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new PatchProperties(); + } + this.innerProperties().withRenewProperties(renewProperties); + return this; + } + + /** + * Get the reviewDateTime property: This is the date-time when the Azure hybrid benefit needs to be reviewed. + * + * @return the reviewDateTime value. + */ + public OffsetDateTime reviewDateTime() { + return this.innerProperties() == null ? null : this.innerProperties().reviewDateTime(); + } + + /** + * Set the reviewDateTime property: This is the date-time when the Azure hybrid benefit needs to be reviewed. + * + * @param reviewDateTime the reviewDateTime value to set. + * @return the PatchModel object itself. + */ + public PatchModel withReviewDateTime(OffsetDateTime reviewDateTime) { + if (this.innerProperties() == null) { + this.innerProperties = new PatchProperties(); + } + this.innerProperties().withReviewDateTime(reviewDateTime); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PatchPropertiesRenewProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PatchPropertiesRenewProperties.java new file mode 100644 index 0000000000000..5ef7a9b7645ca --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PatchPropertiesRenewProperties.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The PatchPropertiesRenewProperties model. */ +@Fluent +public final class PatchPropertiesRenewProperties { + /* + * The request for reservation purchase + */ + @JsonProperty(value = "purchaseProperties") + private PurchaseRequest purchaseProperties; + + /** Creates an instance of PatchPropertiesRenewProperties class. */ + public PatchPropertiesRenewProperties() { + } + + /** + * Get the purchaseProperties property: The request for reservation purchase. + * + * @return the purchaseProperties value. + */ + public PurchaseRequest purchaseProperties() { + return this.purchaseProperties; + } + + /** + * Set the purchaseProperties property: The request for reservation purchase. + * + * @param purchaseProperties the purchaseProperties value to set. + * @return the PatchPropertiesRenewProperties object itself. + */ + public PatchPropertiesRenewProperties withPurchaseProperties(PurchaseRequest purchaseProperties) { + this.purchaseProperties = purchaseProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (purchaseProperties() != null) { + purchaseProperties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PaymentDetail.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PaymentDetail.java new file mode 100644 index 0000000000000..faae6d3c8e390 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PaymentDetail.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.LocalDate; + +/** Information about payment related to a reservation order. */ +@Fluent +public final class PaymentDetail { + /* + * Date when the payment needs to be done. + */ + @JsonProperty(value = "dueDate") + private LocalDate dueDate; + + /* + * Date when the transaction is completed. Is null when it is scheduled. + */ + @JsonProperty(value = "paymentDate") + private LocalDate paymentDate; + + /* + * Amount in pricing currency. Tax not included. + */ + @JsonProperty(value = "pricingCurrencyTotal") + private Price pricingCurrencyTotal; + + /* + * Amount charged in Billing currency. Tax not included. Is null for future payments + */ + @JsonProperty(value = "billingCurrencyTotal") + private Price billingCurrencyTotal; + + /* + * Shows the Account that is charged for this payment. + */ + @JsonProperty(value = "billingAccount") + private String billingAccount; + + /* + * Describes whether the payment is completed, failed, cancelled or scheduled in the future. + */ + @JsonProperty(value = "status") + private PaymentStatus status; + + /* + * The extendedStatusInfo property. + */ + @JsonProperty(value = "extendedStatusInfo") + private ExtendedStatusInfo extendedStatusInfo; + + /** Creates an instance of PaymentDetail class. */ + public PaymentDetail() { + } + + /** + * Get the dueDate property: Date when the payment needs to be done. + * + * @return the dueDate value. + */ + public LocalDate dueDate() { + return this.dueDate; + } + + /** + * Set the dueDate property: Date when the payment needs to be done. + * + * @param dueDate the dueDate value to set. + * @return the PaymentDetail object itself. + */ + public PaymentDetail withDueDate(LocalDate dueDate) { + this.dueDate = dueDate; + return this; + } + + /** + * Get the paymentDate property: Date when the transaction is completed. Is null when it is scheduled. + * + * @return the paymentDate value. + */ + public LocalDate paymentDate() { + return this.paymentDate; + } + + /** + * Set the paymentDate property: Date when the transaction is completed. Is null when it is scheduled. + * + * @param paymentDate the paymentDate value to set. + * @return the PaymentDetail object itself. + */ + public PaymentDetail withPaymentDate(LocalDate paymentDate) { + this.paymentDate = paymentDate; + return this; + } + + /** + * Get the pricingCurrencyTotal property: Amount in pricing currency. Tax not included. + * + * @return the pricingCurrencyTotal value. + */ + public Price pricingCurrencyTotal() { + return this.pricingCurrencyTotal; + } + + /** + * Set the pricingCurrencyTotal property: Amount in pricing currency. Tax not included. + * + * @param pricingCurrencyTotal the pricingCurrencyTotal value to set. + * @return the PaymentDetail object itself. + */ + public PaymentDetail withPricingCurrencyTotal(Price pricingCurrencyTotal) { + this.pricingCurrencyTotal = pricingCurrencyTotal; + return this; + } + + /** + * Get the billingCurrencyTotal property: Amount charged in Billing currency. Tax not included. Is null for future + * payments. + * + * @return the billingCurrencyTotal value. + */ + public Price billingCurrencyTotal() { + return this.billingCurrencyTotal; + } + + /** + * Set the billingCurrencyTotal property: Amount charged in Billing currency. Tax not included. Is null for future + * payments. + * + * @param billingCurrencyTotal the billingCurrencyTotal value to set. + * @return the PaymentDetail object itself. + */ + public PaymentDetail withBillingCurrencyTotal(Price billingCurrencyTotal) { + this.billingCurrencyTotal = billingCurrencyTotal; + return this; + } + + /** + * Get the billingAccount property: Shows the Account that is charged for this payment. + * + * @return the billingAccount value. + */ + public String billingAccount() { + return this.billingAccount; + } + + /** + * Set the billingAccount property: Shows the Account that is charged for this payment. + * + * @param billingAccount the billingAccount value to set. + * @return the PaymentDetail object itself. + */ + public PaymentDetail withBillingAccount(String billingAccount) { + this.billingAccount = billingAccount; + return this; + } + + /** + * Get the status property: Describes whether the payment is completed, failed, cancelled or scheduled in the + * future. + * + * @return the status value. + */ + public PaymentStatus status() { + return this.status; + } + + /** + * Set the status property: Describes whether the payment is completed, failed, cancelled or scheduled in the + * future. + * + * @param status the status value to set. + * @return the PaymentDetail object itself. + */ + public PaymentDetail withStatus(PaymentStatus status) { + this.status = status; + return this; + } + + /** + * Get the extendedStatusInfo property: The extendedStatusInfo property. + * + * @return the extendedStatusInfo value. + */ + public ExtendedStatusInfo extendedStatusInfo() { + return this.extendedStatusInfo; + } + + /** + * Set the extendedStatusInfo property: The extendedStatusInfo property. + * + * @param extendedStatusInfo the extendedStatusInfo value to set. + * @return the PaymentDetail object itself. + */ + public PaymentDetail withExtendedStatusInfo(ExtendedStatusInfo extendedStatusInfo) { + this.extendedStatusInfo = extendedStatusInfo; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (pricingCurrencyTotal() != null) { + pricingCurrencyTotal().validate(); + } + if (billingCurrencyTotal() != null) { + billingCurrencyTotal().validate(); + } + if (extendedStatusInfo() != null) { + extendedStatusInfo().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PaymentStatus.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PaymentStatus.java new file mode 100644 index 0000000000000..f7d859577680e --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PaymentStatus.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Describes whether the payment is completed, failed, cancelled or scheduled in the future. */ +public final class PaymentStatus extends ExpandableStringEnum { + /** Static value Succeeded for PaymentStatus. */ + public static final PaymentStatus SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for PaymentStatus. */ + public static final PaymentStatus FAILED = fromString("Failed"); + + /** Static value Scheduled for PaymentStatus. */ + public static final PaymentStatus SCHEDULED = fromString("Scheduled"); + + /** Static value Cancelled for PaymentStatus. */ + public static final PaymentStatus CANCELLED = fromString("Cancelled"); + + /** + * Creates a new instance of PaymentStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PaymentStatus() { + } + + /** + * Creates or finds a PaymentStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PaymentStatus. + */ + @JsonCreator + public static PaymentStatus fromString(String name) { + return fromString(name, PaymentStatus.class); + } + + /** + * Gets known PaymentStatus values. + * + * @return known PaymentStatus values. + */ + public static Collection values() { + return values(PaymentStatus.class); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Price.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Price.java new file mode 100644 index 0000000000000..cbc1f61c05dd7 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Price.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Pricing information containing the amount and the currency code. */ +@Fluent +public class Price { + /* + * The ISO 4217 3-letter currency code for the currency used by this purchase record. + */ + @JsonProperty(value = "currencyCode") + private String currencyCode; + + /* + * The amount property. + */ + @JsonProperty(value = "amount") + private Double amount; + + /** Creates an instance of Price class. */ + public Price() { + } + + /** + * Get the currencyCode property: The ISO 4217 3-letter currency code for the currency used by this purchase record. + * + * @return the currencyCode value. + */ + public String currencyCode() { + return this.currencyCode; + } + + /** + * Set the currencyCode property: The ISO 4217 3-letter currency code for the currency used by this purchase record. + * + * @param currencyCode the currencyCode value to set. + * @return the Price object itself. + */ + public Price withCurrencyCode(String currencyCode) { + this.currencyCode = currencyCode; + return this; + } + + /** + * Get the amount property: The amount property. + * + * @return the amount value. + */ + public Double amount() { + return this.amount; + } + + /** + * Set the amount property: The amount property. + * + * @param amount the amount value to set. + * @return the Price object itself. + */ + public Price withAmount(Double amount) { + this.amount = amount; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ProvisioningState.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ProvisioningState.java new file mode 100644 index 0000000000000..00095e31b20b6 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ProvisioningState.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Represent the current state of the Reservation. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Creating for ProvisioningState. */ + public static final ProvisioningState CREATING = fromString("Creating"); + + /** Static value PendingResourceHold for ProvisioningState. */ + public static final ProvisioningState PENDING_RESOURCE_HOLD = fromString("PendingResourceHold"); + + /** Static value ConfirmedResourceHold for ProvisioningState. */ + public static final ProvisioningState CONFIRMED_RESOURCE_HOLD = fromString("ConfirmedResourceHold"); + + /** Static value PendingBilling for ProvisioningState. */ + public static final ProvisioningState PENDING_BILLING = fromString("PendingBilling"); + + /** Static value ConfirmedBilling for ProvisioningState. */ + public static final ProvisioningState CONFIRMED_BILLING = fromString("ConfirmedBilling"); + + /** Static value Created for ProvisioningState. */ + public static final ProvisioningState CREATED = fromString("Created"); + + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Cancelled for ProvisioningState. */ + public static final ProvisioningState CANCELLED = fromString("Cancelled"); + + /** Static value Expired for ProvisioningState. */ + public static final ProvisioningState EXPIRED = fromString("Expired"); + + /** Static value BillingFailed for ProvisioningState. */ + public static final ProvisioningState BILLING_FAILED = fromString("BillingFailed"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Split for ProvisioningState. */ + public static final ProvisioningState SPLIT = fromString("Split"); + + /** Static value Merged for ProvisioningState. */ + public static final ProvisioningState MERGED = fromString("Merged"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PurchaseRequest.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PurchaseRequest.java new file mode 100644 index 0000000000000..589b5247c8f82 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PurchaseRequest.java @@ -0,0 +1,385 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.fluent.models.PurchaseRequestProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The request for reservation purchase. */ +@Fluent +public final class PurchaseRequest { + /* + * The name of sku + */ + @JsonProperty(value = "sku") + private SkuName sku; + + /* + * The Azure region where the reserved resource lives. + */ + @JsonProperty(value = "location") + private String location; + + /* + * Properties of reservation purchase request + */ + @JsonProperty(value = "properties") + private PurchaseRequestProperties innerProperties; + + /** Creates an instance of PurchaseRequest class. */ + public PurchaseRequest() { + } + + /** + * Get the sku property: The name of sku. + * + * @return the sku value. + */ + public SkuName sku() { + return this.sku; + } + + /** + * Set the sku property: The name of sku. + * + * @param sku the sku value to set. + * @return the PurchaseRequest object itself. + */ + public PurchaseRequest withSku(SkuName sku) { + this.sku = sku; + return this; + } + + /** + * Get the location property: The Azure region where the reserved resource lives. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Azure region where the reserved resource lives. + * + * @param location the location value to set. + * @return the PurchaseRequest object itself. + */ + public PurchaseRequest withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the innerProperties property: Properties of reservation purchase request. + * + * @return the innerProperties value. + */ + private PurchaseRequestProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the reservedResourceType property: The type of the resource that is being reserved. + * + * @return the reservedResourceType value. + */ + public ReservedResourceType reservedResourceType() { + return this.innerProperties() == null ? null : this.innerProperties().reservedResourceType(); + } + + /** + * Set the reservedResourceType property: The type of the resource that is being reserved. + * + * @param reservedResourceType the reservedResourceType value to set. + * @return the PurchaseRequest object itself. + */ + public PurchaseRequest withReservedResourceType(ReservedResourceType reservedResourceType) { + if (this.innerProperties() == null) { + this.innerProperties = new PurchaseRequestProperties(); + } + this.innerProperties().withReservedResourceType(reservedResourceType); + return this; + } + + /** + * Get the billingScopeId property: Subscription that will be charged for purchasing reservation or savings plan. + * + * @return the billingScopeId value. + */ + public String billingScopeId() { + return this.innerProperties() == null ? null : this.innerProperties().billingScopeId(); + } + + /** + * Set the billingScopeId property: Subscription that will be charged for purchasing reservation or savings plan. + * + * @param billingScopeId the billingScopeId value to set. + * @return the PurchaseRequest object itself. + */ + public PurchaseRequest withBillingScopeId(String billingScopeId) { + if (this.innerProperties() == null) { + this.innerProperties = new PurchaseRequestProperties(); + } + this.innerProperties().withBillingScopeId(billingScopeId); + return this; + } + + /** + * Get the term property: Represent the term of reservation. + * + * @return the term value. + */ + public ReservationTerm term() { + return this.innerProperties() == null ? null : this.innerProperties().term(); + } + + /** + * Set the term property: Represent the term of reservation. + * + * @param term the term value to set. + * @return the PurchaseRequest object itself. + */ + public PurchaseRequest withTerm(ReservationTerm term) { + if (this.innerProperties() == null) { + this.innerProperties = new PurchaseRequestProperties(); + } + this.innerProperties().withTerm(term); + return this; + } + + /** + * Get the billingPlan property: Represent the billing plans. + * + * @return the billingPlan value. + */ + public ReservationBillingPlan billingPlan() { + return this.innerProperties() == null ? null : this.innerProperties().billingPlan(); + } + + /** + * Set the billingPlan property: Represent the billing plans. + * + * @param billingPlan the billingPlan value to set. + * @return the PurchaseRequest object itself. + */ + public PurchaseRequest withBillingPlan(ReservationBillingPlan billingPlan) { + if (this.innerProperties() == null) { + this.innerProperties = new PurchaseRequestProperties(); + } + this.innerProperties().withBillingPlan(billingPlan); + return this; + } + + /** + * Get the quantity property: Quantity of the skus that are part of the reservation. + * + * @return the quantity value. + */ + public Integer quantity() { + return this.innerProperties() == null ? null : this.innerProperties().quantity(); + } + + /** + * Set the quantity property: Quantity of the skus that are part of the reservation. + * + * @param quantity the quantity value to set. + * @return the PurchaseRequest object itself. + */ + public PurchaseRequest withQuantity(Integer quantity) { + if (this.innerProperties() == null) { + this.innerProperties = new PurchaseRequestProperties(); + } + this.innerProperties().withQuantity(quantity); + return this; + } + + /** + * Get the displayName property: Friendly name of the reservation. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: Friendly name of the reservation. + * + * @param displayName the displayName value to set. + * @return the PurchaseRequest object itself. + */ + public PurchaseRequest withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new PurchaseRequestProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the appliedScopeType property: Type of the Applied Scope. + * + * @return the appliedScopeType value. + */ + public AppliedScopeType appliedScopeType() { + return this.innerProperties() == null ? null : this.innerProperties().appliedScopeType(); + } + + /** + * Set the appliedScopeType property: Type of the Applied Scope. + * + * @param appliedScopeType the appliedScopeType value to set. + * @return the PurchaseRequest object itself. + */ + public PurchaseRequest withAppliedScopeType(AppliedScopeType appliedScopeType) { + if (this.innerProperties() == null) { + this.innerProperties = new PurchaseRequestProperties(); + } + this.innerProperties().withAppliedScopeType(appliedScopeType); + return this; + } + + /** + * Get the appliedScopes property: List of the subscriptions that the benefit will be applied. Do not specify if + * AppliedScopeType is Shared. + * + * @return the appliedScopes value. + */ + public List appliedScopes() { + return this.innerProperties() == null ? null : this.innerProperties().appliedScopes(); + } + + /** + * Set the appliedScopes property: List of the subscriptions that the benefit will be applied. Do not specify if + * AppliedScopeType is Shared. + * + * @param appliedScopes the appliedScopes value to set. + * @return the PurchaseRequest object itself. + */ + public PurchaseRequest withAppliedScopes(List appliedScopes) { + if (this.innerProperties() == null) { + this.innerProperties = new PurchaseRequestProperties(); + } + this.innerProperties().withAppliedScopes(appliedScopes); + return this; + } + + /** + * Get the appliedScopeProperties property: Properties specific to applied scope type. Not required if not + * applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup. + * + * @return the appliedScopeProperties value. + */ + public AppliedScopeProperties appliedScopeProperties() { + return this.innerProperties() == null ? null : this.innerProperties().appliedScopeProperties(); + } + + /** + * Set the appliedScopeProperties property: Properties specific to applied scope type. Not required if not + * applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup. + * + * @param appliedScopeProperties the appliedScopeProperties value to set. + * @return the PurchaseRequest object itself. + */ + public PurchaseRequest withAppliedScopeProperties(AppliedScopeProperties appliedScopeProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new PurchaseRequestProperties(); + } + this.innerProperties().withAppliedScopeProperties(appliedScopeProperties); + return this; + } + + /** + * Get the renew property: Setting this to true will automatically purchase a new reservation on the expiration date + * time. + * + * @return the renew value. + */ + public Boolean renew() { + return this.innerProperties() == null ? null : this.innerProperties().renew(); + } + + /** + * Set the renew property: Setting this to true will automatically purchase a new reservation on the expiration date + * time. + * + * @param renew the renew value to set. + * @return the PurchaseRequest object itself. + */ + public PurchaseRequest withRenew(Boolean renew) { + if (this.innerProperties() == null) { + this.innerProperties = new PurchaseRequestProperties(); + } + this.innerProperties().withRenew(renew); + return this; + } + + /** + * Get the reservedResourceProperties property: Properties specific to each reserved resource type. Not required if + * not applicable. + * + * @return the reservedResourceProperties value. + */ + public PurchaseRequestPropertiesReservedResourceProperties reservedResourceProperties() { + return this.innerProperties() == null ? null : this.innerProperties().reservedResourceProperties(); + } + + /** + * Set the reservedResourceProperties property: Properties specific to each reserved resource type. Not required if + * not applicable. + * + * @param reservedResourceProperties the reservedResourceProperties value to set. + * @return the PurchaseRequest object itself. + */ + public PurchaseRequest withReservedResourceProperties( + PurchaseRequestPropertiesReservedResourceProperties reservedResourceProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new PurchaseRequestProperties(); + } + this.innerProperties().withReservedResourceProperties(reservedResourceProperties); + return this; + } + + /** + * Get the reviewDateTime property: This is the date-time when the Azure hybrid benefit needs to be reviewed. + * + * @return the reviewDateTime value. + */ + public OffsetDateTime reviewDateTime() { + return this.innerProperties() == null ? null : this.innerProperties().reviewDateTime(); + } + + /** + * Set the reviewDateTime property: This is the date-time when the Azure hybrid benefit needs to be reviewed. + * + * @param reviewDateTime the reviewDateTime value to set. + * @return the PurchaseRequest object itself. + */ + public PurchaseRequest withReviewDateTime(OffsetDateTime reviewDateTime) { + if (this.innerProperties() == null) { + this.innerProperties = new PurchaseRequestProperties(); + } + this.innerProperties().withReviewDateTime(reviewDateTime); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PurchaseRequestPropertiesReservedResourceProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PurchaseRequestPropertiesReservedResourceProperties.java new file mode 100644 index 0000000000000..38c24de537542 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PurchaseRequestPropertiesReservedResourceProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties specific to each reserved resource type. Not required if not applicable. */ +@Fluent +public final class PurchaseRequestPropertiesReservedResourceProperties { + /* + * Turning this on will apply the reservation discount to other VMs in the same VM size group. Only specify for + * VirtualMachines reserved resource type. + */ + @JsonProperty(value = "instanceFlexibility") + private InstanceFlexibility instanceFlexibility; + + /** Creates an instance of PurchaseRequestPropertiesReservedResourceProperties class. */ + public PurchaseRequestPropertiesReservedResourceProperties() { + } + + /** + * Get the instanceFlexibility property: Turning this on will apply the reservation discount to other VMs in the + * same VM size group. Only specify for VirtualMachines reserved resource type. + * + * @return the instanceFlexibility value. + */ + public InstanceFlexibility instanceFlexibility() { + return this.instanceFlexibility; + } + + /** + * Set the instanceFlexibility property: Turning this on will apply the reservation discount to other VMs in the + * same VM size group. Only specify for VirtualMachines reserved resource type. + * + * @param instanceFlexibility the instanceFlexibility value to set. + * @return the PurchaseRequestPropertiesReservedResourceProperties object itself. + */ + public PurchaseRequestPropertiesReservedResourceProperties withInstanceFlexibility( + InstanceFlexibility instanceFlexibility) { + this.instanceFlexibility = instanceFlexibility; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaLimits.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaLimits.java new file mode 100644 index 0000000000000..d6100604e727e --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaLimits.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.fluent.models.CurrentQuotaLimitBaseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Quota limits. */ +@Fluent +public final class QuotaLimits { + /* + * List of quotas (service limits). + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URI for fetching the next page of quotas (service limits). When no more pages exist, the value is null. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of QuotaLimits class. */ + public QuotaLimits() { + } + + /** + * Get the value property: List of quotas (service limits). + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of quotas (service limits). + * + * @param value the value value to set. + * @return the QuotaLimits object itself. + */ + public QuotaLimits withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI for fetching the next page of quotas (service limits). When no more pages + * exist, the value is null. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI for fetching the next page of quotas (service limits). When no more pages + * exist, the value is null. + * + * @param nextLink the nextLink value to set. + * @return the QuotaLimits object itself. + */ + public QuotaLimits withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaProperties.java new file mode 100644 index 0000000000000..208bcd7d6ddcb --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaProperties.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Quota properties for the resource. */ +@Fluent +public final class QuotaProperties { + /* + * Quota properties. + */ + @JsonProperty(value = "limit") + private Integer limit; + + /* + * Current usage value for the resource. + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Integer currentValue; + + /* + * The limit units, such as **count** and **bytes**. Use the unit field provided in the response of the GET quota + * operation. + */ + @JsonProperty(value = "unit") + private String unit; + + /* + * Name of the resource provide by the resource provider. Use this property for quotaRequests resource operations. + */ + @JsonProperty(value = "name") + private ResourceName name; + + /* + * The name of the resource type. + */ + @JsonProperty(value = "resourceType") + private ResourceType resourceType; + + /* + * The time period over which the quota usage values are summarized. For example, P1D (per one day), PT1M (per one + * minute), and PT1S (per one second). This parameter is optional because, for some resources such as compute, the + * time period is irrelevant. + */ + @JsonProperty(value = "quotaPeriod", access = JsonProperty.Access.WRITE_ONLY) + private String quotaPeriod; + + /* + * Additional properties for the specified resource provider. + */ + @JsonProperty(value = "properties") + private Object properties; + + /** Creates an instance of QuotaProperties class. */ + public QuotaProperties() { + } + + /** + * Get the limit property: Quota properties. + * + * @return the limit value. + */ + public Integer limit() { + return this.limit; + } + + /** + * Set the limit property: Quota properties. + * + * @param limit the limit value to set. + * @return the QuotaProperties object itself. + */ + public QuotaProperties withLimit(Integer limit) { + this.limit = limit; + return this; + } + + /** + * Get the currentValue property: Current usage value for the resource. + * + * @return the currentValue value. + */ + public Integer currentValue() { + return this.currentValue; + } + + /** + * Get the unit property: The limit units, such as **count** and **bytes**. Use the unit field provided in the + * response of the GET quota operation. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Set the unit property: The limit units, such as **count** and **bytes**. Use the unit field provided in the + * response of the GET quota operation. + * + * @param unit the unit value to set. + * @return the QuotaProperties object itself. + */ + public QuotaProperties withUnit(String unit) { + this.unit = unit; + return this; + } + + /** + * Get the name property: Name of the resource provide by the resource provider. Use this property for quotaRequests + * resource operations. + * + * @return the name value. + */ + public ResourceName name() { + return this.name; + } + + /** + * Set the name property: Name of the resource provide by the resource provider. Use this property for quotaRequests + * resource operations. + * + * @param name the name value to set. + * @return the QuotaProperties object itself. + */ + public QuotaProperties withName(ResourceName name) { + this.name = name; + return this; + } + + /** + * Get the resourceType property: The name of the resource type. + * + * @return the resourceType value. + */ + public ResourceType resourceType() { + return this.resourceType; + } + + /** + * Set the resourceType property: The name of the resource type. + * + * @param resourceType the resourceType value to set. + * @return the QuotaProperties object itself. + */ + public QuotaProperties withResourceType(ResourceType resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the quotaPeriod property: The time period over which the quota usage values are summarized. For example, P1D + * (per one day), PT1M (per one minute), and PT1S (per one second). This parameter is optional because, for some + * resources such as compute, the time period is irrelevant. + * + * @return the quotaPeriod value. + */ + public String quotaPeriod() { + return this.quotaPeriod; + } + + /** + * Get the properties property: Additional properties for the specified resource provider. + * + * @return the properties value. + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties property: Additional properties for the specified resource provider. + * + * @param properties the properties value to set. + * @return the QuotaProperties object itself. + */ + public QuotaProperties withProperties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaRequestDetails.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaRequestDetails.java new file mode 100644 index 0000000000000..7d71a13bb410c --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaRequestDetails.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.resourcemanager.reservations.fluent.models.QuotaRequestDetailsInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of QuotaRequestDetails. */ +public interface QuotaRequestDetails { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the provisioningState property: The quota request status. + * + * @return the provisioningState value. + */ + QuotaRequestState provisioningState(); + + /** + * Gets the message property: User friendly status message. + * + * @return the message value. + */ + String message(); + + /** + * Gets the requestSubmitTime property: The time when the quota request was submitted using format: + * yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. + * + * @return the requestSubmitTime value. + */ + OffsetDateTime requestSubmitTime(); + + /** + * Gets the value property: The quotaRequests. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.reservations.fluent.models.QuotaRequestDetailsInner object. + * + * @return the inner object. + */ + QuotaRequestDetailsInner innerModel(); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaRequestDetailsList.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaRequestDetailsList.java new file mode 100644 index 0000000000000..2fceb83e4dd31 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaRequestDetailsList.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.fluent.models.QuotaRequestDetailsInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Quota request details. */ +@Fluent +public final class QuotaRequestDetailsList { + /* + * The quota requests. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URI to fetch the next page of quota limits. When there are no more pages, this is null. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of QuotaRequestDetailsList class. */ + public QuotaRequestDetailsList() { + } + + /** + * Get the value property: The quota requests. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The quota requests. + * + * @param value the value value to set. + * @return the QuotaRequestDetailsList object itself. + */ + public QuotaRequestDetailsList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page of quota limits. When there are no more pages, this is + * null. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to fetch the next page of quota limits. When there are no more pages, this is + * null. + * + * @param nextLink the nextLink value to set. + * @return the QuotaRequestDetailsList object itself. + */ + public QuotaRequestDetailsList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaRequestState.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaRequestState.java new file mode 100644 index 0000000000000..5efa8d8a65ca0 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaRequestState.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The quota request status. */ +public final class QuotaRequestState extends ExpandableStringEnum { + /** Static value Accepted for QuotaRequestState. */ + public static final QuotaRequestState ACCEPTED = fromString("Accepted"); + + /** Static value Invalid for QuotaRequestState. */ + public static final QuotaRequestState INVALID = fromString("Invalid"); + + /** Static value Succeeded for QuotaRequestState. */ + public static final QuotaRequestState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for QuotaRequestState. */ + public static final QuotaRequestState FAILED = fromString("Failed"); + + /** Static value InProgress for QuotaRequestState. */ + public static final QuotaRequestState IN_PROGRESS = fromString("InProgress"); + + /** + * Creates a new instance of QuotaRequestState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public QuotaRequestState() { + } + + /** + * Creates or finds a QuotaRequestState from its string representation. + * + * @param name a name to look for. + * @return the corresponding QuotaRequestState. + */ + @JsonCreator + public static QuotaRequestState fromString(String name) { + return fromString(name, QuotaRequestState.class); + } + + /** + * Gets known QuotaRequestState values. + * + * @return known QuotaRequestState values. + */ + public static Collection values() { + return values(QuotaRequestState.class); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaRequestStatus.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaRequestStatus.java new file mode 100644 index 0000000000000..0b06d4e07df5a --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaRequestStatus.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of QuotaRequestStatus. */ +public interface QuotaRequestStatus { + /** + * For the specified Azure region (location), get the details and status of the quota request by the quota request + * ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response + * with the requestId parameter. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param id Quota Request ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota request details along with {@link Response}. + */ + Response getWithResponse( + String subscriptionId, String providerId, String location, String id, Context context); + + /** + * For the specified Azure region (location), get the details and status of the quota request by the quota request + * ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response + * with the requestId parameter. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param id Quota Request ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota request details. + */ + QuotaRequestDetails get(String subscriptionId, String providerId, String location, String id); + + /** + * For the specified Azure region (location), subscription, and resource provider, get the history of the quota + * requests for the past year. To select specific quota requests, use the oData filter. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota request details as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String subscriptionId, String providerId, String location); + + /** + * For the specified Azure region (location), subscription, and resource provider, get the history of the quota + * requests for the past year. To select specific quota requests, use the oData filter. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param filter | Field | Supported operators | |---------------------|------------------------| |requestSubmitTime + * | ge, le, eq, gt, lt |. + * @param top Number of records to return. + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response + * contains a nextLink element, the value of the nextLink element includes a skiptoken parameter that specifies + * a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return quota request details as paginated response with {@link PagedIterable}. + */ + PagedIterable list( + String subscriptionId, + String providerId, + String location, + String filter, + Integer top, + String skiptoken, + Context context); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaRequestSubmitResponse201.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaRequestSubmitResponse201.java new file mode 100644 index 0000000000000..f68a735f24fee --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaRequestSubmitResponse201.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.resourcemanager.reservations.fluent.models.QuotaRequestSubmitResponse201Inner; + +/** An immutable client-side representation of QuotaRequestSubmitResponse201. */ +public interface QuotaRequestSubmitResponse201 { + /** + * Gets the id property: The quota request ID. Use the requestId parameter to check the request status. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: Operation ID. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: Resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the provisioningState property: The details of the quota request status. + * + * @return the provisioningState value. + */ + QuotaRequestState provisioningState(); + + /** + * Gets the message property: A user friendly message. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.reservations.fluent.models.QuotaRequestSubmitResponse201Inner object. + * + * @return the inner object. + */ + QuotaRequestSubmitResponse201Inner innerModel(); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Quotas.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Quotas.java new file mode 100644 index 0000000000000..3f574ac046397 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Quotas.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Quotas. */ +public interface Quotas { + /** + * Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to + * submit quota update request. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current quota (service limit) and usage of a resource. + */ + Response getWithResponse( + String subscriptionId, String providerId, String location, String resourceName, Context context); + + /** + * Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to + * submit quota update request. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for Microsoft.Compute, Sku or + * TotalLowPriorityCores for Microsoft.MachineLearningServices. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current quota (service limit) and usage of a resource. + */ + CurrentQuotaLimitBase get(String subscriptionId, String providerId, String location, String resourceName); + + /** + * Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota + * operation can be leveraged to request quota updates. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of current quotas (service limits) and usage for all resources as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(String subscriptionId, String providerId, String location); + + /** + * Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota + * operation can be leveraged to request quota updates. + * + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of current quotas (service limits) and usage for all resources as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list( + String subscriptionId, String providerId, String location, Context context); + + /** + * Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to + * submit quota update request. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current quota (service limit) and usage of a resource. + */ + CurrentQuotaLimitBase getById(String id); + + /** + * Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to + * submit quota update request. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current quota (service limit) and usage of a resource. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new CurrentQuotaLimitBase resource. + * + * @param name resource name. + * @return the first stage of the new CurrentQuotaLimitBase definition. + */ + CurrentQuotaLimitBase.DefinitionStages.Blank define(String name); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasGetHeaders.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasGetHeaders.java new file mode 100644 index 0000000000000..2ff98925a69c4 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasGetHeaders.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The QuotasGetHeaders model. */ +@Fluent +public final class QuotasGetHeaders { + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of QuotasGetHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public QuotasGetHeaders(HttpHeaders rawHeaders) { + this.etag = rawHeaders.getValue(HttpHeaderName.ETAG); + } + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the QuotasGetHeaders object itself. + */ + public QuotasGetHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasGetResponse.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasGetResponse.java new file mode 100644 index 0000000000000..dcd8dcc5557a1 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasGetResponse.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.reservations.fluent.models.CurrentQuotaLimitBaseInner; + +/** Contains all response data for the get operation. */ +public final class QuotasGetResponse extends ResponseBase { + /** + * Creates an instance of QuotasGetResponse. + * + * @param request the request which resulted in this QuotasGetResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public QuotasGetResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + CurrentQuotaLimitBaseInner value, + QuotasGetHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public CurrentQuotaLimitBaseInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasListHeaders.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasListHeaders.java new file mode 100644 index 0000000000000..73351da0bca56 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasListHeaders.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The QuotasListHeaders model. */ +@Fluent +public final class QuotasListHeaders { + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of QuotasListHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public QuotasListHeaders(HttpHeaders rawHeaders) { + this.etag = rawHeaders.getValue(HttpHeaderName.ETAG); + } + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the QuotasListHeaders object itself. + */ + public QuotasListHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasListNextHeaders.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasListNextHeaders.java new file mode 100644 index 0000000000000..b4545ec9a3c07 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasListNextHeaders.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The QuotasListNextHeaders model. */ +@Fluent +public final class QuotasListNextHeaders { + /* + * The Etag property. + */ + @JsonProperty(value = "Etag") + private String etag; + + // HttpHeaders containing the raw property values. + /** + * Creates an instance of QuotasListNextHeaders class. + * + * @param rawHeaders The raw HttpHeaders that will be used to create the property values. + */ + public QuotasListNextHeaders(HttpHeaders rawHeaders) { + this.etag = rawHeaders.getValue(HttpHeaderName.ETAG); + } + + /** + * Get the etag property: The Etag property. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Set the etag property: The Etag property. + * + * @param etag the etag value to set. + * @return the QuotasListNextHeaders object itself. + */ + public QuotasListNextHeaders withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasListNextResponse.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasListNextResponse.java new file mode 100644 index 0000000000000..846d2051ef154 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasListNextResponse.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** Contains all response data for the listNext operation. */ +public final class QuotasListNextResponse extends ResponseBase { + /** + * Creates an instance of QuotasListNextResponse. + * + * @param request the request which resulted in this QuotasListNextResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public QuotasListNextResponse( + HttpRequest request, int statusCode, HttpHeaders rawHeaders, QuotaLimits value, QuotasListNextHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public QuotaLimits getValue() { + return super.getValue(); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasListResponse.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasListResponse.java new file mode 100644 index 0000000000000..069b6dc847d9a --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasListResponse.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** Contains all response data for the list operation. */ +public final class QuotasListResponse extends ResponseBase { + /** + * Creates an instance of QuotasListResponse. + * + * @param request the request which resulted in this QuotasListResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public QuotasListResponse( + HttpRequest request, int statusCode, HttpHeaders rawHeaders, QuotaLimits value, QuotasListHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ + @Override + public QuotaLimits getValue() { + return super.getValue(); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundBillingInformation.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundBillingInformation.java new file mode 100644 index 0000000000000..b27eaa77dc945 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundBillingInformation.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** billing information. */ +@Fluent +public final class RefundBillingInformation { + /* + * Represent the billing plans. + */ + @JsonProperty(value = "billingPlan") + private ReservationBillingPlan billingPlan; + + /* + * The number of completed transactions in this reservation's payment + */ + @JsonProperty(value = "completedTransactions") + private Integer completedTransactions; + + /* + * The number of total transactions in this reservation's payment + */ + @JsonProperty(value = "totalTransactions") + private Integer totalTransactions; + + /* + * Pricing information containing the amount and the currency code + */ + @JsonProperty(value = "billingCurrencyTotalPaidAmount") + private Price billingCurrencyTotalPaidAmount; + + /* + * Pricing information containing the amount and the currency code + */ + @JsonProperty(value = "billingCurrencyProratedAmount") + private Price billingCurrencyProratedAmount; + + /* + * Pricing information containing the amount and the currency code + */ + @JsonProperty(value = "billingCurrencyRemainingCommitmentAmount") + private Price billingCurrencyRemainingCommitmentAmount; + + /** Creates an instance of RefundBillingInformation class. */ + public RefundBillingInformation() { + } + + /** + * Get the billingPlan property: Represent the billing plans. + * + * @return the billingPlan value. + */ + public ReservationBillingPlan billingPlan() { + return this.billingPlan; + } + + /** + * Set the billingPlan property: Represent the billing plans. + * + * @param billingPlan the billingPlan value to set. + * @return the RefundBillingInformation object itself. + */ + public RefundBillingInformation withBillingPlan(ReservationBillingPlan billingPlan) { + this.billingPlan = billingPlan; + return this; + } + + /** + * Get the completedTransactions property: The number of completed transactions in this reservation's payment. + * + * @return the completedTransactions value. + */ + public Integer completedTransactions() { + return this.completedTransactions; + } + + /** + * Set the completedTransactions property: The number of completed transactions in this reservation's payment. + * + * @param completedTransactions the completedTransactions value to set. + * @return the RefundBillingInformation object itself. + */ + public RefundBillingInformation withCompletedTransactions(Integer completedTransactions) { + this.completedTransactions = completedTransactions; + return this; + } + + /** + * Get the totalTransactions property: The number of total transactions in this reservation's payment. + * + * @return the totalTransactions value. + */ + public Integer totalTransactions() { + return this.totalTransactions; + } + + /** + * Set the totalTransactions property: The number of total transactions in this reservation's payment. + * + * @param totalTransactions the totalTransactions value to set. + * @return the RefundBillingInformation object itself. + */ + public RefundBillingInformation withTotalTransactions(Integer totalTransactions) { + this.totalTransactions = totalTransactions; + return this; + } + + /** + * Get the billingCurrencyTotalPaidAmount property: Pricing information containing the amount and the currency code. + * + * @return the billingCurrencyTotalPaidAmount value. + */ + public Price billingCurrencyTotalPaidAmount() { + return this.billingCurrencyTotalPaidAmount; + } + + /** + * Set the billingCurrencyTotalPaidAmount property: Pricing information containing the amount and the currency code. + * + * @param billingCurrencyTotalPaidAmount the billingCurrencyTotalPaidAmount value to set. + * @return the RefundBillingInformation object itself. + */ + public RefundBillingInformation withBillingCurrencyTotalPaidAmount(Price billingCurrencyTotalPaidAmount) { + this.billingCurrencyTotalPaidAmount = billingCurrencyTotalPaidAmount; + return this; + } + + /** + * Get the billingCurrencyProratedAmount property: Pricing information containing the amount and the currency code. + * + * @return the billingCurrencyProratedAmount value. + */ + public Price billingCurrencyProratedAmount() { + return this.billingCurrencyProratedAmount; + } + + /** + * Set the billingCurrencyProratedAmount property: Pricing information containing the amount and the currency code. + * + * @param billingCurrencyProratedAmount the billingCurrencyProratedAmount value to set. + * @return the RefundBillingInformation object itself. + */ + public RefundBillingInformation withBillingCurrencyProratedAmount(Price billingCurrencyProratedAmount) { + this.billingCurrencyProratedAmount = billingCurrencyProratedAmount; + return this; + } + + /** + * Get the billingCurrencyRemainingCommitmentAmount property: Pricing information containing the amount and the + * currency code. + * + * @return the billingCurrencyRemainingCommitmentAmount value. + */ + public Price billingCurrencyRemainingCommitmentAmount() { + return this.billingCurrencyRemainingCommitmentAmount; + } + + /** + * Set the billingCurrencyRemainingCommitmentAmount property: Pricing information containing the amount and the + * currency code. + * + * @param billingCurrencyRemainingCommitmentAmount the billingCurrencyRemainingCommitmentAmount value to set. + * @return the RefundBillingInformation object itself. + */ + public RefundBillingInformation withBillingCurrencyRemainingCommitmentAmount( + Price billingCurrencyRemainingCommitmentAmount) { + this.billingCurrencyRemainingCommitmentAmount = billingCurrencyRemainingCommitmentAmount; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (billingCurrencyTotalPaidAmount() != null) { + billingCurrencyTotalPaidAmount().validate(); + } + if (billingCurrencyProratedAmount() != null) { + billingCurrencyProratedAmount().validate(); + } + if (billingCurrencyRemainingCommitmentAmount() != null) { + billingCurrencyRemainingCommitmentAmount().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundPolicyError.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundPolicyError.java new file mode 100644 index 0000000000000..d58f5e6d67998 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundPolicyError.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** error details. */ +@Fluent +public final class RefundPolicyError { + /* + * Error code describing the reason that service is not able to process the incoming request + */ + @JsonProperty(value = "code") + private ErrorResponseCode code; + + /* + * The message property. + */ + @JsonProperty(value = "message") + private String message; + + /** Creates an instance of RefundPolicyError class. */ + public RefundPolicyError() { + } + + /** + * Get the code property: Error code describing the reason that service is not able to process the incoming request. + * + * @return the code value. + */ + public ErrorResponseCode code() { + return this.code; + } + + /** + * Set the code property: Error code describing the reason that service is not able to process the incoming request. + * + * @param code the code value to set. + * @return the RefundPolicyError object itself. + */ + public RefundPolicyError withCode(ErrorResponseCode code) { + this.code = code; + return this; + } + + /** + * Get the message property: The message property. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The message property. + * + * @param message the message value to set. + * @return the RefundPolicyError object itself. + */ + public RefundPolicyError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundPolicyResult.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundPolicyResult.java new file mode 100644 index 0000000000000..85ca0cd9ab7ef --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundPolicyResult.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Refund policy result. */ +@Fluent +public final class RefundPolicyResult { + /* + * Refund policy result property + */ + @JsonProperty(value = "properties") + private RefundPolicyResultProperty properties; + + /** Creates an instance of RefundPolicyResult class. */ + public RefundPolicyResult() { + } + + /** + * Get the properties property: Refund policy result property. + * + * @return the properties value. + */ + public RefundPolicyResultProperty properties() { + return this.properties; + } + + /** + * Set the properties property: Refund policy result property. + * + * @param properties the properties value to set. + * @return the RefundPolicyResult object itself. + */ + public RefundPolicyResult withProperties(RefundPolicyResultProperty properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundPolicyResultProperty.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundPolicyResultProperty.java new file mode 100644 index 0000000000000..46cc8fe5a194b --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundPolicyResultProperty.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Refund policy result property. */ +@Fluent +public final class RefundPolicyResultProperty { + /* + * Pricing information containing the amount and the currency code + */ + @JsonProperty(value = "consumedRefundsTotal") + private Price consumedRefundsTotal; + + /* + * Pricing information containing the amount and the currency code + */ + @JsonProperty(value = "maxRefundLimit") + private Price maxRefundLimit; + + /* + * Refund Policy errors + */ + @JsonProperty(value = "policyErrors") + private List policyErrors; + + /** Creates an instance of RefundPolicyResultProperty class. */ + public RefundPolicyResultProperty() { + } + + /** + * Get the consumedRefundsTotal property: Pricing information containing the amount and the currency code. + * + * @return the consumedRefundsTotal value. + */ + public Price consumedRefundsTotal() { + return this.consumedRefundsTotal; + } + + /** + * Set the consumedRefundsTotal property: Pricing information containing the amount and the currency code. + * + * @param consumedRefundsTotal the consumedRefundsTotal value to set. + * @return the RefundPolicyResultProperty object itself. + */ + public RefundPolicyResultProperty withConsumedRefundsTotal(Price consumedRefundsTotal) { + this.consumedRefundsTotal = consumedRefundsTotal; + return this; + } + + /** + * Get the maxRefundLimit property: Pricing information containing the amount and the currency code. + * + * @return the maxRefundLimit value. + */ + public Price maxRefundLimit() { + return this.maxRefundLimit; + } + + /** + * Set the maxRefundLimit property: Pricing information containing the amount and the currency code. + * + * @param maxRefundLimit the maxRefundLimit value to set. + * @return the RefundPolicyResultProperty object itself. + */ + public RefundPolicyResultProperty withMaxRefundLimit(Price maxRefundLimit) { + this.maxRefundLimit = maxRefundLimit; + return this; + } + + /** + * Get the policyErrors property: Refund Policy errors. + * + * @return the policyErrors value. + */ + public List policyErrors() { + return this.policyErrors; + } + + /** + * Set the policyErrors property: Refund Policy errors. + * + * @param policyErrors the policyErrors value to set. + * @return the RefundPolicyResultProperty object itself. + */ + public RefundPolicyResultProperty withPolicyErrors(List policyErrors) { + this.policyErrors = policyErrors; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (consumedRefundsTotal() != null) { + consumedRefundsTotal().validate(); + } + if (maxRefundLimit() != null) { + maxRefundLimit().validate(); + } + if (policyErrors() != null) { + policyErrors().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundRequest.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundRequest.java new file mode 100644 index 0000000000000..dfc96e83eead4 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundRequest.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Request containing information needed for returning reservation. */ +@Fluent +public final class RefundRequest { + /* + * Properties needed for refund request including the session id from calculate refund, the scope, the reservation + * to be returned and the return reason. + */ + @JsonProperty(value = "properties") + private RefundRequestProperties properties; + + /** Creates an instance of RefundRequest class. */ + public RefundRequest() { + } + + /** + * Get the properties property: Properties needed for refund request including the session id from calculate refund, + * the scope, the reservation to be returned and the return reason. + * + * @return the properties value. + */ + public RefundRequestProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties needed for refund request including the session id from calculate refund, + * the scope, the reservation to be returned and the return reason. + * + * @param properties the properties value to set. + * @return the RefundRequest object itself. + */ + public RefundRequest withProperties(RefundRequestProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundRequestProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundRequestProperties.java new file mode 100644 index 0000000000000..dce09c6ffe209 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundRequestProperties.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties needed for refund request including the session id from calculate refund, the scope, the reservation to be + * returned and the return reason. + */ +@Fluent +public final class RefundRequestProperties { + /* + * SessionId that was returned by CalculateRefund API. + */ + @JsonProperty(value = "sessionId") + private String sessionId; + + /* + * The scope of the refund, e.g. Reservation + */ + @JsonProperty(value = "scope") + private String scope; + + /* + * Reservation to return + */ + @JsonProperty(value = "reservationToReturn") + private ReservationToReturn reservationToReturn; + + /* + * The reason of returning the reservation + */ + @JsonProperty(value = "returnReason") + private String returnReason; + + /** Creates an instance of RefundRequestProperties class. */ + public RefundRequestProperties() { + } + + /** + * Get the sessionId property: SessionId that was returned by CalculateRefund API. + * + * @return the sessionId value. + */ + public String sessionId() { + return this.sessionId; + } + + /** + * Set the sessionId property: SessionId that was returned by CalculateRefund API. + * + * @param sessionId the sessionId value to set. + * @return the RefundRequestProperties object itself. + */ + public RefundRequestProperties withSessionId(String sessionId) { + this.sessionId = sessionId; + return this; + } + + /** + * Get the scope property: The scope of the refund, e.g. Reservation. + * + * @return the scope value. + */ + public String scope() { + return this.scope; + } + + /** + * Set the scope property: The scope of the refund, e.g. Reservation. + * + * @param scope the scope value to set. + * @return the RefundRequestProperties object itself. + */ + public RefundRequestProperties withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Get the reservationToReturn property: Reservation to return. + * + * @return the reservationToReturn value. + */ + public ReservationToReturn reservationToReturn() { + return this.reservationToReturn; + } + + /** + * Set the reservationToReturn property: Reservation to return. + * + * @param reservationToReturn the reservationToReturn value to set. + * @return the RefundRequestProperties object itself. + */ + public RefundRequestProperties withReservationToReturn(ReservationToReturn reservationToReturn) { + this.reservationToReturn = reservationToReturn; + return this; + } + + /** + * Get the returnReason property: The reason of returning the reservation. + * + * @return the returnReason value. + */ + public String returnReason() { + return this.returnReason; + } + + /** + * Set the returnReason property: The reason of returning the reservation. + * + * @param returnReason the returnReason value to set. + * @return the RefundRequestProperties object itself. + */ + public RefundRequestProperties withReturnReason(String returnReason) { + this.returnReason = returnReason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (reservationToReturn() != null) { + reservationToReturn().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundResponse.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundResponse.java new file mode 100644 index 0000000000000..07d35cbe946e1 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundResponse.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.resourcemanager.reservations.fluent.models.RefundResponseInner; + +/** An immutable client-side representation of RefundResponse. */ +public interface RefundResponse { + /** + * Gets the id property: Fully qualified identifier of the reservation being returned. + * + * @return the id value. + */ + String id(); + + /** + * Gets the properties property: The refund properties of reservation. + * + * @return the properties value. + */ + RefundResponseProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.reservations.fluent.models.RefundResponseInner object. + * + * @return the inner object. + */ + RefundResponseInner innerModel(); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundResponseProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundResponseProperties.java new file mode 100644 index 0000000000000..dda4e678b99fe --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RefundResponseProperties.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The refund properties of reservation. */ +@Fluent +public final class RefundResponseProperties { + /* + * Refund session identifier + */ + @JsonProperty(value = "sessionId") + private String sessionId; + + /* + * Quantity to be returned + */ + @JsonProperty(value = "quantity") + private Integer quantity; + + /* + * Pricing information containing the amount and the currency code + */ + @JsonProperty(value = "billingRefundAmount") + private Price billingRefundAmount; + + /* + * Pricing information containing the amount and the currency code + */ + @JsonProperty(value = "pricingRefundAmount") + private Price pricingRefundAmount; + + /* + * Refund policy result + */ + @JsonProperty(value = "policyResult") + private RefundPolicyResult policyResult; + + /* + * billing information + */ + @JsonProperty(value = "billingInformation") + private RefundBillingInformation billingInformation; + + /** Creates an instance of RefundResponseProperties class. */ + public RefundResponseProperties() { + } + + /** + * Get the sessionId property: Refund session identifier. + * + * @return the sessionId value. + */ + public String sessionId() { + return this.sessionId; + } + + /** + * Set the sessionId property: Refund session identifier. + * + * @param sessionId the sessionId value to set. + * @return the RefundResponseProperties object itself. + */ + public RefundResponseProperties withSessionId(String sessionId) { + this.sessionId = sessionId; + return this; + } + + /** + * Get the quantity property: Quantity to be returned. + * + * @return the quantity value. + */ + public Integer quantity() { + return this.quantity; + } + + /** + * Set the quantity property: Quantity to be returned. + * + * @param quantity the quantity value to set. + * @return the RefundResponseProperties object itself. + */ + public RefundResponseProperties withQuantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get the billingRefundAmount property: Pricing information containing the amount and the currency code. + * + * @return the billingRefundAmount value. + */ + public Price billingRefundAmount() { + return this.billingRefundAmount; + } + + /** + * Set the billingRefundAmount property: Pricing information containing the amount and the currency code. + * + * @param billingRefundAmount the billingRefundAmount value to set. + * @return the RefundResponseProperties object itself. + */ + public RefundResponseProperties withBillingRefundAmount(Price billingRefundAmount) { + this.billingRefundAmount = billingRefundAmount; + return this; + } + + /** + * Get the pricingRefundAmount property: Pricing information containing the amount and the currency code. + * + * @return the pricingRefundAmount value. + */ + public Price pricingRefundAmount() { + return this.pricingRefundAmount; + } + + /** + * Set the pricingRefundAmount property: Pricing information containing the amount and the currency code. + * + * @param pricingRefundAmount the pricingRefundAmount value to set. + * @return the RefundResponseProperties object itself. + */ + public RefundResponseProperties withPricingRefundAmount(Price pricingRefundAmount) { + this.pricingRefundAmount = pricingRefundAmount; + return this; + } + + /** + * Get the policyResult property: Refund policy result. + * + * @return the policyResult value. + */ + public RefundPolicyResult policyResult() { + return this.policyResult; + } + + /** + * Set the policyResult property: Refund policy result. + * + * @param policyResult the policyResult value to set. + * @return the RefundResponseProperties object itself. + */ + public RefundResponseProperties withPolicyResult(RefundPolicyResult policyResult) { + this.policyResult = policyResult; + return this; + } + + /** + * Get the billingInformation property: billing information. + * + * @return the billingInformation value. + */ + public RefundBillingInformation billingInformation() { + return this.billingInformation; + } + + /** + * Set the billingInformation property: billing information. + * + * @param billingInformation the billingInformation value to set. + * @return the RefundResponseProperties object itself. + */ + public RefundResponseProperties withBillingInformation(RefundBillingInformation billingInformation) { + this.billingInformation = billingInformation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (billingRefundAmount() != null) { + billingRefundAmount().validate(); + } + if (pricingRefundAmount() != null) { + pricingRefundAmount().validate(); + } + if (policyResult() != null) { + policyResult().validate(); + } + if (billingInformation() != null) { + billingInformation().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RenewPropertiesResponse.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RenewPropertiesResponse.java new file mode 100644 index 0000000000000..96b2d89253173 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RenewPropertiesResponse.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The renew properties for a reservation. */ +@Fluent +public final class RenewPropertiesResponse { + /* + * The request for reservation purchase + */ + @JsonProperty(value = "purchaseProperties") + private PurchaseRequest purchaseProperties; + + /* + * Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. + * This is locked price 30 days before expiry. + */ + @JsonProperty(value = "pricingCurrencyTotal") + private RenewPropertiesResponsePricingCurrencyTotal pricingCurrencyTotal; + + /* + * Currency and amount that customer will be charged in customer's local currency for renewal purchase. Tax is not + * included. + */ + @JsonProperty(value = "billingCurrencyTotal") + private RenewPropertiesResponseBillingCurrencyTotal billingCurrencyTotal; + + /** Creates an instance of RenewPropertiesResponse class. */ + public RenewPropertiesResponse() { + } + + /** + * Get the purchaseProperties property: The request for reservation purchase. + * + * @return the purchaseProperties value. + */ + public PurchaseRequest purchaseProperties() { + return this.purchaseProperties; + } + + /** + * Set the purchaseProperties property: The request for reservation purchase. + * + * @param purchaseProperties the purchaseProperties value to set. + * @return the RenewPropertiesResponse object itself. + */ + public RenewPropertiesResponse withPurchaseProperties(PurchaseRequest purchaseProperties) { + this.purchaseProperties = purchaseProperties; + return this; + } + + /** + * Get the pricingCurrencyTotal property: Amount that Microsoft uses for record. Used during refund for calculating + * refund limit. Tax is not included. This is locked price 30 days before expiry. + * + * @return the pricingCurrencyTotal value. + */ + public RenewPropertiesResponsePricingCurrencyTotal pricingCurrencyTotal() { + return this.pricingCurrencyTotal; + } + + /** + * Set the pricingCurrencyTotal property: Amount that Microsoft uses for record. Used during refund for calculating + * refund limit. Tax is not included. This is locked price 30 days before expiry. + * + * @param pricingCurrencyTotal the pricingCurrencyTotal value to set. + * @return the RenewPropertiesResponse object itself. + */ + public RenewPropertiesResponse withPricingCurrencyTotal( + RenewPropertiesResponsePricingCurrencyTotal pricingCurrencyTotal) { + this.pricingCurrencyTotal = pricingCurrencyTotal; + return this; + } + + /** + * Get the billingCurrencyTotal property: Currency and amount that customer will be charged in customer's local + * currency for renewal purchase. Tax is not included. + * + * @return the billingCurrencyTotal value. + */ + public RenewPropertiesResponseBillingCurrencyTotal billingCurrencyTotal() { + return this.billingCurrencyTotal; + } + + /** + * Set the billingCurrencyTotal property: Currency and amount that customer will be charged in customer's local + * currency for renewal purchase. Tax is not included. + * + * @param billingCurrencyTotal the billingCurrencyTotal value to set. + * @return the RenewPropertiesResponse object itself. + */ + public RenewPropertiesResponse withBillingCurrencyTotal( + RenewPropertiesResponseBillingCurrencyTotal billingCurrencyTotal) { + this.billingCurrencyTotal = billingCurrencyTotal; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (purchaseProperties() != null) { + purchaseProperties().validate(); + } + if (pricingCurrencyTotal() != null) { + pricingCurrencyTotal().validate(); + } + if (billingCurrencyTotal() != null) { + billingCurrencyTotal().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RenewPropertiesResponseBillingCurrencyTotal.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RenewPropertiesResponseBillingCurrencyTotal.java new file mode 100644 index 0000000000000..4ee981a44f7bc --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RenewPropertiesResponseBillingCurrencyTotal.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Currency and amount that customer will be charged in customer's local currency for renewal purchase. Tax is not + * included. + */ +@Fluent +public final class RenewPropertiesResponseBillingCurrencyTotal { + /* + * The ISO 4217 3-letter currency code for the currency used by this purchase record. + */ + @JsonProperty(value = "currencyCode") + private String currencyCode; + + /* + * The amount property. + */ + @JsonProperty(value = "amount") + private Float amount; + + /** Creates an instance of RenewPropertiesResponseBillingCurrencyTotal class. */ + public RenewPropertiesResponseBillingCurrencyTotal() { + } + + /** + * Get the currencyCode property: The ISO 4217 3-letter currency code for the currency used by this purchase record. + * + * @return the currencyCode value. + */ + public String currencyCode() { + return this.currencyCode; + } + + /** + * Set the currencyCode property: The ISO 4217 3-letter currency code for the currency used by this purchase record. + * + * @param currencyCode the currencyCode value to set. + * @return the RenewPropertiesResponseBillingCurrencyTotal object itself. + */ + public RenewPropertiesResponseBillingCurrencyTotal withCurrencyCode(String currencyCode) { + this.currencyCode = currencyCode; + return this; + } + + /** + * Get the amount property: The amount property. + * + * @return the amount value. + */ + public Float amount() { + return this.amount; + } + + /** + * Set the amount property: The amount property. + * + * @param amount the amount value to set. + * @return the RenewPropertiesResponseBillingCurrencyTotal object itself. + */ + public RenewPropertiesResponseBillingCurrencyTotal withAmount(Float amount) { + this.amount = amount; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RenewPropertiesResponsePricingCurrencyTotal.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RenewPropertiesResponsePricingCurrencyTotal.java new file mode 100644 index 0000000000000..918aa7395c91d --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RenewPropertiesResponsePricingCurrencyTotal.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. This is + * locked price 30 days before expiry. + */ +@Fluent +public final class RenewPropertiesResponsePricingCurrencyTotal { + /* + * The ISO 4217 3-letter currency code for the currency used by this purchase record. + */ + @JsonProperty(value = "currencyCode") + private String currencyCode; + + /* + * The amount property. + */ + @JsonProperty(value = "amount") + private Float amount; + + /** Creates an instance of RenewPropertiesResponsePricingCurrencyTotal class. */ + public RenewPropertiesResponsePricingCurrencyTotal() { + } + + /** + * Get the currencyCode property: The ISO 4217 3-letter currency code for the currency used by this purchase record. + * + * @return the currencyCode value. + */ + public String currencyCode() { + return this.currencyCode; + } + + /** + * Set the currencyCode property: The ISO 4217 3-letter currency code for the currency used by this purchase record. + * + * @param currencyCode the currencyCode value to set. + * @return the RenewPropertiesResponsePricingCurrencyTotal object itself. + */ + public RenewPropertiesResponsePricingCurrencyTotal withCurrencyCode(String currencyCode) { + this.currencyCode = currencyCode; + return this; + } + + /** + * Get the amount property: The amount property. + * + * @return the amount value. + */ + public Float amount() { + return this.amount; + } + + /** + * Set the amount property: The amount property. + * + * @param amount the amount value to set. + * @return the RenewPropertiesResponsePricingCurrencyTotal object itself. + */ + public RenewPropertiesResponsePricingCurrencyTotal withAmount(Float amount) { + this.amount = amount; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationBillingPlan.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationBillingPlan.java new file mode 100644 index 0000000000000..acfa893ae7fda --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationBillingPlan.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Represent the billing plans. */ +public final class ReservationBillingPlan extends ExpandableStringEnum { + /** Static value Upfront for ReservationBillingPlan. */ + public static final ReservationBillingPlan UPFRONT = fromString("Upfront"); + + /** Static value Monthly for ReservationBillingPlan. */ + public static final ReservationBillingPlan MONTHLY = fromString("Monthly"); + + /** + * Creates a new instance of ReservationBillingPlan value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ReservationBillingPlan() { + } + + /** + * Creates or finds a ReservationBillingPlan from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReservationBillingPlan. + */ + @JsonCreator + public static ReservationBillingPlan fromString(String name) { + return fromString(name, ReservationBillingPlan.class); + } + + /** + * Gets known ReservationBillingPlan values. + * + * @return known ReservationBillingPlan values. + */ + public static Collection values() { + return values(ReservationBillingPlan.class); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationList.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationList.java new file mode 100644 index 0000000000000..0174fafc6810e --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.fluent.models.ReservationResponseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of `Reservation`s. */ +@Fluent +public final class ReservationList { + /* + * The value property. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Url to get the next page of reservations. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of ReservationList class. */ + public ReservationList() { + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the ReservationList object itself. + */ + public ReservationList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Url to get the next page of reservations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Url to get the next page of reservations. + * + * @param nextLink the nextLink value to set. + * @return the ReservationList object itself. + */ + public ReservationList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationMergeProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationMergeProperties.java new file mode 100644 index 0000000000000..68792a493fc29 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationMergeProperties.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of reservation merge. */ +@Fluent +public final class ReservationMergeProperties { + /* + * Reservation resource id Created due to the merge. Format of the resource id is + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} + */ + @JsonProperty(value = "mergeDestination") + private String mergeDestination; + + /* + * Resource ids of the source reservation's merged to form this reservation. Format of the resource id is + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} + */ + @JsonProperty(value = "mergeSources") + private List mergeSources; + + /** Creates an instance of ReservationMergeProperties class. */ + public ReservationMergeProperties() { + } + + /** + * Get the mergeDestination property: Reservation resource id Created due to the merge. Format of the resource id is + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @return the mergeDestination value. + */ + public String mergeDestination() { + return this.mergeDestination; + } + + /** + * Set the mergeDestination property: Reservation resource id Created due to the merge. Format of the resource id is + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @param mergeDestination the mergeDestination value to set. + * @return the ReservationMergeProperties object itself. + */ + public ReservationMergeProperties withMergeDestination(String mergeDestination) { + this.mergeDestination = mergeDestination; + return this; + } + + /** + * Get the mergeSources property: Resource ids of the source reservation's merged to form this reservation. Format + * of the resource id is + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @return the mergeSources value. + */ + public List mergeSources() { + return this.mergeSources; + } + + /** + * Set the mergeSources property: Resource ids of the source reservation's merged to form this reservation. Format + * of the resource id is + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @param mergeSources the mergeSources value to set. + * @return the ReservationMergeProperties object itself. + */ + public ReservationMergeProperties withMergeSources(List mergeSources) { + this.mergeSources = mergeSources; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationOrderBillingPlanInformation.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationOrderBillingPlanInformation.java new file mode 100644 index 0000000000000..752e3d5301259 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationOrderBillingPlanInformation.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.LocalDate; +import java.util.List; + +/** Information describing the type of billing plan for this reservation. */ +@Fluent +public final class ReservationOrderBillingPlanInformation { + /* + * Amount of money to be paid for the Order. Tax is not included. + */ + @JsonProperty(value = "pricingCurrencyTotal") + private Price pricingCurrencyTotal; + + /* + * Date when the billing plan has started. + */ + @JsonProperty(value = "startDate") + private LocalDate startDate; + + /* + * For recurring billing plans, indicates the date when next payment will be processed. Null when total is paid + * off. + */ + @JsonProperty(value = "nextPaymentDueDate") + private LocalDate nextPaymentDueDate; + + /* + * The transactions property. + */ + @JsonProperty(value = "transactions") + private List transactions; + + /** Creates an instance of ReservationOrderBillingPlanInformation class. */ + public ReservationOrderBillingPlanInformation() { + } + + /** + * Get the pricingCurrencyTotal property: Amount of money to be paid for the Order. Tax is not included. + * + * @return the pricingCurrencyTotal value. + */ + public Price pricingCurrencyTotal() { + return this.pricingCurrencyTotal; + } + + /** + * Set the pricingCurrencyTotal property: Amount of money to be paid for the Order. Tax is not included. + * + * @param pricingCurrencyTotal the pricingCurrencyTotal value to set. + * @return the ReservationOrderBillingPlanInformation object itself. + */ + public ReservationOrderBillingPlanInformation withPricingCurrencyTotal(Price pricingCurrencyTotal) { + this.pricingCurrencyTotal = pricingCurrencyTotal; + return this; + } + + /** + * Get the startDate property: Date when the billing plan has started. + * + * @return the startDate value. + */ + public LocalDate startDate() { + return this.startDate; + } + + /** + * Set the startDate property: Date when the billing plan has started. + * + * @param startDate the startDate value to set. + * @return the ReservationOrderBillingPlanInformation object itself. + */ + public ReservationOrderBillingPlanInformation withStartDate(LocalDate startDate) { + this.startDate = startDate; + return this; + } + + /** + * Get the nextPaymentDueDate property: For recurring billing plans, indicates the date when next payment will be + * processed. Null when total is paid off. + * + * @return the nextPaymentDueDate value. + */ + public LocalDate nextPaymentDueDate() { + return this.nextPaymentDueDate; + } + + /** + * Set the nextPaymentDueDate property: For recurring billing plans, indicates the date when next payment will be + * processed. Null when total is paid off. + * + * @param nextPaymentDueDate the nextPaymentDueDate value to set. + * @return the ReservationOrderBillingPlanInformation object itself. + */ + public ReservationOrderBillingPlanInformation withNextPaymentDueDate(LocalDate nextPaymentDueDate) { + this.nextPaymentDueDate = nextPaymentDueDate; + return this; + } + + /** + * Get the transactions property: The transactions property. + * + * @return the transactions value. + */ + public List transactions() { + return this.transactions; + } + + /** + * Set the transactions property: The transactions property. + * + * @param transactions the transactions value to set. + * @return the ReservationOrderBillingPlanInformation object itself. + */ + public ReservationOrderBillingPlanInformation withTransactions(List transactions) { + this.transactions = transactions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (pricingCurrencyTotal() != null) { + pricingCurrencyTotal().validate(); + } + if (transactions() != null) { + transactions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationOrderList.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationOrderList.java new file mode 100644 index 0000000000000..65dfc695a6c0d --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationOrderList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.fluent.models.ReservationOrderResponseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of `ReservationOrder`s. */ +@Fluent +public final class ReservationOrderList { + /* + * The value property. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Url to get the next page of reservationOrders. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of ReservationOrderList class. */ + public ReservationOrderList() { + } + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the ReservationOrderList object itself. + */ + public ReservationOrderList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Url to get the next page of reservationOrders. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Url to get the next page of reservationOrders. + * + * @param nextLink the nextLink value to set. + * @return the ReservationOrderList object itself. + */ + public ReservationOrderList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationOrderResponse.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationOrderResponse.java new file mode 100644 index 0000000000000..fd73eaa8bff43 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationOrderResponse.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.reservations.fluent.models.ReservationOrderResponseInner; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of ReservationOrderResponse. */ +public interface ReservationOrderResponse { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: The etag property. + * + * @return the etag value. + */ + Integer etag(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the displayName property: Friendly name for user to easily identified the reservation. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the requestDateTime property: This is the DateTime when the reservation was initially requested for + * purchase. + * + * @return the requestDateTime value. + */ + OffsetDateTime requestDateTime(); + + /** + * Gets the createdDateTime property: This is the DateTime when the reservation was created. + * + * @return the createdDateTime value. + */ + OffsetDateTime createdDateTime(); + + /** + * Gets the expiryDate property: This is the date when the reservation will expire. + * + * @return the expiryDate value. + */ + LocalDate expiryDate(); + + /** + * Gets the expiryDateTime property: This is the date-time when the reservation will expire. + * + * @return the expiryDateTime value. + */ + OffsetDateTime expiryDateTime(); + + /** + * Gets the benefitStartTime property: This is the DateTime when the reservation benefit started. + * + * @return the benefitStartTime value. + */ + OffsetDateTime benefitStartTime(); + + /** + * Gets the originalQuantity property: Total Quantity of the skus purchased in the reservation. + * + * @return the originalQuantity value. + */ + Integer originalQuantity(); + + /** + * Gets the term property: Represent the term of reservation. + * + * @return the term value. + */ + ReservationTerm term(); + + /** + * Gets the provisioningState property: Current state of the reservation. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the billingPlan property: Represent the billing plans. + * + * @return the billingPlan value. + */ + ReservationBillingPlan billingPlan(); + + /** + * Gets the planInformation property: Information describing the type of billing plan for this reservation. + * + * @return the planInformation value. + */ + ReservationOrderBillingPlanInformation planInformation(); + + /** + * Gets the reservations property: The reservations property. + * + * @return the reservations value. + */ + List reservations(); + + /** + * Gets the reviewDateTime property: This is the date-time when the Azure Hybrid Benefit needs to be reviewed. + * + * @return the reviewDateTime value. + */ + OffsetDateTime reviewDateTime(); + + /** + * Gets the inner com.azure.resourcemanager.reservations.fluent.models.ReservationOrderResponseInner object. + * + * @return the inner object. + */ + ReservationOrderResponseInner innerModel(); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationOrders.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationOrders.java new file mode 100644 index 0000000000000..77d8c4ca8a60e --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationOrders.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ReservationOrders. */ +public interface ReservationOrders { + /** + * Calculate price for a `ReservationOrder`. + * + *

Calculate price for placing a `ReservationOrder`. + * + * @param body Information needed for calculate or purchase reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of calculate price for reservation along with {@link Response}. + */ + Response calculateWithResponse(PurchaseRequest body, Context context); + + /** + * Calculate price for a `ReservationOrder`. + * + *

Calculate price for placing a `ReservationOrder`. + * + * @param body Information needed for calculate or purchase reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of calculate price for reservation. + */ + CalculatePriceResponse calculate(PurchaseRequest body); + + /** + * Get all `ReservationOrder`s. + * + *

List of all the `ReservationOrder`s that the user has access to in the current tenant. + * + * @throws com.azure.core.management.exception.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 `ReservationOrder`s as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Get all `ReservationOrder`s. + * + *

List of all the `ReservationOrder`s that the user has access to in the current tenant. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of `ReservationOrder`s as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Purchase `ReservationOrder` + * + *

Purchase `ReservationOrder` and create resource under the specified URI. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculate or purchase reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 a reservation order being returned. + */ + ReservationOrderResponse purchase(String reservationOrderId, PurchaseRequest body); + + /** + * Purchase `ReservationOrder` + * + *

Purchase `ReservationOrder` and create resource under the specified URI. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for calculate or purchase reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of a reservation order being returned. + */ + ReservationOrderResponse purchase(String reservationOrderId, PurchaseRequest body, Context context); + + /** + * Get a specific `ReservationOrder`. + * + *

Get the details of the `ReservationOrder`. + * + * @param reservationOrderId Order Id of the reservation. + * @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 com.azure.core.management.exception.ManagementException 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` along with {@link Response}. + */ + Response getWithResponse(String reservationOrderId, String expand, Context context); + + /** + * Get a specific `ReservationOrder`. + * + *

Get the details of the `ReservationOrder`. + * + * @param reservationOrderId Order Id of the reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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`. + */ + ReservationOrderResponse get(String reservationOrderId); + + /** + * Change directory of `ReservationOrder`. + * + *

Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to change directory of reservation order. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return change directory response along with {@link Response}. + */ + Response changeDirectoryWithResponse( + String reservationOrderId, ChangeDirectoryRequest body, Context context); + + /** + * Change directory of `ReservationOrder`. + * + *

Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to change directory of reservation order. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return change directory response. + */ + ChangeDirectoryResponse changeDirectory(String reservationOrderId, ChangeDirectoryRequest body); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationResponse.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationResponse.java new file mode 100644 index 0000000000000..5d0f9c2a49761 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationResponse.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.reservations.fluent.models.ReservationResponseInner; + +/** An immutable client-side representation of ReservationResponse. */ +public interface ReservationResponse { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The Azure region where the reserved resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the etag property: The etag property. + * + * @return the etag value. + */ + Integer etag(); + + /** + * Gets the sku property: The sku information associated to this reservation. + * + * @return the sku value. + */ + SkuName sku(); + + /** + * Gets the properties property: The properties associated to this reservation. + * + * @return the properties value. + */ + ReservationsProperties properties(); + + /** + * Gets the kind property: Resource Provider type to be reserved. + * + * @return the kind value. + */ + Kind kind(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.reservations.fluent.models.ReservationResponseInner object. + * + * @return the inner object. + */ + ReservationResponseInner innerModel(); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationSplitProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationSplitProperties.java new file mode 100644 index 0000000000000..46a394469b94c --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationSplitProperties.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of reservation split. */ +@Fluent +public final class ReservationSplitProperties { + /* + * List of destination resource id that are created due to split. Format of the resource id is + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} + */ + @JsonProperty(value = "splitDestinations") + private List splitDestinations; + + /* + * Resource id of the reservation from which this is split. Format of the resource id is + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} + */ + @JsonProperty(value = "splitSource") + private String splitSource; + + /** Creates an instance of ReservationSplitProperties class. */ + public ReservationSplitProperties() { + } + + /** + * Get the splitDestinations property: List of destination resource id that are created due to split. Format of the + * resource id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @return the splitDestinations value. + */ + public List splitDestinations() { + return this.splitDestinations; + } + + /** + * Set the splitDestinations property: List of destination resource id that are created due to split. Format of the + * resource id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @param splitDestinations the splitDestinations value to set. + * @return the ReservationSplitProperties object itself. + */ + public ReservationSplitProperties withSplitDestinations(List splitDestinations) { + this.splitDestinations = splitDestinations; + return this; + } + + /** + * Get the splitSource property: Resource id of the reservation from which this is split. Format of the resource id + * is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @return the splitSource value. + */ + public String splitSource() { + return this.splitSource; + } + + /** + * Set the splitSource property: Resource id of the reservation from which this is split. Format of the resource id + * is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @param splitSource the splitSource value to set. + * @return the ReservationSplitProperties object itself. + */ + public ReservationSplitProperties withSplitSource(String splitSource) { + this.splitSource = splitSource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationStatusCode.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationStatusCode.java new file mode 100644 index 0000000000000..9ada46c2a3c99 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationStatusCode.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ReservationStatusCode. */ +public final class ReservationStatusCode extends ExpandableStringEnum { + /** Static value None for ReservationStatusCode. */ + public static final ReservationStatusCode NONE = fromString("None"); + + /** Static value Pending for ReservationStatusCode. */ + public static final ReservationStatusCode PENDING = fromString("Pending"); + + /** Static value Processing for ReservationStatusCode. */ + public static final ReservationStatusCode PROCESSING = fromString("Processing"); + + /** Static value Active for ReservationStatusCode. */ + public static final ReservationStatusCode ACTIVE = fromString("Active"); + + /** Static value PurchaseError for ReservationStatusCode. */ + public static final ReservationStatusCode PURCHASE_ERROR = fromString("PurchaseError"); + + /** Static value PaymentInstrumentError for ReservationStatusCode. */ + public static final ReservationStatusCode PAYMENT_INSTRUMENT_ERROR = fromString("PaymentInstrumentError"); + + /** Static value Split for ReservationStatusCode. */ + public static final ReservationStatusCode SPLIT = fromString("Split"); + + /** Static value Merged for ReservationStatusCode. */ + public static final ReservationStatusCode MERGED = fromString("Merged"); + + /** Static value Expired for ReservationStatusCode. */ + public static final ReservationStatusCode EXPIRED = fromString("Expired"); + + /** Static value Succeeded for ReservationStatusCode. */ + public static final ReservationStatusCode SUCCEEDED = fromString("Succeeded"); + + /** + * Creates a new instance of ReservationStatusCode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ReservationStatusCode() { + } + + /** + * Creates or finds a ReservationStatusCode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReservationStatusCode. + */ + @JsonCreator + public static ReservationStatusCode fromString(String name) { + return fromString(name, ReservationStatusCode.class); + } + + /** + * Gets known ReservationStatusCode values. + * + * @return known ReservationStatusCode values. + */ + public static Collection values() { + return values(ReservationStatusCode.class); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationSummary.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationSummary.java new file mode 100644 index 0000000000000..0c24f6118aa25 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationSummary.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The roll up count summary of reservations in each state. */ +@Immutable +public final class ReservationSummary { + /* + * The number of reservation in Succeeded state + */ + @JsonProperty(value = "succeededCount", access = JsonProperty.Access.WRITE_ONLY) + private Float succeededCount; + + /* + * The number of reservation in Failed state + */ + @JsonProperty(value = "failedCount", access = JsonProperty.Access.WRITE_ONLY) + private Float failedCount; + + /* + * The number of reservation in Expiring state + */ + @JsonProperty(value = "expiringCount", access = JsonProperty.Access.WRITE_ONLY) + private Float expiringCount; + + /* + * The number of reservation in Expired state + */ + @JsonProperty(value = "expiredCount", access = JsonProperty.Access.WRITE_ONLY) + private Float expiredCount; + + /* + * The number of reservation in Pending state + */ + @JsonProperty(value = "pendingCount", access = JsonProperty.Access.WRITE_ONLY) + private Float pendingCount; + + /* + * The number of reservation in Cancelled state + */ + @JsonProperty(value = "cancelledCount", access = JsonProperty.Access.WRITE_ONLY) + private Float cancelledCount; + + /* + * The number of reservation in Processing state + */ + @JsonProperty(value = "processingCount", access = JsonProperty.Access.WRITE_ONLY) + private Float processingCount; + + /* + * The number of reservation in Warning state + */ + @JsonProperty(value = "warningCount", access = JsonProperty.Access.WRITE_ONLY) + private Float warningCount; + + /* + * The number of reservation in NoBenefit state + */ + @JsonProperty(value = "noBenefitCount", access = JsonProperty.Access.WRITE_ONLY) + private Float noBenefitCount; + + /** Creates an instance of ReservationSummary class. */ + public ReservationSummary() { + } + + /** + * Get the succeededCount property: The number of reservation in Succeeded state. + * + * @return the succeededCount value. + */ + public Float succeededCount() { + return this.succeededCount; + } + + /** + * Get the failedCount property: The number of reservation in Failed state. + * + * @return the failedCount value. + */ + public Float failedCount() { + return this.failedCount; + } + + /** + * Get the expiringCount property: The number of reservation in Expiring state. + * + * @return the expiringCount value. + */ + public Float expiringCount() { + return this.expiringCount; + } + + /** + * Get the expiredCount property: The number of reservation in Expired state. + * + * @return the expiredCount value. + */ + public Float expiredCount() { + return this.expiredCount; + } + + /** + * Get the pendingCount property: The number of reservation in Pending state. + * + * @return the pendingCount value. + */ + public Float pendingCount() { + return this.pendingCount; + } + + /** + * Get the cancelledCount property: The number of reservation in Cancelled state. + * + * @return the cancelledCount value. + */ + public Float cancelledCount() { + return this.cancelledCount; + } + + /** + * Get the processingCount property: The number of reservation in Processing state. + * + * @return the processingCount value. + */ + public Float processingCount() { + return this.processingCount; + } + + /** + * Get the warningCount property: The number of reservation in Warning state. + * + * @return the warningCount value. + */ + public Float warningCount() { + return this.warningCount; + } + + /** + * Get the noBenefitCount property: The number of reservation in NoBenefit state. + * + * @return the noBenefitCount value. + */ + public Float noBenefitCount() { + return this.noBenefitCount; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationSwapProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationSwapProperties.java new file mode 100644 index 0000000000000..0c6be6ba0bac4 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationSwapProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of reservation swap. */ +@Fluent +public final class ReservationSwapProperties { + /* + * Resource id of the source reservation that gets swapped. Format of the resource id is + * /providers/microsoft.capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} + */ + @JsonProperty(value = "swapSource") + private String swapSource; + + /* + * Reservation resource id that the original resource gets swapped to. Format of the resource id is + * /providers/microsoft.capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} + */ + @JsonProperty(value = "swapDestination") + private String swapDestination; + + /** Creates an instance of ReservationSwapProperties class. */ + public ReservationSwapProperties() { + } + + /** + * Get the swapSource property: Resource id of the source reservation that gets swapped. Format of the resource id + * is /providers/microsoft.capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @return the swapSource value. + */ + public String swapSource() { + return this.swapSource; + } + + /** + * Set the swapSource property: Resource id of the source reservation that gets swapped. Format of the resource id + * is /providers/microsoft.capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @param swapSource the swapSource value to set. + * @return the ReservationSwapProperties object itself. + */ + public ReservationSwapProperties withSwapSource(String swapSource) { + this.swapSource = swapSource; + return this; + } + + /** + * Get the swapDestination property: Reservation resource id that the original resource gets swapped to. Format of + * the resource id is + * /providers/microsoft.capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @return the swapDestination value. + */ + public String swapDestination() { + return this.swapDestination; + } + + /** + * Set the swapDestination property: Reservation resource id that the original resource gets swapped to. Format of + * the resource id is + * /providers/microsoft.capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @param swapDestination the swapDestination value to set. + * @return the ReservationSwapProperties object itself. + */ + public ReservationSwapProperties withSwapDestination(String swapDestination) { + this.swapDestination = swapDestination; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationTerm.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationTerm.java new file mode 100644 index 0000000000000..5ad63cb14a3a1 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationTerm.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Represent the term of reservation. */ +public final class ReservationTerm extends ExpandableStringEnum { + /** Static value P1Y for ReservationTerm. */ + public static final ReservationTerm P1Y = fromString("P1Y"); + + /** Static value P3Y for ReservationTerm. */ + public static final ReservationTerm P3Y = fromString("P3Y"); + + /** Static value P5Y for ReservationTerm. */ + public static final ReservationTerm P5Y = fromString("P5Y"); + + /** + * Creates a new instance of ReservationTerm value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ReservationTerm() { + } + + /** + * Creates or finds a ReservationTerm from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReservationTerm. + */ + @JsonCreator + public static ReservationTerm fromString(String name) { + return fromString(name, ReservationTerm.class); + } + + /** + * Gets known ReservationTerm values. + * + * @return known ReservationTerm values. + */ + public static Collection values() { + return values(ReservationTerm.class); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToExchange.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToExchange.java new file mode 100644 index 0000000000000..800b638e112ec --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToExchange.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Reservation refund details. */ +@Fluent +public final class ReservationToExchange { + /* + * Fully qualified id of the reservation being returned. + */ + @JsonProperty(value = "reservationId") + private String reservationId; + + /* + * Quantity to be returned + */ + @JsonProperty(value = "quantity") + private Integer quantity; + + /* + * Pricing information containing the amount and the currency code + */ + @JsonProperty(value = "billingRefundAmount") + private Price billingRefundAmount; + + /* + * billing information + */ + @JsonProperty(value = "billingInformation") + private BillingInformation billingInformation; + + /** Creates an instance of ReservationToExchange class. */ + public ReservationToExchange() { + } + + /** + * Get the reservationId property: Fully qualified id of the reservation being returned. + * + * @return the reservationId value. + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Set the reservationId property: Fully qualified id of the reservation being returned. + * + * @param reservationId the reservationId value to set. + * @return the ReservationToExchange object itself. + */ + public ReservationToExchange withReservationId(String reservationId) { + this.reservationId = reservationId; + return this; + } + + /** + * Get the quantity property: Quantity to be returned. + * + * @return the quantity value. + */ + public Integer quantity() { + return this.quantity; + } + + /** + * Set the quantity property: Quantity to be returned. + * + * @param quantity the quantity value to set. + * @return the ReservationToExchange object itself. + */ + public ReservationToExchange withQuantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get the billingRefundAmount property: Pricing information containing the amount and the currency code. + * + * @return the billingRefundAmount value. + */ + public Price billingRefundAmount() { + return this.billingRefundAmount; + } + + /** + * Set the billingRefundAmount property: Pricing information containing the amount and the currency code. + * + * @param billingRefundAmount the billingRefundAmount value to set. + * @return the ReservationToExchange object itself. + */ + public ReservationToExchange withBillingRefundAmount(Price billingRefundAmount) { + this.billingRefundAmount = billingRefundAmount; + return this; + } + + /** + * Get the billingInformation property: billing information. + * + * @return the billingInformation value. + */ + public BillingInformation billingInformation() { + return this.billingInformation; + } + + /** + * Set the billingInformation property: billing information. + * + * @param billingInformation the billingInformation value to set. + * @return the ReservationToExchange object itself. + */ + public ReservationToExchange withBillingInformation(BillingInformation billingInformation) { + this.billingInformation = billingInformation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (billingRefundAmount() != null) { + billingRefundAmount().validate(); + } + if (billingInformation() != null) { + billingInformation().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToPurchaseCalculateExchange.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToPurchaseCalculateExchange.java new file mode 100644 index 0000000000000..332009445f4c6 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToPurchaseCalculateExchange.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Reservation purchase details. */ +@Fluent +public final class ReservationToPurchaseCalculateExchange { + /* + * The request for reservation purchase + */ + @JsonProperty(value = "properties") + private PurchaseRequest properties; + + /* + * Pricing information containing the amount and the currency code + */ + @JsonProperty(value = "billingCurrencyTotal") + private Price billingCurrencyTotal; + + /** Creates an instance of ReservationToPurchaseCalculateExchange class. */ + public ReservationToPurchaseCalculateExchange() { + } + + /** + * Get the properties property: The request for reservation purchase. + * + * @return the properties value. + */ + public PurchaseRequest properties() { + return this.properties; + } + + /** + * Set the properties property: The request for reservation purchase. + * + * @param properties the properties value to set. + * @return the ReservationToPurchaseCalculateExchange object itself. + */ + public ReservationToPurchaseCalculateExchange withProperties(PurchaseRequest properties) { + this.properties = properties; + return this; + } + + /** + * Get the billingCurrencyTotal property: Pricing information containing the amount and the currency code. + * + * @return the billingCurrencyTotal value. + */ + public Price billingCurrencyTotal() { + return this.billingCurrencyTotal; + } + + /** + * Set the billingCurrencyTotal property: Pricing information containing the amount and the currency code. + * + * @param billingCurrencyTotal the billingCurrencyTotal value to set. + * @return the ReservationToPurchaseCalculateExchange object itself. + */ + public ReservationToPurchaseCalculateExchange withBillingCurrencyTotal(Price billingCurrencyTotal) { + this.billingCurrencyTotal = billingCurrencyTotal; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (billingCurrencyTotal() != null) { + billingCurrencyTotal().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToPurchaseExchange.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToPurchaseExchange.java new file mode 100644 index 0000000000000..7022e6a759901 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToPurchaseExchange.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Reservation purchase details. */ +@Fluent +public final class ReservationToPurchaseExchange { + /* + * Fully qualified id of the reservationOrder being purchased + */ + @JsonProperty(value = "reservationOrderId") + private String reservationOrderId; + + /* + * Fully qualified id of the reservation being purchased. This value is only guaranteed to be non-null if the + * purchase is successful. + */ + @JsonProperty(value = "reservationId") + private String reservationId; + + /* + * The request for reservation purchase + */ + @JsonProperty(value = "properties") + private PurchaseRequest properties; + + /* + * Pricing information containing the amount and the currency code + */ + @JsonProperty(value = "billingCurrencyTotal") + private Price billingCurrencyTotal; + + /* + * Status of the individual operation. + */ + @JsonProperty(value = "status") + private OperationStatus status; + + /** Creates an instance of ReservationToPurchaseExchange class. */ + public ReservationToPurchaseExchange() { + } + + /** + * Get the reservationOrderId property: Fully qualified id of the reservationOrder being purchased. + * + * @return the reservationOrderId value. + */ + public String reservationOrderId() { + return this.reservationOrderId; + } + + /** + * Set the reservationOrderId property: Fully qualified id of the reservationOrder being purchased. + * + * @param reservationOrderId the reservationOrderId value to set. + * @return the ReservationToPurchaseExchange object itself. + */ + public ReservationToPurchaseExchange withReservationOrderId(String reservationOrderId) { + this.reservationOrderId = reservationOrderId; + return this; + } + + /** + * Get the reservationId property: Fully qualified id of the reservation being purchased. This value is only + * guaranteed to be non-null if the purchase is successful. + * + * @return the reservationId value. + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Set the reservationId property: Fully qualified id of the reservation being purchased. This value is only + * guaranteed to be non-null if the purchase is successful. + * + * @param reservationId the reservationId value to set. + * @return the ReservationToPurchaseExchange object itself. + */ + public ReservationToPurchaseExchange withReservationId(String reservationId) { + this.reservationId = reservationId; + return this; + } + + /** + * Get the properties property: The request for reservation purchase. + * + * @return the properties value. + */ + public PurchaseRequest properties() { + return this.properties; + } + + /** + * Set the properties property: The request for reservation purchase. + * + * @param properties the properties value to set. + * @return the ReservationToPurchaseExchange object itself. + */ + public ReservationToPurchaseExchange withProperties(PurchaseRequest properties) { + this.properties = properties; + return this; + } + + /** + * Get the billingCurrencyTotal property: Pricing information containing the amount and the currency code. + * + * @return the billingCurrencyTotal value. + */ + public Price billingCurrencyTotal() { + return this.billingCurrencyTotal; + } + + /** + * Set the billingCurrencyTotal property: Pricing information containing the amount and the currency code. + * + * @param billingCurrencyTotal the billingCurrencyTotal value to set. + * @return the ReservationToPurchaseExchange object itself. + */ + public ReservationToPurchaseExchange withBillingCurrencyTotal(Price billingCurrencyTotal) { + this.billingCurrencyTotal = billingCurrencyTotal; + return this; + } + + /** + * Get the status property: Status of the individual operation. + * + * @return the status value. + */ + public OperationStatus status() { + return this.status; + } + + /** + * Set the status property: Status of the individual operation. + * + * @param status the status value to set. + * @return the ReservationToPurchaseExchange object itself. + */ + public ReservationToPurchaseExchange withStatus(OperationStatus status) { + this.status = status; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (billingCurrencyTotal() != null) { + billingCurrencyTotal().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToReturn.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToReturn.java new file mode 100644 index 0000000000000..6f15ef14de3d1 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToReturn.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Reservation to return. */ +@Fluent +public final class ReservationToReturn { + /* + * Fully qualified identifier of the reservation being returned + */ + @JsonProperty(value = "reservationId") + private String reservationId; + + /* + * Quantity to be returned. Must be greater than zero. + */ + @JsonProperty(value = "quantity") + private Integer quantity; + + /** Creates an instance of ReservationToReturn class. */ + public ReservationToReturn() { + } + + /** + * Get the reservationId property: Fully qualified identifier of the reservation being returned. + * + * @return the reservationId value. + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Set the reservationId property: Fully qualified identifier of the reservation being returned. + * + * @param reservationId the reservationId value to set. + * @return the ReservationToReturn object itself. + */ + public ReservationToReturn withReservationId(String reservationId) { + this.reservationId = reservationId; + return this; + } + + /** + * Get the quantity property: Quantity to be returned. Must be greater than zero. + * + * @return the quantity value. + */ + public Integer quantity() { + return this.quantity; + } + + /** + * Set the quantity property: Quantity to be returned. Must be greater than zero. + * + * @param quantity the quantity value to set. + * @return the ReservationToReturn object itself. + */ + public ReservationToReturn withQuantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToReturnForExchange.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToReturnForExchange.java new file mode 100644 index 0000000000000..0ddb039397b7f --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToReturnForExchange.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Reservation refund details. */ +@Fluent +public final class ReservationToReturnForExchange { + /* + * Fully qualified id of the reservation being returned. + */ + @JsonProperty(value = "reservationId") + private String reservationId; + + /* + * Quantity to be returned + */ + @JsonProperty(value = "quantity") + private Integer quantity; + + /* + * Pricing information containing the amount and the currency code + */ + @JsonProperty(value = "billingRefundAmount") + private Price billingRefundAmount; + + /* + * billing information + */ + @JsonProperty(value = "billingInformation") + private BillingInformation billingInformation; + + /* + * Status of the individual operation. + */ + @JsonProperty(value = "status") + private OperationStatus status; + + /** Creates an instance of ReservationToReturnForExchange class. */ + public ReservationToReturnForExchange() { + } + + /** + * Get the reservationId property: Fully qualified id of the reservation being returned. + * + * @return the reservationId value. + */ + public String reservationId() { + return this.reservationId; + } + + /** + * Set the reservationId property: Fully qualified id of the reservation being returned. + * + * @param reservationId the reservationId value to set. + * @return the ReservationToReturnForExchange object itself. + */ + public ReservationToReturnForExchange withReservationId(String reservationId) { + this.reservationId = reservationId; + return this; + } + + /** + * Get the quantity property: Quantity to be returned. + * + * @return the quantity value. + */ + public Integer quantity() { + return this.quantity; + } + + /** + * Set the quantity property: Quantity to be returned. + * + * @param quantity the quantity value to set. + * @return the ReservationToReturnForExchange object itself. + */ + public ReservationToReturnForExchange withQuantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get the billingRefundAmount property: Pricing information containing the amount and the currency code. + * + * @return the billingRefundAmount value. + */ + public Price billingRefundAmount() { + return this.billingRefundAmount; + } + + /** + * Set the billingRefundAmount property: Pricing information containing the amount and the currency code. + * + * @param billingRefundAmount the billingRefundAmount value to set. + * @return the ReservationToReturnForExchange object itself. + */ + public ReservationToReturnForExchange withBillingRefundAmount(Price billingRefundAmount) { + this.billingRefundAmount = billingRefundAmount; + return this; + } + + /** + * Get the billingInformation property: billing information. + * + * @return the billingInformation value. + */ + public BillingInformation billingInformation() { + return this.billingInformation; + } + + /** + * Set the billingInformation property: billing information. + * + * @param billingInformation the billingInformation value to set. + * @return the ReservationToReturnForExchange object itself. + */ + public ReservationToReturnForExchange withBillingInformation(BillingInformation billingInformation) { + this.billingInformation = billingInformation; + return this; + } + + /** + * Get the status property: Status of the individual operation. + * + * @return the status value. + */ + public OperationStatus status() { + return this.status; + } + + /** + * Set the status property: Status of the individual operation. + * + * @param status the status value to set. + * @return the ReservationToReturnForExchange object itself. + */ + public ReservationToReturnForExchange withStatus(OperationStatus status) { + this.status = status; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (billingRefundAmount() != null) { + billingRefundAmount().validate(); + } + if (billingInformation() != null) { + billingInformation().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationUtilizationAggregates.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationUtilizationAggregates.java new file mode 100644 index 0000000000000..e0a6bf8bf66df --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationUtilizationAggregates.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The aggregate values of reservation utilization. */ +@Immutable +public final class ReservationUtilizationAggregates { + /* + * The grain of the aggregate + */ + @JsonProperty(value = "grain", access = JsonProperty.Access.WRITE_ONLY) + private Float grain; + + /* + * The grain unit of the aggregate + */ + @JsonProperty(value = "grainUnit", access = JsonProperty.Access.WRITE_ONLY) + private String grainUnit; + + /* + * The aggregate value + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private Float value; + + /* + * The aggregate value unit + */ + @JsonProperty(value = "valueUnit", access = JsonProperty.Access.WRITE_ONLY) + private String valueUnit; + + /** Creates an instance of ReservationUtilizationAggregates class. */ + public ReservationUtilizationAggregates() { + } + + /** + * Get the grain property: The grain of the aggregate. + * + * @return the grain value. + */ + public Float grain() { + return this.grain; + } + + /** + * Get the grainUnit property: The grain unit of the aggregate. + * + * @return the grainUnit value. + */ + public String grainUnit() { + return this.grainUnit; + } + + /** + * Get the value property: The aggregate value. + * + * @return the value value. + */ + public Float value() { + return this.value; + } + + /** + * Get the valueUnit property: The aggregate value unit. + * + * @return the valueUnit value. + */ + public String valueUnit() { + return this.valueUnit; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Reservations.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Reservations.java new file mode 100644 index 0000000000000..99a3f2bea4e43 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Reservations.java @@ -0,0 +1,322 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.List; + +/** Resource collection API of Reservations. */ +public interface Reservations { + /** + * Get Available Scopes for `Reservation`. + * + *

Check whether the scopes from request is valid for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param body Scopes to be checked for eligibility. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of available scope api containing scopes and their eligibilities. + */ + AvailableScopeProperties availableScopes( + String reservationOrderId, String reservationId, AvailableScopeRequest body); + + /** + * Get Available Scopes for `Reservation`. + * + *

Check whether the scopes from request is valid for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param body Scopes to be checked for eligibility. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of available scope api containing scopes and their eligibilities. + */ + AvailableScopeProperties availableScopes( + String reservationOrderId, String reservationId, AvailableScopeRequest body, Context context); + + /** + * Split the `Reservation`. + * + *

Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to Split a reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 ReservationResponse. + */ + List split(String reservationOrderId, SplitRequest body); + + /** + * Split the `Reservation`. + * + *

Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed to Split a reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return array of ReservationResponse. + */ + List split(String reservationOrderId, SplitRequest body, Context context); + + /** + * Merges two `Reservation`s. + * + *

Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have + * same properties. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for commercial request for a reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 ReservationResponse. + */ + List merge(String reservationOrderId, MergeRequest body); + + /** + * Merges two `Reservation`s. + * + *

Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have + * same properties. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for commercial request for a reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return array of ReservationResponse. + */ + List merge(String reservationOrderId, MergeRequest body, Context context); + + /** + * Get `Reservation`s in a given reservation Order + * + *

List `Reservation`s within a single `ReservationOrder`. + * + * @param reservationOrderId Order Id of the reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 `Reservation`s as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String reservationOrderId); + + /** + * Get `Reservation`s in a given reservation Order + * + *

List `Reservation`s within a single `ReservationOrder`. + * + * @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 com.azure.core.management.exception.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 `Reservation`s as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String reservationOrderId, Context context); + + /** + * Get `Reservation` details. + * + *

Get specific `Reservation` details. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param expand Supported value of this query is renewProperties. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return specific `Reservation` details along with {@link Response}. + */ + Response getWithResponse( + String reservationOrderId, String reservationId, String expand, Context context); + + /** + * Get `Reservation` details. + * + *

Get specific `Reservation` details. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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. + */ + ReservationResponse get(String reservationOrderId, String reservationId); + + /** + * Updates a `Reservation`. + * + *

Updates the applied scopes of the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param parameters Information needed to patch a reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + ReservationResponse update(String reservationOrderId, String reservationId, PatchModel parameters); + + /** + * Updates a `Reservation`. + * + *

Updates the applied scopes of the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param parameters Information needed to patch a reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the definition of the reservation. + */ + ReservationResponse update(String reservationOrderId, String reservationId, PatchModel parameters, Context context); + + /** + * Archive a `Reservation`. + * + *

Archiving a `Reservation` moves it to `Archived` state. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response archiveWithResponse(String reservationOrderId, String reservationId, Context context); + + /** + * Archive a `Reservation`. + * + *

Archiving a `Reservation` moves it to `Archived` state. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void archive(String reservationOrderId, String reservationId); + + /** + * Unarchive a `Reservation`. + * + *

Restores a `Reservation` to the state it was before archiving. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response unarchiveWithResponse(String reservationOrderId, String reservationId, Context context); + + /** + * Unarchive a `Reservation`. + * + *

Restores a `Reservation` to the state it was before archiving. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void unarchive(String reservationOrderId, String reservationId); + + /** + * Get `Reservation` revisions. + * + *

List of all the revisions for the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 `Reservation`s as paginated response with {@link PagedIterable}. + */ + PagedIterable listRevisions(String reservationOrderId, String reservationId); + + /** + * Get `Reservation` revisions. + * + *

List of all the revisions for the `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the reservation item. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of `Reservation`s as paginated response with {@link PagedIterable}. + */ + PagedIterable listRevisions(String reservationOrderId, String reservationId, Context context); + + /** + * List the reservations and the roll up counts of reservations group by provisioning states that the user has + * access to in the current tenant. + * + * @throws com.azure.core.management.exception.ManagementException thrown if 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 PagedIterable}. + */ + PagedIterable listAll(); + + /** + * List the reservations and the roll up counts of reservations group by provisioning states that the user has + * access to in the current tenant. + * + * @param filter May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does + * not currently support 'ne', 'gt', 'le', 'ge', or 'not'. Reservation properties include sku/name, + * properties/{appliedScopeType, archived, displayName, displayProvisioningState, effectiveDateTime, expiryDate, + * expiryDateTime, provisioningState, quantity, renew, reservedResourceType, term, userFriendlyAppliedScopeType, + * userFriendlyRenewState}. + * @param orderby May be used to sort order by reservation properties. + * @param refreshSummary To indicate whether to refresh the roll up counts of the reservations group by provisioning + * states. + * @param skiptoken The number of reservations to skip from the list before returning results. + * @param selectedState The selected provisioning state. + * @param take To number of reservations to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of reservations and summary of roll out count of reservations in each state as paginated + * response with {@link PagedIterable}. + */ + PagedIterable listAll( + String filter, + String orderby, + String refreshSummary, + Float skiptoken, + String selectedState, + Float take, + Context context); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationsListResult.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationsListResult.java new file mode 100644 index 0000000000000..d418bf1e5a681 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationsListResult.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.fluent.models.ReservationResponseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of reservations and summary of roll out count of reservations in each state. */ +@Fluent +public final class ReservationsListResult { + /* + * The list of reservations. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link (url) to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /* + * The roll out count summary of the reservations + */ + @JsonProperty(value = "summary") + private ReservationSummary summary; + + /** Creates an instance of ReservationsListResult class. */ + public ReservationsListResult() { + } + + /** + * Get the value property: The list of reservations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link (url) to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the summary property: The roll out count summary of the reservations. + * + * @return the summary value. + */ + public ReservationSummary summary() { + return this.summary; + } + + /** + * Set the summary property: The roll out count summary of the reservations. + * + * @param summary the summary value to set. + * @return the ReservationsListResult object itself. + */ + public ReservationsListResult withSummary(ReservationSummary summary) { + this.summary = summary; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + if (summary() != null) { + summary().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationsProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationsProperties.java new file mode 100644 index 0000000000000..951f83c63f21d --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationsProperties.java @@ -0,0 +1,911 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.List; + +/** The properties of the reservations. */ +@Fluent +public final class ReservationsProperties { + /* + * The type of the resource that is being reserved. + */ + @JsonProperty(value = "reservedResourceType") + private ReservedResourceType reservedResourceType; + + /* + * Allows reservation discount to be applied across skus within the same auto fit group. Not all skus support + * instance size flexibility. + */ + @JsonProperty(value = "instanceFlexibility") + private InstanceFlexibility instanceFlexibility; + + /* + * Friendly name for user to easily identify the reservation + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The list of applied scopes + */ + @JsonProperty(value = "appliedScopes") + private List appliedScopes; + + /* + * The applied scope type + */ + @JsonProperty(value = "appliedScopeType") + private AppliedScopeType appliedScopeType; + + /* + * Indicates if the reservation is archived + */ + @JsonProperty(value = "archived") + private Boolean archived; + + /* + * Capabilities of the reservation + */ + @JsonProperty(value = "capabilities") + private String capabilities; + + /* + * Quantity of the skus that are part of the reservation. + */ + @JsonProperty(value = "quantity") + private Integer quantity; + + /* + * Current state of the reservation. + */ + @JsonProperty(value = "provisioningState") + private ProvisioningState provisioningState; + + /* + * DateTime of the reservation starting when this version is effective from. + */ + @JsonProperty(value = "effectiveDateTime") + private OffsetDateTime effectiveDateTime; + + /* + * This is the DateTime when the reservation benefit started. + */ + @JsonProperty(value = "benefitStartTime") + private OffsetDateTime benefitStartTime; + + /* + * DateTime of the last time the reservation was updated. + */ + @JsonProperty(value = "lastUpdatedDateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUpdatedDateTime; + + /* + * This is the date when the reservation will expire. + */ + @JsonProperty(value = "expiryDate") + private LocalDate expiryDate; + + /* + * This is the date-time when the reservation will expire. + */ + @JsonProperty(value = "expiryDateTime") + private OffsetDateTime expiryDateTime; + + /* + * This is the date-time when the Azure Hybrid Benefit needs to be reviewed. + */ + @JsonProperty(value = "reviewDateTime") + private OffsetDateTime reviewDateTime; + + /* + * Description of the sku in english. + */ + @JsonProperty(value = "skuDescription") + private String skuDescription; + + /* + * The message giving detailed information about the status code. + */ + @JsonProperty(value = "extendedStatusInfo") + private ExtendedStatusInfo extendedStatusInfo; + + /* + * The billing plan options available for this sku. + */ + @JsonProperty(value = "billingPlan") + private ReservationBillingPlan billingPlan; + + /* + * The provisioning state of the reservation for display, e.g. Succeeded + */ + @JsonProperty(value = "displayProvisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String displayProvisioningState; + + /* + * The provisioning sub-state of the reservation, e.g. Succeeded + */ + @JsonProperty(value = "provisioningSubState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningSubState; + + /* + * This is the date when the reservation was purchased. + */ + @JsonProperty(value = "purchaseDate") + private LocalDate purchaseDate; + + /* + * This is the date-time when the reservation was purchased. + */ + @JsonProperty(value = "purchaseDateTime") + private OffsetDateTime purchaseDateTime; + + /* + * Properties of reservation split + */ + @JsonProperty(value = "splitProperties") + private ReservationSplitProperties splitProperties; + + /* + * Properties of reservation merge + */ + @JsonProperty(value = "mergeProperties") + private ReservationMergeProperties mergeProperties; + + /* + * Properties of reservation swap + */ + @JsonProperty(value = "swapProperties") + private ReservationSwapProperties swapProperties; + + /* + * Properties specific to applied scope type. Not required if not applicable. Required and need to provide tenantId + * and managementGroupId if AppliedScopeType is ManagementGroup + */ + @JsonProperty(value = "appliedScopeProperties") + private AppliedScopeProperties appliedScopeProperties; + + /* + * Subscription that will be charged for purchasing reservation or savings plan + */ + @JsonProperty(value = "billingScopeId") + private String billingScopeId; + + /* + * Setting this to true will automatically purchase a new reservation on the expiration date time. + */ + @JsonProperty(value = "renew") + private Boolean renew; + + /* + * Reservation Id of the reservation from which this reservation is renewed. Format of the resource Id is + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + */ + @JsonProperty(value = "renewSource") + private String renewSource; + + /* + * Reservation Id of the reservation which is purchased because of renew. Format of the resource Id is + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + */ + @JsonProperty(value = "renewDestination") + private String renewDestination; + + /* + * The renew properties for a reservation. + */ + @JsonProperty(value = "renewProperties") + private RenewPropertiesResponse renewProperties; + + /* + * Represent the term of reservation. + */ + @JsonProperty(value = "term") + private ReservationTerm term; + + /* + * The applied scope type of the reservation for display, e.g. Shared + */ + @JsonProperty(value = "userFriendlyAppliedScopeType", access = JsonProperty.Access.WRITE_ONLY) + private String userFriendlyAppliedScopeType; + + /* + * The renew state of the reservation for display, e.g. On + */ + @JsonProperty(value = "userFriendlyRenewState", access = JsonProperty.Access.WRITE_ONLY) + private String userFriendlyRenewState; + + /* + * Reservation utilization + */ + @JsonProperty(value = "utilization", access = JsonProperty.Access.WRITE_ONLY) + private ReservationsPropertiesUtilization utilization; + + /** Creates an instance of ReservationsProperties class. */ + public ReservationsProperties() { + } + + /** + * Get the reservedResourceType property: The type of the resource that is being reserved. + * + * @return the reservedResourceType value. + */ + public ReservedResourceType reservedResourceType() { + return this.reservedResourceType; + } + + /** + * Set the reservedResourceType property: The type of the resource that is being reserved. + * + * @param reservedResourceType the reservedResourceType value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withReservedResourceType(ReservedResourceType reservedResourceType) { + this.reservedResourceType = reservedResourceType; + return this; + } + + /** + * Get the instanceFlexibility property: Allows reservation discount to be applied across skus within the same auto + * fit group. Not all skus support instance size flexibility. + * + * @return the instanceFlexibility value. + */ + public InstanceFlexibility instanceFlexibility() { + return this.instanceFlexibility; + } + + /** + * Set the instanceFlexibility property: Allows reservation discount to be applied across skus within the same auto + * fit group. Not all skus support instance size flexibility. + * + * @param instanceFlexibility the instanceFlexibility value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withInstanceFlexibility(InstanceFlexibility instanceFlexibility) { + this.instanceFlexibility = instanceFlexibility; + return this; + } + + /** + * Get the displayName property: Friendly name for user to easily identify the reservation. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Friendly name for user to easily identify the reservation. + * + * @param displayName the displayName value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the appliedScopes property: The list of applied scopes. + * + * @return the appliedScopes value. + */ + public List appliedScopes() { + return this.appliedScopes; + } + + /** + * Set the appliedScopes property: The list of applied scopes. + * + * @param appliedScopes the appliedScopes value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withAppliedScopes(List appliedScopes) { + this.appliedScopes = appliedScopes; + return this; + } + + /** + * Get the appliedScopeType property: The applied scope type. + * + * @return the appliedScopeType value. + */ + public AppliedScopeType appliedScopeType() { + return this.appliedScopeType; + } + + /** + * Set the appliedScopeType property: The applied scope type. + * + * @param appliedScopeType the appliedScopeType value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withAppliedScopeType(AppliedScopeType appliedScopeType) { + this.appliedScopeType = appliedScopeType; + return this; + } + + /** + * Get the archived property: Indicates if the reservation is archived. + * + * @return the archived value. + */ + public Boolean archived() { + return this.archived; + } + + /** + * Set the archived property: Indicates if the reservation is archived. + * + * @param archived the archived value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withArchived(Boolean archived) { + this.archived = archived; + return this; + } + + /** + * Get the capabilities property: Capabilities of the reservation. + * + * @return the capabilities value. + */ + public String capabilities() { + return this.capabilities; + } + + /** + * Set the capabilities property: Capabilities of the reservation. + * + * @param capabilities the capabilities value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withCapabilities(String capabilities) { + this.capabilities = capabilities; + return this; + } + + /** + * Get the quantity property: Quantity of the skus that are part of the reservation. + * + * @return the quantity value. + */ + public Integer quantity() { + return this.quantity; + } + + /** + * Set the quantity property: Quantity of the skus that are part of the reservation. + * + * @param quantity the quantity value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withQuantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get the provisioningState property: Current state of the reservation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: Current state of the reservation. + * + * @param provisioningState the provisioningState value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the effectiveDateTime property: DateTime of the reservation starting when this version is effective from. + * + * @return the effectiveDateTime value. + */ + public OffsetDateTime effectiveDateTime() { + return this.effectiveDateTime; + } + + /** + * Set the effectiveDateTime property: DateTime of the reservation starting when this version is effective from. + * + * @param effectiveDateTime the effectiveDateTime value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withEffectiveDateTime(OffsetDateTime effectiveDateTime) { + this.effectiveDateTime = effectiveDateTime; + return this; + } + + /** + * Get the benefitStartTime property: This is the DateTime when the reservation benefit started. + * + * @return the benefitStartTime value. + */ + public OffsetDateTime benefitStartTime() { + return this.benefitStartTime; + } + + /** + * Set the benefitStartTime property: This is the DateTime when the reservation benefit started. + * + * @param benefitStartTime the benefitStartTime value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withBenefitStartTime(OffsetDateTime benefitStartTime) { + this.benefitStartTime = benefitStartTime; + return this; + } + + /** + * Get the lastUpdatedDateTime property: DateTime of the last time the reservation was updated. + * + * @return the lastUpdatedDateTime value. + */ + public OffsetDateTime lastUpdatedDateTime() { + return this.lastUpdatedDateTime; + } + + /** + * Get the expiryDate property: This is the date when the reservation will expire. + * + * @return the expiryDate value. + */ + public LocalDate expiryDate() { + return this.expiryDate; + } + + /** + * Set the expiryDate property: This is the date when the reservation will expire. + * + * @param expiryDate the expiryDate value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withExpiryDate(LocalDate expiryDate) { + this.expiryDate = expiryDate; + return this; + } + + /** + * Get the expiryDateTime property: This is the date-time when the reservation will expire. + * + * @return the expiryDateTime value. + */ + public OffsetDateTime expiryDateTime() { + return this.expiryDateTime; + } + + /** + * Set the expiryDateTime property: This is the date-time when the reservation will expire. + * + * @param expiryDateTime the expiryDateTime value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withExpiryDateTime(OffsetDateTime expiryDateTime) { + this.expiryDateTime = expiryDateTime; + return this; + } + + /** + * Get the reviewDateTime property: This is the date-time when the Azure Hybrid Benefit needs to be reviewed. + * + * @return the reviewDateTime value. + */ + public OffsetDateTime reviewDateTime() { + return this.reviewDateTime; + } + + /** + * Set the reviewDateTime property: This is the date-time when the Azure Hybrid Benefit needs to be reviewed. + * + * @param reviewDateTime the reviewDateTime value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withReviewDateTime(OffsetDateTime reviewDateTime) { + this.reviewDateTime = reviewDateTime; + return this; + } + + /** + * Get the skuDescription property: Description of the sku in english. + * + * @return the skuDescription value. + */ + public String skuDescription() { + return this.skuDescription; + } + + /** + * Set the skuDescription property: Description of the sku in english. + * + * @param skuDescription the skuDescription value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withSkuDescription(String skuDescription) { + this.skuDescription = skuDescription; + return this; + } + + /** + * Get the extendedStatusInfo property: The message giving detailed information about the status code. + * + * @return the extendedStatusInfo value. + */ + public ExtendedStatusInfo extendedStatusInfo() { + return this.extendedStatusInfo; + } + + /** + * Set the extendedStatusInfo property: The message giving detailed information about the status code. + * + * @param extendedStatusInfo the extendedStatusInfo value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withExtendedStatusInfo(ExtendedStatusInfo extendedStatusInfo) { + this.extendedStatusInfo = extendedStatusInfo; + return this; + } + + /** + * Get the billingPlan property: The billing plan options available for this sku. + * + * @return the billingPlan value. + */ + public ReservationBillingPlan billingPlan() { + return this.billingPlan; + } + + /** + * Set the billingPlan property: The billing plan options available for this sku. + * + * @param billingPlan the billingPlan value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withBillingPlan(ReservationBillingPlan billingPlan) { + this.billingPlan = billingPlan; + return this; + } + + /** + * Get the displayProvisioningState property: The provisioning state of the reservation for display, e.g. Succeeded. + * + * @return the displayProvisioningState value. + */ + public String displayProvisioningState() { + return this.displayProvisioningState; + } + + /** + * Get the provisioningSubState property: The provisioning sub-state of the reservation, e.g. Succeeded. + * + * @return the provisioningSubState value. + */ + public String provisioningSubState() { + return this.provisioningSubState; + } + + /** + * Get the purchaseDate property: This is the date when the reservation was purchased. + * + * @return the purchaseDate value. + */ + public LocalDate purchaseDate() { + return this.purchaseDate; + } + + /** + * Set the purchaseDate property: This is the date when the reservation was purchased. + * + * @param purchaseDate the purchaseDate value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withPurchaseDate(LocalDate purchaseDate) { + this.purchaseDate = purchaseDate; + return this; + } + + /** + * Get the purchaseDateTime property: This is the date-time when the reservation was purchased. + * + * @return the purchaseDateTime value. + */ + public OffsetDateTime purchaseDateTime() { + return this.purchaseDateTime; + } + + /** + * Set the purchaseDateTime property: This is the date-time when the reservation was purchased. + * + * @param purchaseDateTime the purchaseDateTime value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withPurchaseDateTime(OffsetDateTime purchaseDateTime) { + this.purchaseDateTime = purchaseDateTime; + return this; + } + + /** + * Get the splitProperties property: Properties of reservation split. + * + * @return the splitProperties value. + */ + public ReservationSplitProperties splitProperties() { + return this.splitProperties; + } + + /** + * Set the splitProperties property: Properties of reservation split. + * + * @param splitProperties the splitProperties value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withSplitProperties(ReservationSplitProperties splitProperties) { + this.splitProperties = splitProperties; + return this; + } + + /** + * Get the mergeProperties property: Properties of reservation merge. + * + * @return the mergeProperties value. + */ + public ReservationMergeProperties mergeProperties() { + return this.mergeProperties; + } + + /** + * Set the mergeProperties property: Properties of reservation merge. + * + * @param mergeProperties the mergeProperties value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withMergeProperties(ReservationMergeProperties mergeProperties) { + this.mergeProperties = mergeProperties; + return this; + } + + /** + * Get the swapProperties property: Properties of reservation swap. + * + * @return the swapProperties value. + */ + public ReservationSwapProperties swapProperties() { + return this.swapProperties; + } + + /** + * Set the swapProperties property: Properties of reservation swap. + * + * @param swapProperties the swapProperties value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withSwapProperties(ReservationSwapProperties swapProperties) { + this.swapProperties = swapProperties; + return this; + } + + /** + * Get the appliedScopeProperties property: Properties specific to applied scope type. Not required if not + * applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup. + * + * @return the appliedScopeProperties value. + */ + public AppliedScopeProperties appliedScopeProperties() { + return this.appliedScopeProperties; + } + + /** + * Set the appliedScopeProperties property: Properties specific to applied scope type. Not required if not + * applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup. + * + * @param appliedScopeProperties the appliedScopeProperties value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withAppliedScopeProperties(AppliedScopeProperties appliedScopeProperties) { + this.appliedScopeProperties = appliedScopeProperties; + return this; + } + + /** + * Get the billingScopeId property: Subscription that will be charged for purchasing reservation or savings plan. + * + * @return the billingScopeId value. + */ + public String billingScopeId() { + return this.billingScopeId; + } + + /** + * Set the billingScopeId property: Subscription that will be charged for purchasing reservation or savings plan. + * + * @param billingScopeId the billingScopeId value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withBillingScopeId(String billingScopeId) { + this.billingScopeId = billingScopeId; + return this; + } + + /** + * Get the renew property: Setting this to true will automatically purchase a new reservation on the expiration date + * time. + * + * @return the renew value. + */ + public Boolean renew() { + return this.renew; + } + + /** + * Set the renew property: Setting this to true will automatically purchase a new reservation on the expiration date + * time. + * + * @param renew the renew value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withRenew(Boolean renew) { + this.renew = renew; + return this; + } + + /** + * Get the renewSource property: Reservation Id of the reservation from which this reservation is renewed. Format of + * the resource Id is + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @return the renewSource value. + */ + public String renewSource() { + return this.renewSource; + } + + /** + * Set the renewSource property: Reservation Id of the reservation from which this reservation is renewed. Format of + * the resource Id is + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @param renewSource the renewSource value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withRenewSource(String renewSource) { + this.renewSource = renewSource; + return this; + } + + /** + * Get the renewDestination property: Reservation Id of the reservation which is purchased because of renew. Format + * of the resource Id is + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @return the renewDestination value. + */ + public String renewDestination() { + return this.renewDestination; + } + + /** + * Set the renewDestination property: Reservation Id of the reservation which is purchased because of renew. Format + * of the resource Id is + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @param renewDestination the renewDestination value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withRenewDestination(String renewDestination) { + this.renewDestination = renewDestination; + return this; + } + + /** + * Get the renewProperties property: The renew properties for a reservation. + * + * @return the renewProperties value. + */ + public RenewPropertiesResponse renewProperties() { + return this.renewProperties; + } + + /** + * Set the renewProperties property: The renew properties for a reservation. + * + * @param renewProperties the renewProperties value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withRenewProperties(RenewPropertiesResponse renewProperties) { + this.renewProperties = renewProperties; + return this; + } + + /** + * Get the term property: Represent the term of reservation. + * + * @return the term value. + */ + public ReservationTerm term() { + return this.term; + } + + /** + * Set the term property: Represent the term of reservation. + * + * @param term the term value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withTerm(ReservationTerm term) { + this.term = term; + return this; + } + + /** + * Get the userFriendlyAppliedScopeType property: The applied scope type of the reservation for display, e.g. + * Shared. + * + * @return the userFriendlyAppliedScopeType value. + */ + public String userFriendlyAppliedScopeType() { + return this.userFriendlyAppliedScopeType; + } + + /** + * Get the userFriendlyRenewState property: The renew state of the reservation for display, e.g. On. + * + * @return the userFriendlyRenewState value. + */ + public String userFriendlyRenewState() { + return this.userFriendlyRenewState; + } + + /** + * Get the utilization property: Reservation utilization. + * + * @return the utilization value. + */ + public ReservationsPropertiesUtilization utilization() { + return this.utilization; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (extendedStatusInfo() != null) { + extendedStatusInfo().validate(); + } + if (splitProperties() != null) { + splitProperties().validate(); + } + if (mergeProperties() != null) { + mergeProperties().validate(); + } + if (swapProperties() != null) { + swapProperties().validate(); + } + if (appliedScopeProperties() != null) { + appliedScopeProperties().validate(); + } + if (renewProperties() != null) { + renewProperties().validate(); + } + if (utilization() != null) { + utilization().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationsPropertiesUtilization.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationsPropertiesUtilization.java new file mode 100644 index 0000000000000..bfc2f8357e69d --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationsPropertiesUtilization.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Reservation utilization. */ +@Fluent +public final class ReservationsPropertiesUtilization { + /* + * last 7 day utilization trend for a reservation + */ + @JsonProperty(value = "trend", access = JsonProperty.Access.WRITE_ONLY) + private String trend; + + /* + * The array of aggregates of a reservation's utilization + */ + @JsonProperty(value = "aggregates") + private List aggregates; + + /** Creates an instance of ReservationsPropertiesUtilization class. */ + public ReservationsPropertiesUtilization() { + } + + /** + * Get the trend property: last 7 day utilization trend for a reservation. + * + * @return the trend value. + */ + public String trend() { + return this.trend; + } + + /** + * Get the aggregates property: The array of aggregates of a reservation's utilization. + * + * @return the aggregates value. + */ + public List aggregates() { + return this.aggregates; + } + + /** + * Set the aggregates property: The array of aggregates of a reservation's utilization. + * + * @param aggregates the aggregates value to set. + * @return the ReservationsPropertiesUtilization object itself. + */ + public ReservationsPropertiesUtilization withAggregates(List aggregates) { + this.aggregates = aggregates; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (aggregates() != null) { + aggregates().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservedResourceType.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservedResourceType.java new file mode 100644 index 0000000000000..5327307087662 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservedResourceType.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The type of the resource that is being reserved. */ +public final class ReservedResourceType extends ExpandableStringEnum { + /** Static value VirtualMachines for ReservedResourceType. */ + public static final ReservedResourceType VIRTUAL_MACHINES = fromString("VirtualMachines"); + + /** Static value SqlDatabases for ReservedResourceType. */ + public static final ReservedResourceType SQL_DATABASES = fromString("SqlDatabases"); + + /** Static value SuseLinux for ReservedResourceType. */ + public static final ReservedResourceType SUSE_LINUX = fromString("SuseLinux"); + + /** Static value CosmosDb for ReservedResourceType. */ + public static final ReservedResourceType COSMOS_DB = fromString("CosmosDb"); + + /** Static value RedHat for ReservedResourceType. */ + public static final ReservedResourceType RED_HAT = fromString("RedHat"); + + /** Static value SqlDataWarehouse for ReservedResourceType. */ + public static final ReservedResourceType SQL_DATA_WAREHOUSE = fromString("SqlDataWarehouse"); + + /** Static value VMwareCloudSimple for ReservedResourceType. */ + public static final ReservedResourceType VMWARE_CLOUD_SIMPLE = fromString("VMwareCloudSimple"); + + /** Static value RedHatOsa for ReservedResourceType. */ + public static final ReservedResourceType RED_HAT_OSA = fromString("RedHatOsa"); + + /** Static value Databricks for ReservedResourceType. */ + public static final ReservedResourceType DATABRICKS = fromString("Databricks"); + + /** Static value AppService for ReservedResourceType. */ + public static final ReservedResourceType APP_SERVICE = fromString("AppService"); + + /** Static value ManagedDisk for ReservedResourceType. */ + public static final ReservedResourceType MANAGED_DISK = fromString("ManagedDisk"); + + /** Static value BlockBlob for ReservedResourceType. */ + public static final ReservedResourceType BLOCK_BLOB = fromString("BlockBlob"); + + /** Static value RedisCache for ReservedResourceType. */ + public static final ReservedResourceType REDIS_CACHE = fromString("RedisCache"); + + /** Static value AzureDataExplorer for ReservedResourceType. */ + public static final ReservedResourceType AZURE_DATA_EXPLORER = fromString("AzureDataExplorer"); + + /** Static value MySql for ReservedResourceType. */ + public static final ReservedResourceType MY_SQL = fromString("MySql"); + + /** Static value MariaDb for ReservedResourceType. */ + public static final ReservedResourceType MARIA_DB = fromString("MariaDb"); + + /** Static value PostgreSql for ReservedResourceType. */ + public static final ReservedResourceType POSTGRE_SQL = fromString("PostgreSql"); + + /** Static value DedicatedHost for ReservedResourceType. */ + public static final ReservedResourceType DEDICATED_HOST = fromString("DedicatedHost"); + + /** Static value SapHana for ReservedResourceType. */ + public static final ReservedResourceType SAP_HANA = fromString("SapHana"); + + /** Static value SqlAzureHybridBenefit for ReservedResourceType. */ + public static final ReservedResourceType SQL_AZURE_HYBRID_BENEFIT = fromString("SqlAzureHybridBenefit"); + + /** Static value AVS for ReservedResourceType. */ + public static final ReservedResourceType AVS = fromString("AVS"); + + /** Static value DataFactory for ReservedResourceType. */ + public static final ReservedResourceType DATA_FACTORY = fromString("DataFactory"); + + /** Static value NetAppStorage for ReservedResourceType. */ + public static final ReservedResourceType NET_APP_STORAGE = fromString("NetAppStorage"); + + /** Static value AzureFiles for ReservedResourceType. */ + public static final ReservedResourceType AZURE_FILES = fromString("AzureFiles"); + + /** Static value SqlEdge for ReservedResourceType. */ + public static final ReservedResourceType SQL_EDGE = fromString("SqlEdge"); + + /** Static value VirtualMachineSoftware for ReservedResourceType. */ + public static final ReservedResourceType VIRTUAL_MACHINE_SOFTWARE = fromString("VirtualMachineSoftware"); + + /** + * Creates a new instance of ReservedResourceType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ReservedResourceType() { + } + + /** + * Creates or finds a ReservedResourceType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReservedResourceType. + */ + @JsonCreator + public static ReservedResourceType fromString(String name) { + return fromString(name, ReservedResourceType.class); + } + + /** + * Gets known ReservedResourceType values. + * + * @return known ReservedResourceType values. + */ + public static Collection values() { + return values(ReservedResourceType.class); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ResourceName.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ResourceName.java new file mode 100644 index 0000000000000..38b9b89d3e042 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ResourceName.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Resource name provided by the resource provider. Use this property for quotaRequest parameter. */ +@Fluent +public final class ResourceName { + /* + * Resource name. + */ + @JsonProperty(value = "value") + private String value; + + /* + * Resource display localized name. + */ + @JsonProperty(value = "localizedValue", access = JsonProperty.Access.WRITE_ONLY) + private String localizedValue; + + /** Creates an instance of ResourceName class. */ + public ResourceName() { + } + + /** + * Get the value property: Resource name. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: Resource name. + * + * @param value the value value to set. + * @return the ResourceName object itself. + */ + public ResourceName withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the localizedValue property: Resource display localized name. + * + * @return the localizedValue value. + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ResourceProviders.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ResourceProviders.java new file mode 100644 index 0000000000000..9acc84469e046 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ResourceProviders.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ResourceProviders. */ +public interface ResourceProviders { + /** + * Get the regions and skus that are available for RI purchase for the specified Azure subscription. + * + * @param subscriptionId Id of the subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the regions and skus that are available for RI purchase for the specified Azure subscription as paginated + * response with {@link PagedIterable}. + */ + PagedIterable list(String subscriptionId); + + /** + * Get the regions and skus that are available for RI purchase for the specified Azure subscription. + * + * @param subscriptionId Id of the subscription. + * @param reservedResourceType The type of the resource for which the skus should be provided. + * @param location Filters the skus based on the location specified in this parameter. This can be an Azure region + * or global. + * @param publisherId Publisher id used to get the third party products. + * @param offerId Offer id used to get the third party products. + * @param planId Plan id used to get the third party products. + * @param filter May be used to filter by Catalog properties. The filter supports 'eq', 'or', and 'and'. + * @param skip The number of reservations to skip from the list before returning results. + * @param take To number of reservations to return. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the regions and skus that are available for RI purchase for the specified Azure subscription as paginated + * response with {@link PagedIterable}. + */ + PagedIterable list( + String subscriptionId, + String reservedResourceType, + String location, + String publisherId, + String offerId, + String planId, + String filter, + Float skip, + Float take, + Context context); + + /** + * Get list of applicable `Reservation`s. + * + *

Get applicable `Reservation`s that are applied to this subscription or a resource group under this + * subscription. + * + * @param subscriptionId Id of the subscription. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return applicable `Reservation`s that are applied to this subscription or a resource group under this + * subscription along with {@link Response}. + */ + Response getAppliedReservationListWithResponse(String subscriptionId, Context context); + + /** + * Get list of applicable `Reservation`s. + * + *

Get applicable `Reservation`s that are applied to this subscription or a resource group under this + * subscription. + * + * @param subscriptionId Id of the subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return applicable `Reservation`s that are applied to this subscription or a resource group under this + * subscription. + */ + AppliedReservations getAppliedReservationList(String subscriptionId); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ResourceType.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ResourceType.java new file mode 100644 index 0000000000000..faabe6ee07b56 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ResourceType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The resource types. */ +public final class ResourceType extends ExpandableStringEnum { + /** Static value standard for ResourceType. */ + public static final ResourceType STANDARD = fromString("standard"); + + /** Static value dedicated for ResourceType. */ + public static final ResourceType DEDICATED = fromString("dedicated"); + + /** Static value lowPriority for ResourceType. */ + public static final ResourceType LOW_PRIORITY = fromString("lowPriority"); + + /** Static value shared for ResourceType. */ + public static final ResourceType SHARED = fromString("shared"); + + /** Static value serviceSpecific for ResourceType. */ + public static final ResourceType SERVICE_SPECIFIC = fromString("serviceSpecific"); + + /** + * Creates a new instance of ResourceType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ResourceType() { + } + + /** + * Creates or finds a ResourceType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceType. + */ + @JsonCreator + public static ResourceType fromString(String name) { + return fromString(name, ResourceType.class); + } + + /** + * Gets known ResourceType values. + * + * @return known ResourceType values. + */ + public static Collection values() { + return values(ResourceType.class); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Returns.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Returns.java new file mode 100644 index 0000000000000..1f913eba9a63c --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Returns.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.util.Context; + +/** Resource collection API of Returns. */ +public interface Returns { + /** + * Return a reservation. + * + *

Return a reservation and get refund information. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for returning reservation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of refund request containing refund information of reservation. + */ + RefundResponse post(String reservationOrderId, RefundRequest body); + + /** + * Return a reservation. + * + *

Return a reservation and get refund information. + * + * @param reservationOrderId Order Id of the reservation. + * @param body Information needed for returning reservation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of refund request containing refund information of reservation. + */ + RefundResponse post(String reservationOrderId, RefundRequest body, Context context); +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SavingsPlanPurchaseRequest.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SavingsPlanPurchaseRequest.java new file mode 100644 index 0000000000000..1c85445869040 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SavingsPlanPurchaseRequest.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.fluent.models.SavingsPlanPurchaseRequestProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Request body for savings plan purchase. */ +@Fluent +public final class SavingsPlanPurchaseRequest { + /* + * The name of sku + */ + @JsonProperty(value = "sku") + private SkuName sku; + + /* + * Properties of a savings plan purchase + */ + @JsonProperty(value = "properties") + private SavingsPlanPurchaseRequestProperties innerProperties; + + /** Creates an instance of SavingsPlanPurchaseRequest class. */ + public SavingsPlanPurchaseRequest() { + } + + /** + * Get the sku property: The name of sku. + * + * @return the sku value. + */ + public SkuName sku() { + return this.sku; + } + + /** + * Set the sku property: The name of sku. + * + * @param sku the sku value to set. + * @return the SavingsPlanPurchaseRequest object itself. + */ + public SavingsPlanPurchaseRequest withSku(SkuName sku) { + this.sku = sku; + return this; + } + + /** + * Get the innerProperties property: Properties of a savings plan purchase. + * + * @return the innerProperties value. + */ + private SavingsPlanPurchaseRequestProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the displayName property: Friendly name of the savings plan. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: Friendly name of the savings plan. + * + * @param displayName the displayName value to set. + * @return the SavingsPlanPurchaseRequest object itself. + */ + public SavingsPlanPurchaseRequest withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new SavingsPlanPurchaseRequestProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the billingScopeId property: Subscription that will be charged for purchasing reservation or savings plan. + * + * @return the billingScopeId value. + */ + public String billingScopeId() { + return this.innerProperties() == null ? null : this.innerProperties().billingScopeId(); + } + + /** + * Set the billingScopeId property: Subscription that will be charged for purchasing reservation or savings plan. + * + * @param billingScopeId the billingScopeId value to set. + * @return the SavingsPlanPurchaseRequest object itself. + */ + public SavingsPlanPurchaseRequest withBillingScopeId(String billingScopeId) { + if (this.innerProperties() == null) { + this.innerProperties = new SavingsPlanPurchaseRequestProperties(); + } + this.innerProperties().withBillingScopeId(billingScopeId); + return this; + } + + /** + * Get the term property: Represent savings plan term in ISO 8601 format. + * + * @return the term value. + */ + public SavingsPlanTerm term() { + return this.innerProperties() == null ? null : this.innerProperties().term(); + } + + /** + * Set the term property: Represent savings plan term in ISO 8601 format. + * + * @param term the term value to set. + * @return the SavingsPlanPurchaseRequest object itself. + */ + public SavingsPlanPurchaseRequest withTerm(SavingsPlanTerm term) { + if (this.innerProperties() == null) { + this.innerProperties = new SavingsPlanPurchaseRequestProperties(); + } + this.innerProperties().withTerm(term); + return this; + } + + /** + * Get the billingPlan property: Represents the billing plan in ISO 8601 format. Required only for monthly billing + * plans. + * + * @return the billingPlan value. + */ + public BillingPlan billingPlan() { + return this.innerProperties() == null ? null : this.innerProperties().billingPlan(); + } + + /** + * Set the billingPlan property: Represents the billing plan in ISO 8601 format. Required only for monthly billing + * plans. + * + * @param billingPlan the billingPlan value to set. + * @return the SavingsPlanPurchaseRequest object itself. + */ + public SavingsPlanPurchaseRequest withBillingPlan(BillingPlan billingPlan) { + if (this.innerProperties() == null) { + this.innerProperties = new SavingsPlanPurchaseRequestProperties(); + } + this.innerProperties().withBillingPlan(billingPlan); + return this; + } + + /** + * Get the appliedScopeType property: Type of the Applied Scope. + * + * @return the appliedScopeType value. + */ + public AppliedScopeType appliedScopeType() { + return this.innerProperties() == null ? null : this.innerProperties().appliedScopeType(); + } + + /** + * Set the appliedScopeType property: Type of the Applied Scope. + * + * @param appliedScopeType the appliedScopeType value to set. + * @return the SavingsPlanPurchaseRequest object itself. + */ + public SavingsPlanPurchaseRequest withAppliedScopeType(AppliedScopeType appliedScopeType) { + if (this.innerProperties() == null) { + this.innerProperties = new SavingsPlanPurchaseRequestProperties(); + } + this.innerProperties().withAppliedScopeType(appliedScopeType); + return this; + } + + /** + * Get the appliedScopeProperties property: Properties specific to applied scope type. Not required if not + * applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup. + * + * @return the appliedScopeProperties value. + */ + public AppliedScopeProperties appliedScopeProperties() { + return this.innerProperties() == null ? null : this.innerProperties().appliedScopeProperties(); + } + + /** + * Set the appliedScopeProperties property: Properties specific to applied scope type. Not required if not + * applicable. Required and need to provide tenantId and managementGroupId if AppliedScopeType is ManagementGroup. + * + * @param appliedScopeProperties the appliedScopeProperties value to set. + * @return the SavingsPlanPurchaseRequest object itself. + */ + public SavingsPlanPurchaseRequest withAppliedScopeProperties(AppliedScopeProperties appliedScopeProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new SavingsPlanPurchaseRequestProperties(); + } + this.innerProperties().withAppliedScopeProperties(appliedScopeProperties); + return this; + } + + /** + * Get the commitment property: Commitment towards the benefit. + * + * @return the commitment value. + */ + public Commitment commitment() { + return this.innerProperties() == null ? null : this.innerProperties().commitment(); + } + + /** + * Set the commitment property: Commitment towards the benefit. + * + * @param commitment the commitment value to set. + * @return the SavingsPlanPurchaseRequest object itself. + */ + public SavingsPlanPurchaseRequest withCommitment(Commitment commitment) { + if (this.innerProperties() == null) { + this.innerProperties = new SavingsPlanPurchaseRequestProperties(); + } + this.innerProperties().withCommitment(commitment); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SavingsPlanTerm.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SavingsPlanTerm.java new file mode 100644 index 0000000000000..757b3e216828a --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SavingsPlanTerm.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Represent savings plan term in ISO 8601 format. */ +public final class SavingsPlanTerm extends ExpandableStringEnum { + /** Static value P1Y for SavingsPlanTerm. */ + public static final SavingsPlanTerm P1Y = fromString("P1Y"); + + /** Static value P3Y for SavingsPlanTerm. */ + public static final SavingsPlanTerm P3Y = fromString("P3Y"); + + /** + * Creates a new instance of SavingsPlanTerm value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SavingsPlanTerm() { + } + + /** + * Creates or finds a SavingsPlanTerm from its string representation. + * + * @param name a name to look for. + * @return the corresponding SavingsPlanTerm. + */ + @JsonCreator + public static SavingsPlanTerm fromString(String name) { + return fromString(name, SavingsPlanTerm.class); + } + + /** + * Gets known SavingsPlanTerm values. + * + * @return known SavingsPlanTerm values. + */ + public static Collection values() { + return values(SavingsPlanTerm.class); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SavingsPlanToPurchaseCalculateExchange.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SavingsPlanToPurchaseCalculateExchange.java new file mode 100644 index 0000000000000..0a63efaab34d0 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SavingsPlanToPurchaseCalculateExchange.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Savings plan purchase details. */ +@Fluent +public final class SavingsPlanToPurchaseCalculateExchange { + /* + * Request body for savings plan purchase + */ + @JsonProperty(value = "properties") + private SavingsPlanPurchaseRequest properties; + + /* + * Pricing information containing the amount and the currency code + */ + @JsonProperty(value = "billingCurrencyTotal") + private Price billingCurrencyTotal; + + /** Creates an instance of SavingsPlanToPurchaseCalculateExchange class. */ + public SavingsPlanToPurchaseCalculateExchange() { + } + + /** + * Get the properties property: Request body for savings plan purchase. + * + * @return the properties value. + */ + public SavingsPlanPurchaseRequest properties() { + return this.properties; + } + + /** + * Set the properties property: Request body for savings plan purchase. + * + * @param properties the properties value to set. + * @return the SavingsPlanToPurchaseCalculateExchange object itself. + */ + public SavingsPlanToPurchaseCalculateExchange withProperties(SavingsPlanPurchaseRequest properties) { + this.properties = properties; + return this; + } + + /** + * Get the billingCurrencyTotal property: Pricing information containing the amount and the currency code. + * + * @return the billingCurrencyTotal value. + */ + public Price billingCurrencyTotal() { + return this.billingCurrencyTotal; + } + + /** + * Set the billingCurrencyTotal property: Pricing information containing the amount and the currency code. + * + * @param billingCurrencyTotal the billingCurrencyTotal value to set. + * @return the SavingsPlanToPurchaseCalculateExchange object itself. + */ + public SavingsPlanToPurchaseCalculateExchange withBillingCurrencyTotal(Price billingCurrencyTotal) { + this.billingCurrencyTotal = billingCurrencyTotal; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (billingCurrencyTotal() != null) { + billingCurrencyTotal().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SavingsPlanToPurchaseExchange.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SavingsPlanToPurchaseExchange.java new file mode 100644 index 0000000000000..737ac768aa886 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SavingsPlanToPurchaseExchange.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Savings plan purchase details. */ +@Fluent +public final class SavingsPlanToPurchaseExchange { + /* + * Fully qualified id of the savings plan order being purchased + */ + @JsonProperty(value = "savingsPlanOrderId") + private String savingsPlanOrderId; + + /* + * Fully qualified id of the savings plan being purchased. This value is only guaranteed to be non-null if the + * purchase is successful. + */ + @JsonProperty(value = "savingsPlanId") + private String savingsPlanId; + + /* + * Request body for savings plan purchase + */ + @JsonProperty(value = "properties") + private SavingsPlanPurchaseRequest properties; + + /* + * Pricing information containing the amount and the currency code + */ + @JsonProperty(value = "billingCurrencyTotal") + private Price billingCurrencyTotal; + + /* + * Status of the individual operation. + */ + @JsonProperty(value = "status") + private OperationStatus status; + + /** Creates an instance of SavingsPlanToPurchaseExchange class. */ + public SavingsPlanToPurchaseExchange() { + } + + /** + * Get the savingsPlanOrderId property: Fully qualified id of the savings plan order being purchased. + * + * @return the savingsPlanOrderId value. + */ + public String savingsPlanOrderId() { + return this.savingsPlanOrderId; + } + + /** + * Set the savingsPlanOrderId property: Fully qualified id of the savings plan order being purchased. + * + * @param savingsPlanOrderId the savingsPlanOrderId value to set. + * @return the SavingsPlanToPurchaseExchange object itself. + */ + public SavingsPlanToPurchaseExchange withSavingsPlanOrderId(String savingsPlanOrderId) { + this.savingsPlanOrderId = savingsPlanOrderId; + return this; + } + + /** + * Get the savingsPlanId property: Fully qualified id of the savings plan being purchased. This value is only + * guaranteed to be non-null if the purchase is successful. + * + * @return the savingsPlanId value. + */ + public String savingsPlanId() { + return this.savingsPlanId; + } + + /** + * Set the savingsPlanId property: Fully qualified id of the savings plan being purchased. This value is only + * guaranteed to be non-null if the purchase is successful. + * + * @param savingsPlanId the savingsPlanId value to set. + * @return the SavingsPlanToPurchaseExchange object itself. + */ + public SavingsPlanToPurchaseExchange withSavingsPlanId(String savingsPlanId) { + this.savingsPlanId = savingsPlanId; + return this; + } + + /** + * Get the properties property: Request body for savings plan purchase. + * + * @return the properties value. + */ + public SavingsPlanPurchaseRequest properties() { + return this.properties; + } + + /** + * Set the properties property: Request body for savings plan purchase. + * + * @param properties the properties value to set. + * @return the SavingsPlanToPurchaseExchange object itself. + */ + public SavingsPlanToPurchaseExchange withProperties(SavingsPlanPurchaseRequest properties) { + this.properties = properties; + return this; + } + + /** + * Get the billingCurrencyTotal property: Pricing information containing the amount and the currency code. + * + * @return the billingCurrencyTotal value. + */ + public Price billingCurrencyTotal() { + return this.billingCurrencyTotal; + } + + /** + * Set the billingCurrencyTotal property: Pricing information containing the amount and the currency code. + * + * @param billingCurrencyTotal the billingCurrencyTotal value to set. + * @return the SavingsPlanToPurchaseExchange object itself. + */ + public SavingsPlanToPurchaseExchange withBillingCurrencyTotal(Price billingCurrencyTotal) { + this.billingCurrencyTotal = billingCurrencyTotal; + return this; + } + + /** + * Get the status property: Status of the individual operation. + * + * @return the status value. + */ + public OperationStatus status() { + return this.status; + } + + /** + * Set the status property: Status of the individual operation. + * + * @param status the status value to set. + * @return the SavingsPlanToPurchaseExchange object itself. + */ + public SavingsPlanToPurchaseExchange withStatus(OperationStatus status) { + this.status = status; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (billingCurrencyTotal() != null) { + billingCurrencyTotal().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ScopeProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ScopeProperties.java new file mode 100644 index 0000000000000..7edad15f578cb --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ScopeProperties.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The scope and whether it is valid. */ +@Fluent +public final class ScopeProperties { + /* + * The scope property. + */ + @JsonProperty(value = "scope") + private String scope; + + /* + * The valid property. + */ + @JsonProperty(value = "valid") + private Boolean valid; + + /** Creates an instance of ScopeProperties class. */ + public ScopeProperties() { + } + + /** + * Get the scope property: The scope property. + * + * @return the scope value. + */ + public String scope() { + return this.scope; + } + + /** + * Set the scope property: The scope property. + * + * @param scope the scope value to set. + * @return the ScopeProperties object itself. + */ + public ScopeProperties withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Get the valid property: The valid property. + * + * @return the valid value. + */ + public Boolean valid() { + return this.valid; + } + + /** + * Set the valid property: The valid property. + * + * @param valid the valid value to set. + * @return the ScopeProperties object itself. + */ + public ScopeProperties withValid(Boolean valid) { + this.valid = valid; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SkuCapability.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SkuCapability.java new file mode 100644 index 0000000000000..e03cb60119670 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SkuCapability.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Capability of a sku. */ +@Fluent +public final class SkuCapability { + /* + * An invariant to describe the feature. + */ + @JsonProperty(value = "name") + private String name; + + /* + * An invariant if the feature is measured by quantity. + */ + @JsonProperty(value = "value") + private String value; + + /** Creates an instance of SkuCapability class. */ + public SkuCapability() { + } + + /** + * Get the name property: An invariant to describe the feature. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: An invariant to describe the feature. + * + * @param name the name value to set. + * @return the SkuCapability object itself. + */ + public SkuCapability withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: An invariant if the feature is measured by quantity. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: An invariant if the feature is measured by quantity. + * + * @param value the value value to set. + * @return the SkuCapability object itself. + */ + public SkuCapability withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SkuName.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SkuName.java new file mode 100644 index 0000000000000..de54f589bdc7b --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SkuName.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The name of sku. */ +@Fluent +public final class SkuName { + /* + * The name property. + */ + @JsonProperty(value = "name") + private String name; + + /** Creates an instance of SkuName class. */ + public SkuName() { + } + + /** + * Get the name property: The name property. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name property. + * + * @param name the name value to set. + * @return the SkuName object itself. + */ + public SkuName withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SkuProperty.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SkuProperty.java new file mode 100644 index 0000000000000..24ab2c12da9c5 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SkuProperty.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Property of a sku. */ +@Fluent +public final class SkuProperty { + /* + * An invariant to describe the feature. + */ + @JsonProperty(value = "name") + private String name; + + /* + * An invariant if the feature is measured by quantity. + */ + @JsonProperty(value = "value") + private String value; + + /** Creates an instance of SkuProperty class. */ + public SkuProperty() { + } + + /** + * Get the name property: An invariant to describe the feature. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: An invariant to describe the feature. + * + * @param name the name value to set. + * @return the SkuProperty object itself. + */ + public SkuProperty withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: An invariant if the feature is measured by quantity. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: An invariant if the feature is measured by quantity. + * + * @param value the value value to set. + * @return the SkuProperty object itself. + */ + public SkuProperty withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SkuRestriction.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SkuRestriction.java new file mode 100644 index 0000000000000..fce9523a628c6 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SkuRestriction.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Restriction of a sku. */ +@Fluent +public final class SkuRestriction { + /* + * The type of restrictions. + */ + @JsonProperty(value = "type") + private String type; + + /* + * The value of restrictions. If the restriction type is set to location. This would be different locations where + * the sku is restricted. + */ + @JsonProperty(value = "values") + private List values; + + /* + * The reason for restriction. + */ + @JsonProperty(value = "reasonCode") + private String reasonCode; + + /** Creates an instance of SkuRestriction class. */ + public SkuRestriction() { + } + + /** + * Get the type property: The type of restrictions. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The type of restrictions. + * + * @param type the type value to set. + * @return the SkuRestriction object itself. + */ + public SkuRestriction withType(String type) { + this.type = type; + return this; + } + + /** + * Get the values property: The value of restrictions. If the restriction type is set to location. This would be + * different locations where the sku is restricted. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Set the values property: The value of restrictions. If the restriction type is set to location. This would be + * different locations where the sku is restricted. + * + * @param values the values value to set. + * @return the SkuRestriction object itself. + */ + public SkuRestriction withValues(List values) { + this.values = values; + return this; + } + + /** + * Get the reasonCode property: The reason for restriction. + * + * @return the reasonCode value. + */ + public String reasonCode() { + return this.reasonCode; + } + + /** + * Set the reasonCode property: The reason for restriction. + * + * @param reasonCode the reasonCode value to set. + * @return the SkuRestriction object itself. + */ + public SkuRestriction withReasonCode(String reasonCode) { + this.reasonCode = reasonCode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SplitRequest.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SplitRequest.java new file mode 100644 index 0000000000000..31d82aa5046e7 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SplitRequest.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.fluent.models.SplitProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The request for reservation split. */ +@Fluent +public final class SplitRequest { + /* + * Properties for reservation split + */ + @JsonProperty(value = "properties") + private SplitProperties innerProperties; + + /** Creates an instance of SplitRequest class. */ + public SplitRequest() { + } + + /** + * Get the innerProperties property: Properties for reservation split. + * + * @return the innerProperties value. + */ + private SplitProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the quantities property: List of the quantities in the new reservations to create. + * + * @return the quantities value. + */ + public List quantities() { + return this.innerProperties() == null ? null : this.innerProperties().quantities(); + } + + /** + * Set the quantities property: List of the quantities in the new reservations to create. + * + * @param quantities the quantities value to set. + * @return the SplitRequest object itself. + */ + public SplitRequest withQuantities(List quantities) { + if (this.innerProperties() == null) { + this.innerProperties = new SplitProperties(); + } + this.innerProperties().withQuantities(quantities); + return this; + } + + /** + * Get the reservationId property: Resource id of the reservation to be split. Format of the resource id should be + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @return the reservationId value. + */ + public String reservationId() { + return this.innerProperties() == null ? null : this.innerProperties().reservationId(); + } + + /** + * Set the reservationId property: Resource id of the reservation to be split. Format of the resource id should be + * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. + * + * @param reservationId the reservationId value to set. + * @return the SplitRequest object itself. + */ + public SplitRequest withReservationId(String reservationId) { + if (this.innerProperties() == null) { + this.innerProperties = new SplitProperties(); + } + this.innerProperties().withReservationId(reservationId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SubRequest.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SubRequest.java new file mode 100644 index 0000000000000..52bb490759c50 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SubRequest.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The sub-request submitted with the quota request. */ +@Fluent +public final class SubRequest { + /* + * Quota (resource limit). + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Integer limit; + + /* + * The resource name. + */ + @JsonProperty(value = "name") + private ResourceName name; + + /* + * Resource type for which the quota check was made. + */ + @JsonProperty(value = "resourceType", access = JsonProperty.Access.WRITE_ONLY) + private String resourceType; + + /* + * The limit units, such as **count** and **bytes**. Use the unit field provided in the response of the GET quota + * operation. + */ + @JsonProperty(value = "unit") + private String unit; + + /* + * The quota request status. + */ + @JsonProperty(value = "provisioningState") + private QuotaRequestState provisioningState; + + /* + * User-friendly status message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /* + * Sub request ID for individual request. + */ + @JsonProperty(value = "subRequestId", access = JsonProperty.Access.WRITE_ONLY) + private String subRequestId; + + /** Creates an instance of SubRequest class. */ + public SubRequest() { + } + + /** + * Get the limit property: Quota (resource limit). + * + * @return the limit value. + */ + public Integer limit() { + return this.limit; + } + + /** + * Get the name property: The resource name. + * + * @return the name value. + */ + public ResourceName name() { + return this.name; + } + + /** + * Set the name property: The resource name. + * + * @param name the name value to set. + * @return the SubRequest object itself. + */ + public SubRequest withName(ResourceName name) { + this.name = name; + return this; + } + + /** + * Get the resourceType property: Resource type for which the quota check was made. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Get the unit property: The limit units, such as **count** and **bytes**. Use the unit field provided in the + * response of the GET quota operation. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Set the unit property: The limit units, such as **count** and **bytes**. Use the unit field provided in the + * response of the GET quota operation. + * + * @param unit the unit value to set. + * @return the SubRequest object itself. + */ + public SubRequest withUnit(String unit) { + this.unit = unit; + return this; + } + + /** + * Get the provisioningState property: The quota request status. + * + * @return the provisioningState value. + */ + public QuotaRequestState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: The quota request status. + * + * @param provisioningState the provisioningState value to set. + * @return the SubRequest object itself. + */ + public SubRequest withProvisioningState(QuotaRequestState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the message property: User-friendly status message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Get the subRequestId property: Sub request ID for individual request. + * + * @return the subRequestId value. + */ + public String subRequestId() { + return this.subRequestId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SubscriptionScopeProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SubscriptionScopeProperties.java new file mode 100644 index 0000000000000..87d3fccb04ff2 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SubscriptionScopeProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The scopes checked by the available scope api. */ +@Fluent +public final class SubscriptionScopeProperties { + /* + * The scopes property. + */ + @JsonProperty(value = "scopes") + private List scopes; + + /** Creates an instance of SubscriptionScopeProperties class. */ + public SubscriptionScopeProperties() { + } + + /** + * Get the scopes property: The scopes property. + * + * @return the scopes value. + */ + public List scopes() { + return this.scopes; + } + + /** + * Set the scopes property: The scopes property. + * + * @param scopes the scopes value to set. + * @return the SubscriptionScopeProperties object itself. + */ + public SubscriptionScopeProperties withScopes(List scopes) { + this.scopes = scopes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (scopes() != null) { + scopes().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/package-info.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/package-info.java new file mode 100644 index 0000000000000..674e1e041ea2f --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for AzureReservationApi. This API describe Azure Reservation. */ +package com.azure.resourcemanager.reservations.models; diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/package-info.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/package-info.java new file mode 100644 index 0000000000000..39e370e7d4169 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for AzureReservationApi. This API describe Azure Reservation. */ +package com.azure.resourcemanager.reservations; diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/main/java/module-info.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/module-info.java new file mode 100644 index 0000000000000..ab189ddd8cf17 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.reservations { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.reservations; + exports com.azure.resourcemanager.reservations.fluent; + exports com.azure.resourcemanager.reservations.fluent.models; + exports com.azure.resourcemanager.reservations.models; + + opens com.azure.resourcemanager.reservations.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.reservations.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/CalculateExchangePostSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/CalculateExchangePostSamples.java new file mode 100644 index 0000000000000..f7058e0db67a1 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/CalculateExchangePostSamples.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +import com.azure.resourcemanager.reservations.models.AppliedScopeProperties; +import com.azure.resourcemanager.reservations.models.AppliedScopeType; +import com.azure.resourcemanager.reservations.models.CalculateExchangeRequest; +import com.azure.resourcemanager.reservations.models.CalculateExchangeRequestProperties; +import com.azure.resourcemanager.reservations.models.Commitment; +import com.azure.resourcemanager.reservations.models.CommitmentGrain; +import com.azure.resourcemanager.reservations.models.InstanceFlexibility; +import com.azure.resourcemanager.reservations.models.PurchaseRequest; +import com.azure.resourcemanager.reservations.models.PurchaseRequestPropertiesReservedResourceProperties; +import com.azure.resourcemanager.reservations.models.ReservationBillingPlan; +import com.azure.resourcemanager.reservations.models.ReservationTerm; +import com.azure.resourcemanager.reservations.models.ReservationToReturn; +import com.azure.resourcemanager.reservations.models.ReservedResourceType; +import com.azure.resourcemanager.reservations.models.SavingsPlanPurchaseRequest; +import com.azure.resourcemanager.reservations.models.SavingsPlanTerm; +import com.azure.resourcemanager.reservations.models.SkuName; +import java.util.Arrays; + +/** Samples for CalculateExchange Post. */ +public final class CalculateExchangePostSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/CalculateExchange.json + */ + /** + * Sample code: CalculateExchange. + * + * @param manager Entry point to ReservationsManager. + */ + public static void calculateExchange(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .calculateExchanges() + .post( + new CalculateExchangeRequest() + .withProperties( + new CalculateExchangeRequestProperties() + .withReservationsToPurchase( + Arrays + .asList( + new PurchaseRequest() + .withSku(new SkuName().withName("Standard_B1ls")) + .withLocation("westus") + .withReservedResourceType(ReservedResourceType.VIRTUAL_MACHINES) + .withBillingScopeId("/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83") + .withTerm(ReservationTerm.P1Y) + .withBillingPlan(ReservationBillingPlan.UPFRONT) + .withQuantity(1) + .withDisplayName("testDisplayName") + .withAppliedScopeType(AppliedScopeType.SHARED) + .withRenew(false) + .withReservedResourceProperties( + new PurchaseRequestPropertiesReservedResourceProperties() + .withInstanceFlexibility(InstanceFlexibility.ON)))) + .withSavingsPlansToPurchase( + Arrays + .asList( + new SavingsPlanPurchaseRequest() + .withSku(new SkuName().withName("Compute_Savings_Plan")) + .withDisplayName("ComputeSavingsPlan") + .withBillingScopeId("/subscriptions/10000000-0000-0000-0000-000000000000") + .withTerm(SavingsPlanTerm.P1Y) + .withAppliedScopeType(AppliedScopeType.SINGLE) + .withAppliedScopeProperties( + new AppliedScopeProperties() + .withResourceGroupId( + "/subscriptions/10000000-0000-0000-0000-000000000000/resourceGroups/testrg")) + .withCommitment( + new Commitment() + .withCurrencyCode("fakeTokenPlaceholder") + .withAmount(15.23D) + .withGrain(CommitmentGrain.HOURLY)))) + .withReservationsToExchange( + Arrays + .asList( + new ReservationToReturn() + .withReservationId( + "/providers/microsoft.capacity/reservationOrders/1f14354c-dc12-4c8d-8090-6f295a3a34aa/reservations/c8c926bd-fc5d-4e29-9d43-b68340ac23a6") + .withQuantity(1)))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/CalculateRefundPostSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/CalculateRefundPostSamples.java new file mode 100644 index 0000000000000..012d90b0b8776 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/CalculateRefundPostSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +import com.azure.resourcemanager.reservations.models.CalculateRefundRequest; +import com.azure.resourcemanager.reservations.models.CalculateRefundRequestProperties; +import com.azure.resourcemanager.reservations.models.ReservationToReturn; + +/** Samples for CalculateRefund Post. */ +public final class CalculateRefundPostSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/CalculateRefund.json + */ + /** + * Sample code: CalculateRefund. + * + * @param manager Entry point to ReservationsManager. + */ + public static void calculateRefund(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .calculateRefunds() + .postWithResponse( + "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", + new CalculateRefundRequest() + .withId("/providers/microsoft.capacity/reservationOrders/50000000-aaaa-bbbb-cccc-100000000004") + .withProperties( + new CalculateRefundRequestProperties() + .withScope("Reservation") + .withReservationToReturn( + new ReservationToReturn() + .withReservationId( + "/providers/microsoft.capacity/reservationOrders/50000000-aaaa-bbbb-cccc-100000000004/reservations/40000000-aaaa-bbbb-cccc-100000000000") + .withQuantity(1))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ExchangePostSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ExchangePostSamples.java new file mode 100644 index 0000000000000..5cb623d0a293a --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ExchangePostSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +import com.azure.resourcemanager.reservations.models.ExchangeRequest; +import com.azure.resourcemanager.reservations.models.ExchangeRequestProperties; + +/** Samples for Exchange Post. */ +public final class ExchangePostSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Exchange.json + */ + /** + * Sample code: Exchange. + * + * @param manager Entry point to ReservationsManager. + */ + public static void exchange(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .exchanges() + .post( + new ExchangeRequest() + .withProperties( + new ExchangeRequestProperties().withSessionId("66e2ac8f-439e-4345-8235-6fef07608081")), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/OperationListSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/OperationListSamples.java new file mode 100644 index 0000000000000..0a10e95c5ebf9 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/OperationListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +/** Samples for Operation List. */ +public final class OperationListSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetOperations.json + */ + /** + * Sample code: GetOperations. + * + * @param manager Entry point to ReservationsManager. + */ + public static void getOperations(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaCreateOrUpdateSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..b26d99a6c9a64 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaCreateOrUpdateSamples.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +import com.azure.resourcemanager.reservations.models.QuotaProperties; +import com.azure.resourcemanager.reservations.models.ResourceName; +import com.azure.resourcemanager.reservations.models.ResourceType; + +/** Samples for Quota CreateOrUpdate. */ +public final class QuotaCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestDedicated.json + */ + /** + * Sample code: Quotas_Request_PutForMachineLearningServices_DedicatedResource. + * + * @param manager Entry point to ReservationsManager. + */ + public static void quotasRequestPutForMachineLearningServicesDedicatedResource( + com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .quotas() + .define("StandardDv2Family") + .withExistingLocation("D7EC67B3-7657-4966-BFFC-41EFD36BAAB3", "Microsoft.MachineLearningServices", "eastus") + .withProperties( + new QuotaProperties() + .withLimit(200) + .withUnit("Count") + .withName(new ResourceName().withValue("StandardDv2Family")) + .withResourceType(ResourceType.DEDICATED)) + .create(); + } + + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestLowPriority.json + */ + /** + * Sample code: Quotas_Request_PutForMachineLearningServices_LowPriorityResource. + * + * @param manager Entry point to ReservationsManager. + */ + public static void quotasRequestPutForMachineLearningServicesLowPriorityResource( + com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .quotas() + .define("TotalLowPriorityCores") + .withExistingLocation("D7EC67B3-7657-4966-BFFC-41EFD36BAAB3", "Microsoft.MachineLearningServices", "eastus") + .withProperties( + new QuotaProperties() + .withLimit(200) + .withUnit("Count") + .withName(new ResourceName().withValue("TotalLowPriorityCores")) + .withResourceType(ResourceType.LOW_PRIORITY)) + .create(); + } + + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putComputeOneSkuQuotaRequest.json + */ + /** + * Sample code: Quotas_Request_PutForCompute. + * + * @param manager Entry point to ReservationsManager. + */ + public static void quotasRequestPutForCompute(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .quotas() + .define("standardFSv2Family") + .withExistingLocation("D7EC67B3-7657-4966-BFFC-41EFD36BAAB3", "Microsoft.Compute", "eastus") + .withProperties( + new QuotaProperties() + .withLimit(200) + .withUnit("Count") + .withName(new ResourceName().withValue("standardFSv2Family"))) + .create(); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaGetSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaGetSamples.java new file mode 100644 index 0000000000000..5ffce3d9d574d --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +/** Samples for Quota Get. */ +public final class QuotaGetSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeOneSkuUsages.json + */ + /** + * Sample code: Quotas_Request_ForCompute. + * + * @param manager Entry point to ReservationsManager. + */ + public static void quotasRequestForCompute(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .quotas() + .getWithResponse( + "00000000-0000-0000-0000-000000000000", + "Microsoft.Compute", + "eastus", + "standardNDSFamily", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaListSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaListSamples.java new file mode 100644 index 0000000000000..be53043d68fef --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaListSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +/** Samples for Quota List. */ +public final class QuotaListSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeUsages.json + */ + /** + * Sample code: Quotas_listUsagesForCompute. + * + * @param manager Entry point to ReservationsManager. + */ + public static void quotasListUsagesForCompute(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .quotas() + .list( + "00000000-0000-0000-0000-000000000000", + "Microsoft.Compute", + "eastus", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getMachineLearningServicesUsages.json + */ + /** + * Sample code: Quotas_listUsagesMachineLearningServices. + * + * @param manager Entry point to ReservationsManager. + */ + public static void quotasListUsagesMachineLearningServices( + com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .quotas() + .list( + "00000000-0000-0000-0000-000000000000", + "Microsoft.MachineLearningServices", + "eastus", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaRequestStatusGetSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaRequestStatusGetSamples.java new file mode 100644 index 0000000000000..a2458ce9b2817 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaRequestStatusGetSamples.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +/** Samples for QuotaRequestStatus Get. */ +public final class QuotaRequestStatusGetSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusFailed.json + */ + /** + * Sample code: QuotaRequestFailed. + * + * @param manager Entry point to ReservationsManager. + */ + public static void quotaRequestFailed(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .quotaRequestStatus() + .getWithResponse( + "00000000-0000-0000-0000-000000000000", + "Microsoft.Compute", + "eastus", + "2B5C8515-37D8-4B6A-879B-CD641A2CF605", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusById.json + */ + /** + * Sample code: QuotaRequestStatus. + * + * @param manager Entry point to ReservationsManager. + */ + public static void quotaRequestStatus(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .quotaRequestStatus() + .getWithResponse( + "00000000-0000-0000-0000-000000000000", + "Microsoft.Compute", + "eastus", + "2B5C8515-37D8-4B6A-879B-CD641A2CF605", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusInProgress.json + */ + /** + * Sample code: QuotaRequestInProgress. + * + * @param manager Entry point to ReservationsManager. + */ + public static void quotaRequestInProgress(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .quotaRequestStatus() + .getWithResponse( + "00000000-0000-0000-0000-000000000000", + "Microsoft.Compute", + "eastus", + "2B5C8515-37D8-4B6A-879B-CD641A2CF605", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaRequestStatusListSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaRequestStatusListSamples.java new file mode 100644 index 0000000000000..53cadd8aaef4c --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaRequestStatusListSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +/** Samples for QuotaRequestStatus List. */ +public final class QuotaRequestStatusListSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestsHistory.json + */ + /** + * Sample code: QuotaRequestHistory. + * + * @param manager Entry point to ReservationsManager. + */ + public static void quotaRequestHistory(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .quotaRequestStatus() + .list( + "3f75fdf7-977e-44ad-990d-99f14f0f299f", + "Microsoft.Compute", + "eastus", + null, + null, + null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaUpdateSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaUpdateSamples.java new file mode 100644 index 0000000000000..6e838e0c659a5 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaUpdateSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +import com.azure.resourcemanager.reservations.models.CurrentQuotaLimitBase; +import com.azure.resourcemanager.reservations.models.QuotaProperties; +import com.azure.resourcemanager.reservations.models.ResourceName; + +/** Samples for Quota Update. */ +public final class QuotaUpdateSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/patchComputeQuotaRequest.json + */ + /** + * Sample code: Quotas_Request_PatchForCompute. + * + * @param manager Entry point to ReservationsManager. + */ + public static void quotasRequestPatchForCompute( + com.azure.resourcemanager.reservations.ReservationsManager manager) { + CurrentQuotaLimitBase resource = + manager + .quotas() + .getWithResponse( + "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3", + "Microsoft.Compute", + "eastus", + "standardFSv2Family", + com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withProperties( + new QuotaProperties() + .withLimit(200) + .withUnit("Count") + .withName(new ResourceName().withValue("standardFSv2Family"))) + .apply(); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationArchiveSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationArchiveSamples.java new file mode 100644 index 0000000000000..842d2e1fa2396 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationArchiveSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +/** Samples for Reservation Archive. */ +public final class ReservationArchiveSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Archive.json + */ + /** + * Sample code: Archive. + * + * @param manager Entry point to ReservationsManager. + */ + public static void archive(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservations() + .archiveWithResponse( + "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", + "356e7ae4-84d0-4da6-ab4b-d6b94f3557da", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationAvailableScopesSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationAvailableScopesSamples.java new file mode 100644 index 0000000000000..ed0bde5ab0362 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationAvailableScopesSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +import com.azure.resourcemanager.reservations.models.AvailableScopeRequest; +import com.azure.resourcemanager.reservations.models.AvailableScopeRequestProperties; +import java.util.Arrays; + +/** Samples for Reservation AvailableScopes. */ +public final class ReservationAvailableScopesSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetAvailableScope.json + */ + /** + * Sample code: AvailableScopes. + * + * @param manager Entry point to ReservationsManager. + */ + public static void availableScopes(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservations() + .availableScopes( + "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", + "356e7ae4-84d0-4da6-ab4b-d6b94f3557da", + new AvailableScopeRequest() + .withProperties( + new AvailableScopeRequestProperties() + .withScopes(Arrays.asList("/subscriptions/efc7c997-7700-4a74-b731-55aec16c15e9"))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationGetSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationGetSamples.java new file mode 100644 index 0000000000000..4dcf76519b175 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +/** Samples for Reservation Get. */ +public final class ReservationGetSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationDetails.json + */ + /** + * Sample code: GetReservation. + * + * @param manager Entry point to ReservationsManager. + */ + public static void getReservation(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservations() + .getWithResponse( + "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", + "6ef59113-3482-40da-8d79-787f823e34bc", + "renewProperties", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationListAllSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationListAllSamples.java new file mode 100644 index 0000000000000..5117fd784954e --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationListAllSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +/** Samples for Reservation ListAll. */ +public final class ReservationListAllSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservations.json + */ + /** + * Sample code: ReservationListAll. + * + * @param manager Entry point to ReservationsManager. + */ + public static void reservationListAll(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservations() + .listAll( + "(properties/archived eq false)", + "properties/displayName asc", + "true", + 50.0F, + null, + 1.0F, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationListRevisionsSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationListRevisionsSamples.java new file mode 100644 index 0000000000000..6e755e4ce2622 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationListRevisionsSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +/** Samples for Reservation ListRevisions. */ +public final class ReservationListRevisionsSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationRevisions.json + */ + /** + * Sample code: ReservationRevisions. + * + * @param manager Entry point to ReservationsManager. + */ + public static void reservationRevisions(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservations() + .listRevisions( + "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", + "6ef59113-3482-40da-8d79-787f823e34bc", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationListSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationListSamples.java new file mode 100644 index 0000000000000..9f517bc328bf1 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +/** Samples for Reservation List. */ +public final class ReservationListSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationsFromOrder.json + */ + /** + * Sample code: ReservationList. + * + * @param manager Entry point to ReservationsManager. + */ + public static void reservationList(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager.reservations().list("276e7ae4-84d0-4da6-ab4b-d6b94f3557da", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationMergeSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationMergeSamples.java new file mode 100644 index 0000000000000..1c14427e115e3 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationMergeSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +import com.azure.resourcemanager.reservations.models.MergeRequest; +import java.util.Arrays; + +/** Samples for Reservation Merge. */ +public final class ReservationMergeSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/MergeReservations.json + */ + /** + * Sample code: Merge. + * + * @param manager Entry point to ReservationsManager. + */ + public static void merge(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservations() + .merge( + "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", + new MergeRequest() + .withSources( + Arrays + .asList( + "/providers/Microsoft.Capacity/reservationOrders/c0565a8a-4491-4e77-b07b-5e6d66718e1c/reservations/cea04232-932e-47db-acb5-e29a945ecc73", + "/providers/Microsoft.Capacity/reservationOrders/c0565a8a-4491-4e77-b07b-5e6d66718e1c/reservations/5bf54dc7-dacd-4f46-a16b-7b78f4a59799")), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderCalculateSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderCalculateSamples.java new file mode 100644 index 0000000000000..fd45b2dc2cfe6 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderCalculateSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +import com.azure.resourcemanager.reservations.models.AppliedScopeType; +import com.azure.resourcemanager.reservations.models.InstanceFlexibility; +import com.azure.resourcemanager.reservations.models.PurchaseRequest; +import com.azure.resourcemanager.reservations.models.PurchaseRequestPropertiesReservedResourceProperties; +import com.azure.resourcemanager.reservations.models.ReservationBillingPlan; +import com.azure.resourcemanager.reservations.models.ReservationTerm; +import com.azure.resourcemanager.reservations.models.ReservedResourceType; +import com.azure.resourcemanager.reservations.models.SkuName; + +/** Samples for ReservationOrder Calculate. */ +public final class ReservationOrderCalculateSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/CalculateReservationOrder.json + */ + /** + * Sample code: CalculatePrice. + * + * @param manager Entry point to ReservationsManager. + */ + public static void calculatePrice(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservationOrders() + .calculateWithResponse( + new PurchaseRequest() + .withSku(new SkuName().withName("standard_D1")) + .withLocation("westus") + .withReservedResourceType(ReservedResourceType.VIRTUAL_MACHINES) + .withBillingScopeId("/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83") + .withTerm(ReservationTerm.P1Y) + .withBillingPlan(ReservationBillingPlan.MONTHLY) + .withQuantity(1) + .withDisplayName("TestReservationOrder") + .withAppliedScopeType(AppliedScopeType.SHARED) + .withReservedResourceProperties( + new PurchaseRequestPropertiesReservedResourceProperties() + .withInstanceFlexibility(InstanceFlexibility.ON)), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderChangeDirectorySamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderChangeDirectorySamples.java new file mode 100644 index 0000000000000..a3992be77f989 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderChangeDirectorySamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +import com.azure.resourcemanager.reservations.models.ChangeDirectoryRequest; + +/** Samples for ReservationOrder ChangeDirectory. */ +public final class ReservationOrderChangeDirectorySamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/ChangeDirectoryReservationOrder.json + */ + /** + * Sample code: ChangeDirectory. + * + * @param manager Entry point to ReservationsManager. + */ + public static void changeDirectory(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservationOrders() + .changeDirectoryWithResponse( + "a075419f-44cc-497f-b68a-14ee811d48b9", + new ChangeDirectoryRequest().withDestinationTenantId("906655ea-30be-4587-9d12-b50e077b0f32"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderGetSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderGetSamples.java new file mode 100644 index 0000000000000..e1d0e956c603c --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderGetSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +/** Samples for ReservationOrder Get. */ +public final class ReservationOrderGetSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationOrderDetailsWithExpandPlanInformation.json + */ + /** + * Sample code: GetReservationWithExpandPayments. + * + * @param manager Entry point to ReservationsManager. + */ + public static void getReservationWithExpandPayments( + com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservationOrders() + .getWithResponse("a075419f-44cc-497f-b68a-14ee811d48b9", "schedule", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationOrderDetails.json + */ + /** + * Sample code: GetReservationOrder. + * + * @param manager Entry point to ReservationsManager. + */ + public static void getReservationOrder(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservationOrders() + .getWithResponse("a075419f-44cc-497f-b68a-14ee811d48b9", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderListSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderListSamples.java new file mode 100644 index 0000000000000..4685360486dac --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +/** Samples for ReservationOrder List. */ +public final class ReservationOrderListSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetReservationOrders.json + */ + /** + * Sample code: ReservationOrderList. + * + * @param manager Entry point to ReservationsManager. + */ + public static void reservationOrderList(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager.reservationOrders().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderPurchaseSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderPurchaseSamples.java new file mode 100644 index 0000000000000..886a73117c365 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderPurchaseSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +import com.azure.resourcemanager.reservations.models.AppliedScopeType; +import com.azure.resourcemanager.reservations.models.InstanceFlexibility; +import com.azure.resourcemanager.reservations.models.PurchaseRequest; +import com.azure.resourcemanager.reservations.models.PurchaseRequestPropertiesReservedResourceProperties; +import com.azure.resourcemanager.reservations.models.ReservationBillingPlan; +import com.azure.resourcemanager.reservations.models.ReservationTerm; +import com.azure.resourcemanager.reservations.models.ReservedResourceType; +import com.azure.resourcemanager.reservations.models.SkuName; + +/** Samples for ReservationOrder Purchase. */ +public final class ReservationOrderPurchaseSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/PurchaseReservationOrder.json + */ + /** + * Sample code: Purchase. + * + * @param manager Entry point to ReservationsManager. + */ + public static void purchase(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservationOrders() + .purchase( + "a075419f-44cc-497f-b68a-14ee811d48b9", + new PurchaseRequest() + .withSku(new SkuName().withName("standard_D1")) + .withLocation("westus") + .withReservedResourceType(ReservedResourceType.VIRTUAL_MACHINES) + .withBillingScopeId("/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83") + .withTerm(ReservationTerm.P1Y) + .withBillingPlan(ReservationBillingPlan.MONTHLY) + .withQuantity(1) + .withDisplayName("TestReservationOrder") + .withAppliedScopeType(AppliedScopeType.SHARED) + .withRenew(false) + .withReservedResourceProperties( + new PurchaseRequestPropertiesReservedResourceProperties() + .withInstanceFlexibility(InstanceFlexibility.ON)), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationSplitSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationSplitSamples.java new file mode 100644 index 0000000000000..13de731fae205 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationSplitSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +import com.azure.resourcemanager.reservations.models.SplitRequest; +import java.util.Arrays; + +/** Samples for Reservation Split. */ +public final class ReservationSplitSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/SplitReservation.json + */ + /** + * Sample code: Split. + * + * @param manager Entry point to ReservationsManager. + */ + public static void split(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservations() + .split( + "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", + new SplitRequest() + .withQuantities(Arrays.asList(1, 2)) + .withReservationId( + "/providers/Microsoft.Capacity/reservationOrders/276e7ae4-84d0-4da6-ab4b-d6b94f3557da/reservations/bcae77cd-3119-4766-919f-b50d36c75c7a"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationUnarchiveSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationUnarchiveSamples.java new file mode 100644 index 0000000000000..13426ae239689 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationUnarchiveSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +/** Samples for Reservation Unarchive. */ +public final class ReservationUnarchiveSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Unarchive.json + */ + /** + * Sample code: Unarchive. + * + * @param manager Entry point to ReservationsManager. + */ + public static void unarchive(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservations() + .unarchiveWithResponse( + "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", + "356e7ae4-84d0-4da6-ab4b-d6b94f3557da", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationUpdateSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationUpdateSamples.java new file mode 100644 index 0000000000000..a8e6a3985dbc3 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationUpdateSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +import com.azure.resourcemanager.reservations.models.AppliedScopeType; +import com.azure.resourcemanager.reservations.models.InstanceFlexibility; +import com.azure.resourcemanager.reservations.models.PatchModel; + +/** Samples for Reservation Update. */ +public final class ReservationUpdateSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/UpdateReservation.json + */ + /** + * Sample code: PatchReservation. + * + * @param manager Entry point to ReservationsManager. + */ + public static void patchReservation(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservations() + .update( + "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", + "6ef59113-3482-40da-8d79-787f823e34bc", + new PatchModel() + .withAppliedScopeType(AppliedScopeType.SHARED) + .withInstanceFlexibility(InstanceFlexibility.OFF), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ResourceProviderGetAppliedReservationListSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ResourceProviderGetAppliedReservationListSamples.java new file mode 100644 index 0000000000000..7218f142cd98c --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ResourceProviderGetAppliedReservationListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +/** Samples for ResourceProvider GetAppliedReservationList. */ +public final class ResourceProviderGetAppliedReservationListSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetAppliedReservations.json + */ + /** + * Sample code: AppliedReservationList. + * + * @param manager Entry point to ReservationsManager. + */ + public static void appliedReservationList(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .resourceProviders() + .getAppliedReservationListWithResponse( + "23bc208b-083f-4901-ae85-4f98c0c3b4b6", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ResourceProviderListSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ResourceProviderListSamples.java new file mode 100644 index 0000000000000..a48432c07ac6e --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ResourceProviderListSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +/** Samples for ResourceProvider List. */ +public final class ResourceProviderListSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/GetCatalog.json + */ + /** + * Sample code: Catalog. + * + * @param manager Entry point to ReservationsManager. + */ + public static void catalog(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .resourceProviders() + .list( + "23bc208b-083f-4901-ae85-4f98c0c3b4b6", + "VirtualMachines", + "eastus", + null, + null, + null, + null, + null, + null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReturnPostSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReturnPostSamples.java new file mode 100644 index 0000000000000..d904adc25aecf --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReturnPostSamples.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +import com.azure.resourcemanager.reservations.models.RefundRequest; +import com.azure.resourcemanager.reservations.models.RefundRequestProperties; +import com.azure.resourcemanager.reservations.models.ReservationToReturn; + +/** Samples for Return Post. */ +public final class ReturnPostSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-11-01/examples/Return.json + */ + /** + * Sample code: Return a reservation. + * + * @param manager Entry point to ReservationsManager. + */ + public static void returnAReservation(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .returns() + .post( + "50000000-aaaa-bbbb-cccc-100000000004", + new RefundRequest() + .withProperties( + new RefundRequestProperties() + .withSessionId("10000000-aaaa-bbbb-cccc-200000000000") + .withScope("Reservation") + .withReservationToReturn( + new ReservationToReturn() + .withReservationId( + "/providers/microsoft.capacity/reservationOrders/50000000-aaaa-bbbb-cccc-100000000004/reservations/40000000-aaaa-bbbb-cccc-100000000000") + .withQuantity(1)) + .withReturnReason("PurchasedWrongProduct")), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/reservations/ci.yml b/sdk/reservations/ci.yml new file mode 100644 index 0000000000000..bd17f9d5206dc --- /dev/null +++ b/sdk/reservations/ci.yml @@ -0,0 +1,47 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/reservations/ci.yml + - sdk/reservations/azure-resourcemanager-reservations/ + exclude: + - sdk/reservations/pom.xml + - sdk/reservations/azure-resourcemanager-reservations/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/reservations/ci.yml + - sdk/reservations/azure-resourcemanager-reservations/ + exclude: + - sdk/reservations/pom.xml + - sdk/reservations/azure-resourcemanager-reservations/pom.xml + +parameters: + - name: release_azureresourcemanagerreservations + displayName: azure-resourcemanager-reservations + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: reservations + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-reservations + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerreservations + releaseInBatch: ${{ parameters.release_azureresourcemanagerreservations }} diff --git a/sdk/reservations/pom.xml b/sdk/reservations/pom.xml new file mode 100644 index 0000000000000..a1b6b035eb336 --- /dev/null +++ b/sdk/reservations/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-reservations-service + pom + 1.0.0 + + + azure-resourcemanager-reservations + +