diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 6034848e7aee1..e745b20945184 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -362,6 +362,7 @@ com.azure.resourcemanager:azure-resourcemanager-orbital;1.0.0-beta.1;1.0.0-beta. com.azure.resourcemanager:azure-resourcemanager-networkfunction;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-resourceconnector;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-fluidrelay;1.0.0;1.1.0-beta.1 +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 aa57b9a1692d3..f7e8bb4daa965 100644 --- a/pom.xml +++ b/pom.xml @@ -71,8 +71,8 @@ sdk/eventgrid sdk/eventhubs sdk/extendedlocation - sdk/formrecognizer sdk/fluidrelay + sdk/formrecognizer sdk/frontdoor sdk/hanaonazure sdk/hardwaresecuritymodules @@ -130,6 +130,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..4255151126b7d --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-08-17) + +- 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-03. 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..1bab7c316c352 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/README.md @@ -0,0 +1,102 @@ +# 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-03. 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] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +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](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/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 diff --git a/sdk/reservations/azure-resourcemanager-reservations/SAMPLE.md b/sdk/reservations/azure-resourcemanager-reservations/SAMPLE.md new file mode 100644 index 0000000000000..9dad48180c0f6 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/SAMPLE.md @@ -0,0 +1,889 @@ +# Code snippets and samples + + +## CalculateExchange + +- [Post](#calculateexchange_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 + +- [AvailableScopes](#reservation_availablescopes) +- [Get](#reservation_get) +- [List](#reservation_list) +- [ListAll](#reservation_listall) +- [ListRevisions](#reservation_listrevisions) +- [Merge](#reservation_merge) +- [Split](#reservation_split) +- [Update](#reservation_update) + +## ReservationOrder + +- [Calculate](#reservationorder_calculate) +- [ChangeDirectory](#reservationorder_changedirectory) +- [Get](#reservationorder_get) +- [List](#reservationorder_list) +- [Purchase](#reservationorder_purchase) + +## ResourceProvider + +- [GetAppliedReservationList](#resourceprovider_getappliedreservationlist) +- [GetCatalog](#resourceprovider_getcatalog) +### CalculateExchange_Post + +```java +import com.azure.core.util.Context; +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.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.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-03-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)))) + .withReservationsToExchange( + Arrays + .asList( + new ReservationToReturn() + .withReservationId( + "/providers/microsoft.capacity/reservationOrders/1f14354c-dc12-4c8d-8090-6f295a3a34aa/reservations/c8c926bd-fc5d-4e29-9d43-b68340ac23a6") + .withQuantity(1)))), + Context.NONE); + } +} +``` + +### Exchange_Post + +```java +import com.azure.core.util.Context; +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-03-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")), + Context.NONE); + } +} +``` + +### Operation_List + +```java +import com.azure.core.util.Context; + +/** Samples for Operation List. */ +public final class OperationListSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-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(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 +import com.azure.core.util.Context; + +/** 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", + Context.NONE); + } +} +``` + +### Quota_List + +```java +import com.azure.core.util.Context; + +/** 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", 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", Context.NONE); + } +} +``` + +### Quota_Update + +```java +import com.azure.core.util.Context; +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", + Context.NONE) + .getValue(); + resource + .update() + .withProperties( + new QuotaProperties() + .withLimit(200) + .withUnit("Count") + .withName(new ResourceName().withValue("standardFSv2Family"))) + .apply(); + } +} +``` + +### QuotaRequestStatus_Get + +```java +import com.azure.core.util.Context; + +/** 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", + 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", + 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", + Context.NONE); + } +} +``` + +### QuotaRequestStatus_List + +```java +import com.azure.core.util.Context; + +/** 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, Context.NONE); + } +} +``` + +### Reservation_AvailableScopes + +```java +import com.azure.core.util.Context; +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-03-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"))), + Context.NONE); + } +} +``` + +### Reservation_Get + +```java +import com.azure.core.util.Context; + +/** Samples for Reservation Get. */ +public final class ReservationGetSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-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( + "6ef59113-3482-40da-8d79-787f823e34bc", + "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", + "renewProperties", + Context.NONE); + } +} +``` + +### Reservation_List + +```java +import com.azure.core.util.Context; + +/** Samples for Reservation List. */ +public final class ReservationListSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-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", Context.NONE); + } +} +``` + +### Reservation_ListAll + +```java +import com.azure.core.util.Context; + +/** Samples for Reservation ListAll. */ +public final class ReservationListAllSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservations.json + */ + /** + * Sample code: Catalog. + * + * @param manager Entry point to ReservationsManager. + */ + public static void catalog(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservations() + .listAll( + "(properties/archived eq false)", + "properties/displayName asc", + "true", + 50.0F, + null, + 1.0F, + Context.NONE); + } +} +``` + +### Reservation_ListRevisions + +```java +import com.azure.core.util.Context; + +/** Samples for Reservation ListRevisions. */ +public final class ReservationListRevisionsSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-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( + "6ef59113-3482-40da-8d79-787f823e34bc", "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", Context.NONE); + } +} +``` + +### Reservation_Merge + +```java +import com.azure.core.util.Context; +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-03-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")), + Context.NONE); + } +} +``` + +### Reservation_Split + +```java +import com.azure.core.util.Context; +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-03-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"), + Context.NONE); + } +} +``` + +### Reservation_Update + +```java +import com.azure.core.util.Context; +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-03-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), + Context.NONE); + } +} +``` + +### ReservationOrder_Calculate + +```java +import com.azure.core.util.Context; +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-03-01/examples/CalculateReservationOrder.json + */ + /** + * Sample code: Purchase. + * + * @param manager Entry point to ReservationsManager. + */ + public static void purchase(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)), + Context.NONE); + } +} +``` + +### ReservationOrder_ChangeDirectory + +```java +import com.azure.core.util.Context; +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-03-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"), + Context.NONE); + } +} +``` + +### ReservationOrder_Get + +```java +import com.azure.core.util.Context; + +/** Samples for ReservationOrder Get. */ +public final class ReservationOrderGetSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservationOrderDetails.json + */ + /** + * Sample code: GetReservation. + * + * @param manager Entry point to ReservationsManager. + */ + public static void getReservation(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager.reservationOrders().getWithResponse("a075419f-44cc-497f-b68a-14ee811d48b9", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-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", Context.NONE); + } +} +``` + +### ReservationOrder_List + +```java +import com.azure.core.util.Context; + +/** Samples for ReservationOrder List. */ +public final class ReservationOrderListSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-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(Context.NONE); + } +} +``` + +### ReservationOrder_Purchase + +```java +import com.azure.core.util.Context; +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-03-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)), + Context.NONE); + } +} +``` + +### ResourceProvider_GetAppliedReservationList + +```java +import com.azure.core.util.Context; + +/** Samples for ResourceProvider GetAppliedReservationList. */ +public final class ResourceProviderGetAppliedReservationListSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-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", Context.NONE); + } +} +``` + +### ResourceProvider_GetCatalog + +```java +import com.azure.core.util.Context; + +/** Samples for ResourceProvider GetCatalog. */ +public final class ResourceProviderGetCatalogSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-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() + .getCatalogWithResponse( + "23bc208b-083f-4901-ae85-4f98c0c3b4b6", "VirtualMachines", "eastus", null, null, null, 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..6234d091221d0 --- /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-03. + 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.31.0 + + + com.azure + azure-core-management + 1.7.1 + + + 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..88f7404107262 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/ReservationsManager.java @@ -0,0 +1,393 @@ +// 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.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.models.CalculateExchanges; +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 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 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 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..1636df666e49a --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/AzureReservationApi.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.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 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/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..ee0fb1257aa9b --- /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 the 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 the 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..de3e74b294ca6 --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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), 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), 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..48246a6950cf7 --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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); + + /** + * 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); + + /** + * 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..384e0e536382f --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CalculatePriceResponseInner calculate(PurchaseRequest body); + + /** + * 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response calculateWithResponse(PurchaseRequest body, Context context); + + /** + * 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 the 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 the 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 long-running operation. + */ + @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 long-running operation. + */ + @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 the response. + */ + @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 the response. + */ + @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); +} 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..ceffd085114ab --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/ReservationsClient.java @@ -0,0 +1,432 @@ +// 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`. + * + *

Get Available Scopes for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the Reservation Item. + * @param body Available scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 available Scopes for `Reservation`. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AvailableScopePropertiesInner> beginAvailableScopes( + String reservationOrderId, String reservationId, AvailableScopeRequest body); + + /** + * Get Available Scopes for `Reservation`. + * + *

Get Available Scopes for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the Reservation Item. + * @param body Available scope. + * @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 available Scopes for `Reservation`. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AvailableScopePropertiesInner> beginAvailableScopes( + String reservationOrderId, String reservationId, AvailableScopeRequest body, Context context); + + /** + * Get Available Scopes for `Reservation`. + * + *

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

Get Available Scopes for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the Reservation Item. + * @param body Available scope. + * @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 available Scopes for `Reservation`. + */ + @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 the 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 the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String reservationOrderId, Context context); + + /** + * Get `Reservation` details. + * + *

Get specific `Reservation` details. + * + * @param reservationId Id of the Reservation Item. + * @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 specific `Reservation` details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ReservationResponseInner get(String reservationId, String reservationOrderId); + + /** + * Get `Reservation` details. + * + *

Get specific `Reservation` details. + * + * @param reservationId Id of the Reservation Item. + * @param reservationOrderId Order Id of the reservation. + * @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 reservationId, String reservationOrderId, String expand, 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 {@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); + + /** + * Get `Reservation` revisions. + * + *

List of all the revisions for the `Reservation`. + * + * @param reservationId Id of the Reservation Item. + * @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 paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listRevisions(String reservationId, String reservationOrderId); + + /** + * Get `Reservation` revisions. + * + *

List of all the revisions for the `Reservation`. + * + * @param reservationId Id of the Reservation Item. + * @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 the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listRevisions( + String reservationId, String reservationOrderId, 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, + * 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..c48c6436eaa0c --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/ResourceProvidersClient.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.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.AppliedReservationsInner; +import com.azure.resourcemanager.reservations.fluent.models.CatalogInner; +import java.util.List; + +/** 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List getCatalog(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 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 along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> getCatalogWithResponse( + String subscriptionId, + String reservedResourceType, + String location, + String publisherId, + String offerId, + String planId, + 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); + + /** + * 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); +} 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..6377bf1e11110 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/AppliedReservationsInner.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.models.AppliedReservationList; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The AppliedReservations model. */ +@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; + + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private AppliedReservationsProperties innerProperties; + + /** + * 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: The properties property. + * + * @return the innerProperties value. + */ + private AppliedReservationsProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the reservationOrderIds property: The reservationOrderIds property. + * + * @return the reservationOrderIds value. + */ + public AppliedReservationList reservationOrderIds() { + return this.innerProperties() == null ? null : this.innerProperties().reservationOrderIds(); + } + + /** + * Set the reservationOrderIds property: The reservationOrderIds property. + * + * @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..d6dc9c7a25572 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/AppliedReservationsProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.models.AppliedReservationList; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The AppliedReservationsProperties model. */ +@Fluent +public final class AppliedReservationsProperties { + /* + * The reservationOrderIds property. + */ + @JsonProperty(value = "reservationOrderIds") + private AppliedReservationList reservationOrderIds; + + /** + * Get the reservationOrderIds property: The reservationOrderIds property. + * + * @return the reservationOrderIds value. + */ + public AppliedReservationList reservationOrderIds() { + return this.reservationOrderIds; + } + + /** + * Set the reservationOrderIds property: The reservationOrderIds property. + * + * @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..ce0493afd04f5 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/AvailableScopePropertiesInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.models.SubscriptionScopeProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The AvailableScopeProperties model. */ +@Fluent +public final class AvailableScopePropertiesInner { + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private SubscriptionScopeProperties properties; + + /** + * Get the properties property: The properties property. + * + * @return the properties value. + */ + public SubscriptionScopeProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties property. + * + * @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..278f88fbc2ee6 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CalculateExchangeOperationResultResponseInner.java @@ -0,0 +1,162 @@ +// 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; + + /** + * 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..04ad8d7923968 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CalculatePriceResponseInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.models.CalculatePriceResponseProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CalculatePriceResponse model. */ +@Fluent +public final class CalculatePriceResponseInner { + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private CalculatePriceResponseProperties properties; + + /** + * Get the properties property: The properties property. + * + * @return the properties value. + */ + public CalculatePriceResponseProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties property. + * + * @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/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..c66ff8e095ebc --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CatalogInner.java @@ -0,0 +1,218 @@ +// 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; + +/** The Catalog model. */ +@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; + + /** + * 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..b17e78d002afd --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ChangeDirectoryResponseInner.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.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; + + /** + * 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..89ac7120bb151 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/CurrentQuotaLimitBaseInner.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.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; + + /** + * 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..a84dad46bb7f5 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ExchangeOperationResultResponseInner.java @@ -0,0 +1,161 @@ +// 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; + + /** + * 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..0d92252a16a51 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/MergeProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The MergeProperties model. */ +@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; + + /** + * 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..901ff586b8190 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/OperationResponseInner.java @@ -0,0 +1,154 @@ +// 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 OperationResponse model. */ +@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; + + /** + * 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..e5260cd873431 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/PatchProperties.java @@ -0,0 +1,190 @@ +// 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.AppliedScopeType; +import com.azure.resourcemanager.reservations.models.InstanceFlexibility; +import com.azure.resourcemanager.reservations.models.PatchPropertiesRenewProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The PatchProperties model. */ +@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; + + /* + * 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; + + /* + * 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; + + /** + * 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 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: Name of the Reservation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void 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..f938c463730b7 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/PurchaseRequestProperties.java @@ -0,0 +1,296 @@ +// 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.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.util.List; + +/** The PurchaseRequestProperties model. */ +@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 + */ + @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; + + /* + * 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; + + /** + * 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. + * + * @return the billingScopeId value. + */ + public String billingScopeId() { + return this.billingScopeId; + } + + /** + * Set the billingScopeId property: Subscription that will be charged for purchasing Reservation. + * + * @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 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void 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..b342a6b58f11a --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/QuotaRequestDetailsInner.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; + + /** + * 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..f79d61260d9c7 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/QuotaRequestProperties.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.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; + + /** + * 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..d2747bdee4f73 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/QuotaRequestStatusDetails.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.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; + + /** + * 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..9ffd447b36f08 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/QuotaRequestSubmitResponse201Inner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.reservations.models.QuotaRequestState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Response with request ID that the quota request was accepted. */ +@Fluent +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; + + /** + * 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/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..93510411e9e32 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ReservationOrderProperties.java @@ -0,0 +1,319 @@ +// 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; + +/** The ReservationOrderProperties model. */ +@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 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; + + /** + * 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 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; + } + + /** + * 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..e3a22b4ded963 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ReservationOrderResponseInner.java @@ -0,0 +1,341 @@ +// 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; + +/** The ReservationOrderResponse model. */ +@Fluent +public final class ReservationOrderResponseInner extends ProxyResource { + /* + * The etag property. + */ + @JsonProperty(value = "etag") + private Integer etag; + + /* + * The properties property. + */ + @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; + + /** + * 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: The properties property. + * + * @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 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; + } + + /** + * 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..a85f0d016f5ae --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/ReservationResponseInner.java @@ -0,0 +1,176 @@ +// 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; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * 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: Metadata pertaining to creation and last modification of the resource. + * + * @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/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..abe5c2931b5c8 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/fluent/models/SplitProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The SplitProperties model. */ +@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; + + /** + * 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..1a8c93c34d54b --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/AzureReservationApiImpl.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.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.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 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 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.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..d1da6b4498098 --- /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") + private 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-03-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-03-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 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 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/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..f6f6cb66b1e3d --- /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") + private 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-03-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-03-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 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 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..2d091d555b7bc --- /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") + private 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 the response body 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-03-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 the response body 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-03-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 the 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 the 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 the 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 the 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 the response body 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 the response body 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..4ef01f6ef195e --- /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") + private 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 getAsync(subscriptionId, providerId, location, id).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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), 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..ae348a4481703 --- /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 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 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 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..e8618ee32fa0e --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/QuotasClientImpl.java @@ -0,0 +1,1332 @@ +// 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") + private 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 getAsync(subscriptionId, providerId, location, resourceName).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * 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 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 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 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 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..d23c7ace52736 --- /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 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 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 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/ReservationOrderResponseImpl.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationOrderResponseImpl.java new file mode 100644 index 0000000000000..b46841e64439d --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationOrderResponseImpl.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.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 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 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..a9125ec8c12e8 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationOrdersClientImpl.java @@ -0,0 +1,965 @@ +// 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") + private 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 body 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-03-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 body 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-03-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 body 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CalculatePriceResponseInner calculate(PurchaseRequest body) { + return calculateAsync(body).block(); + } + + /** + * 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response calculateWithResponse(PurchaseRequest body, Context context) { + return calculateWithResponseAsync(body, context).block(); + } + + /** + * 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 the response body 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-03-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 the response body 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-03-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 the 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 the 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 the 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 the 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 the response body 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-03-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 the response body 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-03-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 long-running operation. + */ + @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 long-running operation. + */ + @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 long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ReservationOrderResponseInner> beginPurchase( + String reservationOrderId, PurchaseRequest body) { + return 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 long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ReservationOrderResponseInner> beginPurchase( + String reservationOrderId, PurchaseRequest body, Context context) { + return 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 the response body 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 the response body 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 the response. + */ + @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 the response. + */ + @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-03-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-03-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. + * @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` on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String reservationOrderId, String expand) { + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 getAsync(reservationOrderId, expand).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * 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-03-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-03-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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 changeDirectoryAsync(reservationOrderId, body).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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(); + } + + /** + * 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 response body 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 the response body 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..f7e524088f629 --- /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 CalculatePriceResponse calculate(PurchaseRequest body) { + CalculatePriceResponseInner inner = this.serviceClient().calculate(body); + if (inner != null) { + return new CalculatePriceResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + 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 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 ReservationOrderResponse get(String reservationOrderId) { + ReservationOrderResponseInner inner = this.serviceClient().get(reservationOrderId); + 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 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; + } + } + + 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; + } + } + + 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..7daad4189747b --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationsClientImpl.java @@ -0,0 +1,2212 @@ +// 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") + private 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("reservationId") String reservationId, + @PathParam("reservationOrderId") String reservationOrderId, + @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"}) + @Get( + "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}" + + "/revisions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listRevisions( + @HostParam("$host") String endpoint, + @PathParam("reservationId") String reservationId, + @PathParam("reservationOrderId") String reservationOrderId, + @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`. + * + *

Get Available Scopes for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the Reservation Item. + * @param body Available scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available Scopes for `Reservation` 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-03-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`. + * + *

Get Available Scopes for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the Reservation Item. + * @param body Available scope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available Scopes for `Reservation` 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-03-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`. + * + *

Get Available Scopes for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the Reservation Item. + * @param body Available scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 available Scopes for `Reservation`. + */ + @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`. + * + *

Get Available Scopes for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the Reservation Item. + * @param body Available scope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of available Scopes for `Reservation`. + */ + @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`. + * + *

Get Available Scopes for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the Reservation Item. + * @param body Available scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 available Scopes for `Reservation`. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AvailableScopePropertiesInner> beginAvailableScopes( + String reservationOrderId, String reservationId, AvailableScopeRequest body) { + return beginAvailableScopesAsync(reservationOrderId, reservationId, body).getSyncPoller(); + } + + /** + * Get Available Scopes for `Reservation`. + * + *

Get Available Scopes for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the Reservation Item. + * @param body Available scope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of available Scopes for `Reservation`. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AvailableScopePropertiesInner> beginAvailableScopes( + String reservationOrderId, String reservationId, AvailableScopeRequest body, Context context) { + return beginAvailableScopesAsync(reservationOrderId, reservationId, body, context).getSyncPoller(); + } + + /** + * Get Available Scopes for `Reservation`. + * + *

Get Available Scopes for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the Reservation Item. + * @param body Available scope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available Scopes for `Reservation` 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`. + * + *

Get Available Scopes for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the Reservation Item. + * @param body Available scope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available Scopes for `Reservation` 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`. + * + *

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

Get Available Scopes for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the Reservation Item. + * @param body Available scope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return available Scopes for `Reservation`. + */ + @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-03-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-03-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 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 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-03-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-03-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 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 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 the response body 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-03-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 the response body 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-03-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 the 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 the 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 the 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 the 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 reservationId Id of the Reservation Item. + * @param reservationOrderId Order Id of the reservation. + * @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 reservationId, 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 (reservationId == null) { + return Mono.error(new IllegalArgumentException("Parameter reservationId 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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + reservationId, + reservationOrderId, + apiVersion, + expand, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get `Reservation` details. + * + *

Get specific `Reservation` details. + * + * @param reservationId Id of the Reservation Item. + * @param reservationOrderId Order Id of the reservation. + * @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 reservationId, 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 (reservationId == null) { + return Mono.error(new IllegalArgumentException("Parameter reservationId 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-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get(this.client.getEndpoint(), reservationId, reservationOrderId, apiVersion, expand, accept, context); + } + + /** + * Get `Reservation` details. + * + *

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

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

Get specific `Reservation` details. + * + * @param reservationId Id of the Reservation Item. + * @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 specific `Reservation` details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ReservationResponseInner get(String reservationId, String reservationOrderId) { + final String expand = null; + return getAsync(reservationId, reservationOrderId, expand).block(); + } + + /** + * Get `Reservation` details. + * + *

Get specific `Reservation` details. + * + * @param reservationId Id of the Reservation Item. + * @param reservationOrderId Order Id of the reservation. + * @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 reservationId, String reservationOrderId, String expand, Context context) { + return getWithResponseAsync(reservationId, reservationOrderId, expand, context).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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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-03-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-03-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 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 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(); + } + + /** + * Get `Reservation` revisions. + * + *

List of all the revisions for the `Reservation`. + * + * @param reservationId Id of the Reservation Item. + * @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 response body along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRevisionsSinglePageAsync( + String reservationId, String reservationOrderId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (reservationId == null) { + return Mono.error(new IllegalArgumentException("Parameter reservationId 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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listRevisions( + this.client.getEndpoint(), reservationId, 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` revisions. + * + *

List of all the revisions for the `Reservation`. + * + * @param reservationId Id of the Reservation Item. + * @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 the response body along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRevisionsSinglePageAsync( + String reservationId, 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 (reservationId == null) { + return Mono.error(new IllegalArgumentException("Parameter reservationId 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-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listRevisions(this.client.getEndpoint(), reservationId, reservationOrderId, 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 reservationId Id of the Reservation Item. + * @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 paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRevisionsAsync(String reservationId, String reservationOrderId) { + return new PagedFlux<>( + () -> listRevisionsSinglePageAsync(reservationId, reservationOrderId), + nextLink -> listRevisionsNextSinglePageAsync(nextLink)); + } + + /** + * Get `Reservation` revisions. + * + *

List of all the revisions for the `Reservation`. + * + * @param reservationId Id of the Reservation Item. + * @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 the paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRevisionsAsync( + String reservationId, String reservationOrderId, Context context) { + return new PagedFlux<>( + () -> listRevisionsSinglePageAsync(reservationId, reservationOrderId, context), + nextLink -> listRevisionsNextSinglePageAsync(nextLink, context)); + } + + /** + * Get `Reservation` revisions. + * + *

List of all the revisions for the `Reservation`. + * + * @param reservationId Id of the Reservation Item. + * @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 paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listRevisions(String reservationId, String reservationOrderId) { + return new PagedIterable<>(listRevisionsAsync(reservationId, reservationOrderId)); + } + + /** + * Get `Reservation` revisions. + * + *

List of all the revisions for the `Reservation`. + * + * @param reservationId Id of the Reservation Item. + * @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 the paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listRevisions( + String reservationId, String reservationOrderId, Context context) { + return new PagedIterable<>(listRevisionsAsync(reservationId, reservationOrderId, 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, + * 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-03-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, + * 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-03-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, + * 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, + * 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, + * 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 the response body 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 the response body 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 the response body 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 the response body 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..dff739936c437 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ReservationsImpl.java @@ -0,0 +1,209 @@ +// 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 ReservationResponse get(String reservationId, String reservationOrderId) { + ReservationResponseInner inner = this.serviceClient().get(reservationId, reservationOrderId); + if (inner != null) { + return new ReservationResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String reservationId, String reservationOrderId, String expand, Context context) { + Response inner = + this.serviceClient().getWithResponse(reservationId, reservationOrderId, 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 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 PagedIterable listRevisions(String reservationId, String reservationOrderId) { + PagedIterable inner = + this.serviceClient().listRevisions(reservationId, reservationOrderId); + return Utils.mapPage(inner, inner1 -> new ReservationResponseImpl(inner1, this.manager())); + } + + public PagedIterable listRevisions( + String reservationId, String reservationOrderId, Context context) { + PagedIterable inner = + this.serviceClient().listRevisions(reservationId, reservationOrderId, 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..729fd0c4c8835 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,412 @@ +// 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.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 java.util.List; +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") + private interface ResourceProvidersService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> getCatalog( + @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, + @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); + } + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> getCatalogWithResponseAsync( + String subscriptionId, + String reservedResourceType, + String location, + String publisherId, + String offerId, + String planId) { + 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-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getCatalog( + this.client.getEndpoint(), + apiVersion, + subscriptionId, + reservedResourceType, + location, + publisherId, + offerId, + planId, + accept, + context)) + .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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> getCatalogWithResponseAsync( + String subscriptionId, + String reservedResourceType, + String location, + String publisherId, + String offerId, + String planId, + 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-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getCatalog( + this.client.getEndpoint(), + apiVersion, + subscriptionId, + reservedResourceType, + location, + publisherId, + offerId, + planId, + accept, + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCatalogAsync( + String subscriptionId, + String reservedResourceType, + String location, + String publisherId, + String offerId, + String planId) { + return getCatalogWithResponseAsync(subscriptionId, reservedResourceType, location, publisherId, offerId, planId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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 on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getCatalogAsync(String subscriptionId) { + final String reservedResourceType = null; + final String location = null; + final String publisherId = null; + final String offerId = null; + final String planId = null; + return getCatalogWithResponseAsync(subscriptionId, reservedResourceType, location, publisherId, offerId, planId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List getCatalog(String subscriptionId) { + final String reservedResourceType = null; + final String location = null; + final String publisherId = null; + final String offerId = null; + final String planId = null; + return getCatalogAsync(subscriptionId, reservedResourceType, location, publisherId, offerId, planId).block(); + } + + /** + * 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> getCatalogWithResponse( + String subscriptionId, + String reservedResourceType, + String location, + String publisherId, + String offerId, + String planId, + Context context) { + return getCatalogWithResponseAsync( + subscriptionId, reservedResourceType, location, publisherId, offerId, planId, 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 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-03-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-03-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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 getAppliedReservationListAsync(subscriptionId).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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(); + } +} 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..df86f273d82fc --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/implementation/ResourceProvidersImpl.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.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; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +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 List getCatalog(String subscriptionId) { + List inner = this.serviceClient().getCatalog(subscriptionId); + if (inner != null) { + return Collections + .unmodifiableList( + inner.stream().map(inner1 -> new CatalogImpl(inner1, this.manager())).collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> getCatalogWithResponse( + String subscriptionId, + String reservedResourceType, + String location, + String publisherId, + String offerId, + String planId, + Context context) { + Response> inner = + this + .serviceClient() + .getCatalogWithResponse( + subscriptionId, reservedResourceType, location, publisherId, offerId, planId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new CatalogImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } 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; + } + } + + 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; + } + } + + 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/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..4aee347f4380c --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AppliedReservationList.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The AppliedReservationList model. */ +@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; + + /** + * 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..a69d8e11f391a --- /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: The reservationOrderIds property. + * + * @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/AppliedScopeType.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AppliedScopeType.java new file mode 100644 index 0000000000000..c71ad941dd7cb --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AppliedScopeType.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.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"); + + /** + * 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..ec797a4ecea8c --- /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 properties property. + * + * @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..f8bfe1cc30714 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AvailableScopeRequest.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.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; + + /** + * 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..9322dd1053896 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/AvailableScopeRequestProperties.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.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; + + /** + * 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..6785160b3d9d4 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/BillingInformation.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** billing information. */ +@Fluent +public final class BillingInformation { + /* + * The billingCurrencyTotalPaidAmount property. + */ + @JsonProperty(value = "billingCurrencyTotalPaidAmount") + private Price billingCurrencyTotalPaidAmount; + + /* + * The billingCurrencyProratedAmount property. + */ + @JsonProperty(value = "billingCurrencyProratedAmount") + private Price billingCurrencyProratedAmount; + + /* + * The billingCurrencyRemainingCommitmentAmount property. + */ + @JsonProperty(value = "billingCurrencyRemainingCommitmentAmount") + private Price billingCurrencyRemainingCommitmentAmount; + + /** + * Get the billingCurrencyTotalPaidAmount property: The billingCurrencyTotalPaidAmount property. + * + * @return the billingCurrencyTotalPaidAmount value. + */ + public Price billingCurrencyTotalPaidAmount() { + return this.billingCurrencyTotalPaidAmount; + } + + /** + * Set the billingCurrencyTotalPaidAmount property: The billingCurrencyTotalPaidAmount property. + * + * @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: The billingCurrencyProratedAmount property. + * + * @return the billingCurrencyProratedAmount value. + */ + public Price billingCurrencyProratedAmount() { + return this.billingCurrencyProratedAmount; + } + + /** + * Set the billingCurrencyProratedAmount property: The billingCurrencyProratedAmount property. + * + * @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: The billingCurrencyRemainingCommitmentAmount property. + * + * @return the billingCurrencyRemainingCommitmentAmount value. + */ + public Price billingCurrencyRemainingCommitmentAmount() { + return this.billingCurrencyRemainingCommitmentAmount; + } + + /** + * Set the billingCurrencyRemainingCommitmentAmount property: The billingCurrencyRemainingCommitmentAmount property. + * + * @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/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..7d28ab0732606 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeOperationResultStatus.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.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 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..627edea7ebc4a --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeRequest.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.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; + + /** + * 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..538f4591c5a77 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeRequestProperties.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.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 reservations that are being returned in this exchange. + */ + @JsonProperty(value = "reservationsToExchange") + private List reservationsToExchange; + + /** + * 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 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 (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..bca568e708fdd --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculateExchangeResponseProperties.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.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; + + /* + * The netPayable property. + */ + @JsonProperty(value = "netPayable") + private Price netPayable; + + /* + * The refundsTotal property. + */ + @JsonProperty(value = "refundsTotal") + private Price refundsTotal; + + /* + * The purchasesTotal property. + */ + @JsonProperty(value = "purchasesTotal") + private Price purchasesTotal; + + /* + * Details of the reservations being purchased + */ + @JsonProperty(value = "reservationsToPurchase") + private List reservationsToPurchase; + + /* + * Details of the reservations being returned + */ + @JsonProperty(value = "reservationsToExchange") + private List reservationsToExchange; + + /* + * Exchange policy errors + */ + @JsonProperty(value = "policyResult") + private ExchangePolicyErrors policyResult; + + /** + * 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: The netPayable property. + * + * @return the netPayable value. + */ + public Price netPayable() { + return this.netPayable; + } + + /** + * Set the netPayable property: The netPayable property. + * + * @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: The refundsTotal property. + * + * @return the refundsTotal value. + */ + public Price refundsTotal() { + return this.refundsTotal; + } + + /** + * Set the refundsTotal property: The refundsTotal property. + * + * @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: The purchasesTotal property. + * + * @return the purchasesTotal value. + */ + public Price purchasesTotal() { + return this.purchasesTotal; + } + + /** + * Set the purchasesTotal property: The purchasesTotal property. + * + * @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 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 (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..9aae5e6a18748 --- /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: The properties property. + * + * @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..78012b3ef795b --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculatePriceResponseProperties.java @@ -0,0 +1,326 @@ +// 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 CalculatePriceResponseProperties model. */ +@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; + + /** + * 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..d00fcd3b7abf9 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculatePriceResponsePropertiesBillingCurrencyTotal.java @@ -0,0 +1,72 @@ +// 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; + + /** + * 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..a9df9971d24cc --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CalculatePriceResponsePropertiesPricingCurrencyTotal.java @@ -0,0 +1,72 @@ +// 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; + + /** + * 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/Catalog.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Catalog.java new file mode 100644 index 0000000000000..5c865c7f860db --- /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..b8b583bb87f08 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/CatalogMsrp.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.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; + + /** + * 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/ChangeDirectoryRequest.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ChangeDirectoryRequest.java new file mode 100644 index 0000000000000..e6fa548ef87c2 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ChangeDirectoryRequest.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ChangeDirectoryRequest model. */ +@Fluent +public final class ChangeDirectoryRequest { + /* + * Tenant id GUID that reservation order is to be transferred to + */ + @JsonProperty(value = "destinationTenantId") + private String destinationTenantId; + + /** + * 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..a06431f3308c8 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ChangeDirectoryResult.java @@ -0,0 +1,126 @@ +// 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; + + /** + * 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/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/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..cac38d5a0208a --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeOperationResultStatus.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; + +/** 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 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..6cf5991760718 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangePolicyError.java @@ -0,0 +1,72 @@ +// 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; + + /** + * 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..ca61510cfd0f3 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangePolicyErrors.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; +import java.util.List; + +/** Exchange policy errors. */ +@Fluent +public final class ExchangePolicyErrors { + /* + * Exchange Policy errors + */ + @JsonProperty(value = "policyErrors") + private List policyErrors; + + /** + * 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..389e8573c6717 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeRequest.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.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; + + /** + * 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..362e4e3f734ff --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeRequestProperties.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.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; + + /** + * 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..4c6de521b7b44 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExchangeResponseProperties.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.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; + + /* + * The netPayable property. + */ + @JsonProperty(value = "netPayable") + private Price netPayable; + + /* + * The refundsTotal property. + */ + @JsonProperty(value = "refundsTotal") + private Price refundsTotal; + + /* + * The purchasesTotal property. + */ + @JsonProperty(value = "purchasesTotal") + private Price purchasesTotal; + + /* + * Details of the reservations being purchased + */ + @JsonProperty(value = "reservationsToPurchase") + private List reservationsToPurchase; + + /* + * Details of the reservations being returned + */ + @JsonProperty(value = "reservationsToExchange") + private List reservationsToExchange; + + /* + * Exchange policy errors + */ + @JsonProperty(value = "policyResult") + private ExchangePolicyErrors policyResult; + + /** + * 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: The netPayable property. + * + * @return the netPayable value. + */ + public Price netPayable() { + return this.netPayable; + } + + /** + * Set the netPayable property: The netPayable property. + * + * @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: The refundsTotal property. + * + * @return the refundsTotal value. + */ + public Price refundsTotal() { + return this.refundsTotal; + } + + /** + * Set the refundsTotal property: The refundsTotal property. + * + * @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: The purchasesTotal property. + * + * @return the purchasesTotal value. + */ + public Price purchasesTotal() { + return this.purchasesTotal; + } + + /** + * Set the purchasesTotal property: The purchasesTotal property. + * + * @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 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 (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..c4b22b38dd2bf --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ExtendedStatusInfo.java @@ -0,0 +1,72 @@ +// 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; + + /** + * 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..fe6ea48967887 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/InstanceFlexibility.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.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 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..61baa93ab5444 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/MergeRequest.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.azure.resourcemanager.reservations.fluent.models.MergeProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The MergeRequest model. */ +@Fluent +public final class MergeRequest { + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private MergeProperties innerProperties; + + /** + * Get the innerProperties property: The properties property. + * + * @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..3d015f4f00417 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationDisplay.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The OperationDisplay model. */ +@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; + + /** + * 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..cba4913b2e82d --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationList.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.azure.resourcemanager.reservations.fluent.models.OperationResponseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The OperationList model. */ +@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; + + /** + * 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..e3be816cb615d --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationResultError.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; + + /** + * 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..4331ab5902354 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/OperationStatus.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; + +/** 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 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..4f89c966f925d --- /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 the 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 the 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..c0a0f88f0217f --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PatchModel.java @@ -0,0 +1,184 @@ +// 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.util.List; + +/** The PatchModel model. */ +@Fluent +public final class PatchModel { + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private PatchProperties innerProperties; + + /** + * Get the innerProperties property: The properties property. + * + * @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 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: Name of the Reservation. + * + * @return the name value. + */ + public String name() { + return this.innerProperties() == null ? null : this.innerProperties().name(); + } + + /** + * Set the name property: 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; + } + + /** + * 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..6c1f589b2c2ca --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PatchPropertiesRenewProperties.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The PatchPropertiesRenewProperties model. */ +@Fluent +public final class PatchPropertiesRenewProperties { + /* + * The purchaseProperties property. + */ + @JsonProperty(value = "purchaseProperties") + private PurchaseRequest purchaseProperties; + + /** + * Get the purchaseProperties property: The purchaseProperties property. + * + * @return the purchaseProperties value. + */ + public PurchaseRequest purchaseProperties() { + return this.purchaseProperties; + } + + /** + * Set the purchaseProperties property: The purchaseProperties property. + * + * @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..49c51055788b9 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PaymentDetail.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; + + /** + * 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..76726c29b4cd7 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PaymentStatus.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; + +/** 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 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..c71d411cc8ccd --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Price.java @@ -0,0 +1,72 @@ +// 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 Price model. */ +@Fluent +public final 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; + + /** + * 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..4b993fb8b2847 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ProvisioningState.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; + +/** 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 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..76a1b0a9c1661 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PurchaseRequest.java @@ -0,0 +1,332 @@ +// 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.util.List; + +/** The PurchaseRequest model. */ +@Fluent +public final class PurchaseRequest { + /* + * The sku property. + */ + @JsonProperty(value = "sku") + private SkuName sku; + + /* + * The Azure Region where the reserved resource lives. + */ + @JsonProperty(value = "location") + private String location; + + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private PurchaseRequestProperties innerProperties; + + /** + * Get the sku property: The sku property. + * + * @return the sku value. + */ + public SkuName sku() { + return this.sku; + } + + /** + * Set the sku property: The sku property. + * + * @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: The properties property. + * + * @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. + * + * @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. + * + * @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 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; + } + + /** + * 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..fe5f2f19e0582 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/PurchaseRequestPropertiesReservedResourceProperties.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; + +/** 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; + + /** + * 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..b33d9043b0959 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaLimits.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.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; + + /** + * 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..4d2024469cf21 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaProperties.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; + +/** 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; + + /** + * 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..315c6cd0e01c4 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaRequestDetailsList.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.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; + + /** + * 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..ba73198d76974 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotaRequestState.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; + +/** 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 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..3cdb2e81db752 --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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), 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), 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..78af661d17a73 --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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); + + /** + * 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); + + /** + * 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..9b1be235c62b9 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasGetHeaders.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +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("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..e72973a1ac044 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasListHeaders.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +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("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..ffedbd2da9a3d --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/QuotasListNextHeaders.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +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("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/RenewPropertiesResponse.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RenewPropertiesResponse.java new file mode 100644 index 0000000000000..fb495ae582621 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RenewPropertiesResponse.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The RenewPropertiesResponse model. */ +@Fluent +public final class RenewPropertiesResponse { + /* + * The purchaseProperties property. + */ + @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; + + /** + * Get the purchaseProperties property: The purchaseProperties property. + * + * @return the purchaseProperties value. + */ + public PurchaseRequest purchaseProperties() { + return this.purchaseProperties; + } + + /** + * Set the purchaseProperties property: The purchaseProperties property. + * + * @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..2e6c2b02a33bf --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RenewPropertiesResponseBillingCurrencyTotal.java @@ -0,0 +1,75 @@ +// 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; + + /** + * 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..9b62fbd5498ad --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/RenewPropertiesResponsePricingCurrencyTotal.java @@ -0,0 +1,75 @@ +// 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; + + /** + * 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..3e6f2ffa6aca8 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationBillingPlan.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.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 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..a1a60c99c36d8 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationList.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.azure.resourcemanager.reservations.fluent.models.ReservationResponseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The ReservationList model. */ +@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; + + /** + * 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..2d863bba77c79 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationMergeProperties.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; +import java.util.List; + +/** The ReservationMergeProperties model. */ +@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; + + /** + * 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..37ef9babf64d2 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationOrderBillingPlanInformation.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; + + /** + * 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..f3153b48986ed --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationOrderList.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.azure.resourcemanager.reservations.fluent.models.ReservationOrderResponseInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The ReservationOrderList model. */ +@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; + + /** + * 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..dc482aae06862 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationOrderResponse.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.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 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 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..3550007068906 --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + CalculatePriceResponse calculate(PurchaseRequest body); + + /** + * 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 body along with {@link Response}. + */ + Response calculateWithResponse(PurchaseRequest body, Context context); + + /** + * 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 the 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 the 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 the response. + */ + 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 the response. + */ + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); +} 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..45db36c628d68 --- /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: Metadata pertaining to creation and last modification of the resource. + * + * @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..8a34d56a8e169 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationSplitProperties.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; +import java.util.List; + +/** The ReservationSplitProperties model. */ +@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; + + /** + * 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..e6dd272e7456f --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationStatusCode.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 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..6e216a1272b13 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationSummary.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; + + /** + * 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; + } + + /** + * 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..bb4aa7bf538ee --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationTerm.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.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 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..925ed006f67ec --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToExchange.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; + +/** 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; + + /* + * The billingRefundAmount property. + */ + @JsonProperty(value = "billingRefundAmount") + private Price billingRefundAmount; + + /* + * billing information + */ + @JsonProperty(value = "billingInformation") + private BillingInformation billingInformation; + + /** + * 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: The billingRefundAmount property. + * + * @return the billingRefundAmount value. + */ + public Price billingRefundAmount() { + return this.billingRefundAmount; + } + + /** + * Set the billingRefundAmount property: The billingRefundAmount property. + * + * @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..be6c929547bbb --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToPurchaseCalculateExchange.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Reservation purchase details. */ +@Fluent +public final class ReservationToPurchaseCalculateExchange { + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private PurchaseRequest properties; + + /* + * The billingCurrencyTotal property. + */ + @JsonProperty(value = "billingCurrencyTotal") + private Price billingCurrencyTotal; + + /** + * Get the properties property: The properties property. + * + * @return the properties value. + */ + public PurchaseRequest properties() { + return this.properties; + } + + /** + * Set the properties property: The properties property. + * + * @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: The billingCurrencyTotal property. + * + * @return the billingCurrencyTotal value. + */ + public Price billingCurrencyTotal() { + return this.billingCurrencyTotal; + } + + /** + * Set the billingCurrencyTotal property: The billingCurrencyTotal property. + * + * @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..8bf4df582b018 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToPurchaseExchange.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; + +/** 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 properties property. + */ + @JsonProperty(value = "properties") + private PurchaseRequest properties; + + /* + * The billingCurrencyTotal property. + */ + @JsonProperty(value = "billingCurrencyTotal") + private Price billingCurrencyTotal; + + /* + * Status of the individual operation. + */ + @JsonProperty(value = "status") + private OperationStatus status; + + /** + * 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 properties property. + * + * @return the properties value. + */ + public PurchaseRequest properties() { + return this.properties; + } + + /** + * Set the properties property: The properties property. + * + * @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: The billingCurrencyTotal property. + * + * @return the billingCurrencyTotal value. + */ + public Price billingCurrencyTotal() { + return this.billingCurrencyTotal; + } + + /** + * Set the billingCurrencyTotal property: The billingCurrencyTotal property. + * + * @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..8f0acc56bcf77 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToReturn.java @@ -0,0 +1,72 @@ +// 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; + + /** + * 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..110ad536f100c --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationToReturnForExchange.java @@ -0,0 +1,156 @@ +// 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; + + /* + * The billingRefundAmount property. + */ + @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; + + /** + * 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: The billingRefundAmount property. + * + * @return the billingRefundAmount value. + */ + public Price billingRefundAmount() { + return this.billingRefundAmount; + } + + /** + * Set the billingRefundAmount property: The billingRefundAmount property. + * + * @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..469f5929cf025 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationUtilizationAggregates.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.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; + + /** + * 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..8603f7606b160 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/Reservations.java @@ -0,0 +1,266 @@ +// 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`. + * + *

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

Get Available Scopes for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation. + * @param reservationId Id of the Reservation Item. + * @param body Available scope. + * @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 available Scopes for `Reservation`. + */ + 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 the 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 the paginated response with {@link PagedIterable}. + */ + PagedIterable list(String reservationOrderId, Context context); + + /** + * Get `Reservation` details. + * + *

Get specific `Reservation` details. + * + * @param reservationId Id of the Reservation Item. + * @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 specific `Reservation` details. + */ + ReservationResponse get(String reservationId, String reservationOrderId); + + /** + * Get `Reservation` details. + * + *

Get specific `Reservation` details. + * + * @param reservationId Id of the Reservation Item. + * @param reservationOrderId Order Id of the reservation. + * @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 reservationId, String reservationOrderId, String expand, 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. + */ + 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); + + /** + * Get `Reservation` revisions. + * + *

List of all the revisions for the `Reservation`. + * + * @param reservationId Id of the Reservation Item. + * @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 paginated response with {@link PagedIterable}. + */ + PagedIterable listRevisions(String reservationId, String reservationOrderId); + + /** + * Get `Reservation` revisions. + * + *

List of all the revisions for the `Reservation`. + * + * @param reservationId Id of the Reservation Item. + * @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 the paginated response with {@link PagedIterable}. + */ + PagedIterable listRevisions(String reservationId, String reservationOrderId, 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, + * 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..4280117cb65c8 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationsListResult.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.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; + + /** + * 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..6903693565a31 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationsProperties.java @@ -0,0 +1,768 @@ +// 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 Autofit 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; + + /* + * 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 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; + + /* + * The splitProperties property. + */ + @JsonProperty(value = "splitProperties") + private ReservationSplitProperties splitProperties; + + /* + * The mergeProperties property. + */ + @JsonProperty(value = "mergeProperties") + private ReservationMergeProperties mergeProperties; + + /* + * Subscription that will be charged for purchasing Reservation + */ + @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 renewProperties property. + */ + @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; + + /** + * 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 + * Autofit 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 + * Autofit 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 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 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 splitProperties property: The splitProperties property. + * + * @return the splitProperties value. + */ + public ReservationSplitProperties splitProperties() { + return this.splitProperties; + } + + /** + * Set the splitProperties property: The splitProperties property. + * + * @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: The mergeProperties property. + * + * @return the mergeProperties value. + */ + public ReservationMergeProperties mergeProperties() { + return this.mergeProperties; + } + + /** + * Set the mergeProperties property: The mergeProperties property. + * + * @param mergeProperties the mergeProperties value to set. + * @return the ReservationsProperties object itself. + */ + public ReservationsProperties withMergeProperties(ReservationMergeProperties mergeProperties) { + this.mergeProperties = mergeProperties; + return this; + } + + /** + * Get the billingScopeId property: Subscription that will be charged for purchasing Reservation. + * + * @return the billingScopeId value. + */ + public String billingScopeId() { + return this.billingScopeId; + } + + /** + * Set the billingScopeId property: Subscription that will be charged for purchasing Reservation. + * + * @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 renewProperties property. + * + * @return the renewProperties value. + */ + public RenewPropertiesResponse renewProperties() { + return this.renewProperties; + } + + /** + * Set the renewProperties property: The renewProperties property. + * + * @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 (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..a48be979ab6bd --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservationsPropertiesUtilization.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; +import java.util.List; + +/** Reservation utilization. */ +@Fluent +public final class ReservationsPropertiesUtilization { + /* + * The number of days trend for a reservation + */ + @JsonProperty(value = "trend", access = JsonProperty.Access.WRITE_ONLY) + private String trend; + + /* + * The array of aggregates of a reservation's utilization + */ + @JsonProperty(value = "aggregates") + private List aggregates; + + /** + * Get the trend property: The number of days trend for a reservation. + * + * @return the trend value. + */ + public String trend() { + return this.trend; + } + + /** + * Get the aggregates property: The array of aggregates of a reservation's utilization. + * + * @return the aggregates value. + */ + public List aggregates() { + return this.aggregates; + } + + /** + * Set the aggregates property: The array of aggregates of a reservation's utilization. + * + * @param aggregates the aggregates value to set. + * @return the 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..b6d1d755b99dd --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ReservedResourceType.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.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 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..ec671e6dddec6 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ResourceName.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.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; + + /** + * 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..a34a4b4daeefe --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ResourceProviders.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.http.rest.Response; +import com.azure.core.util.Context; +import java.util.List; + +/** 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. + */ + List getCatalog(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 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 along with + * {@link Response}. + */ + Response> getCatalogWithResponse( + String subscriptionId, + String reservedResourceType, + String location, + String publisherId, + String offerId, + String planId, + 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); + + /** + * 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); +} 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..269c625bea673 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ResourceType.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; + +/** 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 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/ScopeProperties.java b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ScopeProperties.java new file mode 100644 index 0000000000000..63cc486143d39 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/ScopeProperties.java @@ -0,0 +1,72 @@ +// 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 ScopeProperties model. */ +@Fluent +public final class ScopeProperties { + /* + * The scope property. + */ + @JsonProperty(value = "scope") + private String scope; + + /* + * The valid property. + */ + @JsonProperty(value = "valid") + private Boolean valid; + + /** + * 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..4063f3b60b0ec --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SkuCapability.java @@ -0,0 +1,72 @@ +// 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 SkuCapability model. */ +@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; + + /** + * 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..1fdaa1691036a --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SkuName.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The SkuName model. */ +@Fluent +public final class SkuName { + /* + * The name property. + */ + @JsonProperty(value = "name") + private String name; + + /** + * 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..3b2f60f5fb9fa --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SkuProperty.java @@ -0,0 +1,72 @@ +// 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 SkuProperty model. */ +@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; + + /** + * 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..27fe1477a220e --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SkuRestriction.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The SkuRestriction model. */ +@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; + + /** + * 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..4ec056f758be7 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SplitRequest.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.SplitProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The SplitRequest model. */ +@Fluent +public final class SplitRequest { + /* + * The properties property. + */ + @JsonProperty(value = "properties") + private SplitProperties innerProperties; + + /** + * Get the innerProperties property: The properties property. + * + * @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..fd2d720d46493 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SubRequest.java @@ -0,0 +1,164 @@ +// 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; + + /** + * 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..a37da8cd23458 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/main/java/com/azure/resourcemanager/reservations/models/SubscriptionScopeProperties.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; +import java.util.List; + +/** The SubscriptionScopeProperties model. */ +@Fluent +public final class SubscriptionScopeProperties { + /* + * The scopes property. + */ + @JsonProperty(value = "scopes") + private List scopes; + + /** + * 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..705c9bcb679bf --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/CalculateExchangePostSamples.java @@ -0,0 +1,64 @@ +// 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.core.util.Context; +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.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.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-03-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)))) + .withReservationsToExchange( + Arrays + .asList( + new ReservationToReturn() + .withReservationId( + "/providers/microsoft.capacity/reservationOrders/1f14354c-dc12-4c8d-8090-6f295a3a34aa/reservations/c8c926bd-fc5d-4e29-9d43-b68340ac23a6") + .withQuantity(1)))), + 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..7bedd9a8eb831 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ExchangePostSamples.java @@ -0,0 +1,30 @@ +// 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.core.util.Context; +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-03-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")), + 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..b75d28f3a5583 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/OperationListSamples.java @@ -0,0 +1,22 @@ +// 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.core.util.Context; + +/** Samples for Operation List. */ +public final class OperationListSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-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(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..55a7b326a1762 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaGetSamples.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.core.util.Context; + +/** 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", + 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..3c173726b8f8a --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaListSamples.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; + +import com.azure.core.util.Context; + +/** 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", 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", 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..7dafd5e9a524e --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaRequestStatusGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** 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", + 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", + 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", + 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..f7a10d24b79b6 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaRequestStatusListSamples.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; + +import com.azure.core.util.Context; + +/** 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, 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..5fafbcd4398f7 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/QuotaUpdateSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.reservations.generated; + +import com.azure.core.util.Context; +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", + 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/ReservationAvailableScopesSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationAvailableScopesSamples.java new file mode 100644 index 0000000000000..8c3c04cb10ec0 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationAvailableScopesSamples.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.generated; + +import com.azure.core.util.Context; +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-03-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"))), + 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..885a274c5ae02 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationGetSamples.java @@ -0,0 +1,28 @@ +// 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.core.util.Context; + +/** Samples for Reservation Get. */ +public final class ReservationGetSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-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( + "6ef59113-3482-40da-8d79-787f823e34bc", + "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", + "renewProperties", + 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..00f7cd6ecfad1 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationListAllSamples.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.core.util.Context; + +/** Samples for Reservation ListAll. */ +public final class ReservationListAllSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservations.json + */ + /** + * Sample code: Catalog. + * + * @param manager Entry point to ReservationsManager. + */ + public static void catalog(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager + .reservations() + .listAll( + "(properties/archived eq false)", + "properties/displayName asc", + "true", + 50.0F, + null, + 1.0F, + 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..e624651e1f9d7 --- /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; + +import com.azure.core.util.Context; + +/** Samples for Reservation ListRevisions. */ +public final class ReservationListRevisionsSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-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( + "6ef59113-3482-40da-8d79-787f823e34bc", "276e7ae4-84d0-4da6-ab4b-d6b94f3557da", 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..d8d7ad7f78a75 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationListSamples.java @@ -0,0 +1,22 @@ +// 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.core.util.Context; + +/** Samples for Reservation List. */ +public final class ReservationListSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-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", 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..fcc579bacb4bc --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationMergeSamples.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.generated; + +import com.azure.core.util.Context; +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-03-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")), + 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..1c48b410e86f3 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderCalculateSamples.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.generated; + +import com.azure.core.util.Context; +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-03-01/examples/CalculateReservationOrder.json + */ + /** + * Sample code: Purchase. + * + * @param manager Entry point to ReservationsManager. + */ + public static void purchase(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)), + 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..7635ce6a69ff9 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderChangeDirectorySamples.java @@ -0,0 +1,28 @@ +// 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.core.util.Context; +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-03-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"), + 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..edbb90a32ecc2 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderGetSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ReservationOrder Get. */ +public final class ReservationOrderGetSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-01/examples/GetReservationOrderDetails.json + */ + /** + * Sample code: GetReservation. + * + * @param manager Entry point to ReservationsManager. + */ + public static void getReservation(com.azure.resourcemanager.reservations.ReservationsManager manager) { + manager.reservationOrders().getWithResponse("a075419f-44cc-497f-b68a-14ee811d48b9", null, Context.NONE); + } + + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-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", 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..d87065d79aef5 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderListSamples.java @@ -0,0 +1,22 @@ +// 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.core.util.Context; + +/** Samples for ReservationOrder List. */ +public final class ReservationOrderListSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-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(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..a195d32af5a2c --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationOrderPurchaseSamples.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.generated; + +import com.azure.core.util.Context; +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-03-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)), + 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..abdd5916aa6fc --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationSplitSamples.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.core.util.Context; +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-03-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"), + 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..8c3c7f752c42b --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ReservationUpdateSamples.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.core.util.Context; +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-03-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), + 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..dba38e71bb291 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ResourceProviderGetAppliedReservationListSamples.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.generated; + +import com.azure.core.util.Context; + +/** Samples for ResourceProvider GetAppliedReservationList. */ +public final class ResourceProviderGetAppliedReservationListSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-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", Context.NONE); + } +} diff --git a/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ResourceProviderGetCatalogSamples.java b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ResourceProviderGetCatalogSamples.java new file mode 100644 index 0000000000000..020482923f618 --- /dev/null +++ b/sdk/reservations/azure-resourcemanager-reservations/src/samples/java/com/azure/resourcemanager/reservations/generated/ResourceProviderGetCatalogSamples.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; + +import com.azure.core.util.Context; + +/** Samples for ResourceProvider GetCatalog. */ +public final class ResourceProviderGetCatalogSamples { + /* + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2022-03-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() + .getCatalogWithResponse( + "23bc208b-083f-4901-ae85-4f98c0c3b4b6", "VirtualMachines", "eastus", null, null, null, 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 + +