From 077d6f55c1efa17f513831dd13f41f8a421582f5 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 19 Aug 2024 08:08:19 +0000 Subject: [PATCH] CodeGen from PR 3486 in test-repo-billy/azure-rest-api-specs Merge 49ce2bba0df1a6ccf9a197f59b180e5832eb339f into 2ad400fcd7d7055b38957f542ffbe1a72290023e --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 8 + .../README.md | 104 ++ .../SAMPLE.md | 531 ++++++++ .../pom.xml | 67 + .../ComputescheduleManager.java | 291 ++++ .../MicrosoftComputeScheduleForTesting.java | 62 + .../fluent/OperationsClient.java | 40 + .../fluent/ScheduledActionsClient.java | 260 ++++ .../models/CancelOperationsResponseInner.java | 108 ++ ...llocateResourceOperationResponseInner.java | 204 +++ .../GetOperationStatusResponseInner.java | 108 ++ ...bernateResourceOperationResponseInner.java | 204 +++ .../fluent/models/OperationInner.java | 172 +++ .../StartResourceOperationResponseInner.java | 204 +++ .../fluent/models/package-info.java | 9 + .../computeschedule/fluent/package-info.java | 9 + .../CancelOperationsResponseImpl.java | 40 + ...allocateResourceOperationResponseImpl.java | 52 + .../GetOperationStatusResponseImpl.java | 40 + ...ibernateResourceOperationResponseImpl.java | 52 + ...osoftComputeScheduleForTestingBuilder.java | 138 ++ ...icrosoftComputeScheduleForTestingImpl.java | 304 +++++ .../implementation/OperationImpl.java | 51 + .../implementation/OperationsClientImpl.java | 235 ++++ .../implementation/OperationsImpl.java | 45 + .../implementation/ResourceManagerUtils.java | 195 +++ .../ScheduledActionsClientImpl.java | 1173 +++++++++++++++++ .../implementation/ScheduledActionsImpl.java | 236 ++++ .../StartResourceOperationResponseImpl.java | 52 + .../implementation/package-info.java | 9 + .../computeschedule/models/ActionType.java | 46 + .../models/CancelOperationsRequest.java | 137 ++ .../models/CancelOperationsResponse.java | 27 + .../computeschedule/models/DeadlineType.java | 56 + .../DeallocateResourceOperationResponse.java | 49 + .../models/ExecuteDeallocateRequest.java | 172 +++ .../models/ExecuteHibernateRequest.java | 172 +++ .../models/ExecuteStartRequest.java | 171 +++ .../models/ExecutionParameters.java | 126 ++ .../models/GetOperationStatusRequest.java | 137 ++ .../models/GetOperationStatusResponse.java | 27 + .../HibernateResourceOperationResponse.java | 49 + .../computeschedule/models/Operation.java | 58 + .../models/OperationDisplay.java | 136 ++ .../models/OperationListResult.java | 104 ++ .../models/OperationState.java | 86 ++ .../computeschedule/models/Operations.java | 35 + .../models/OptimizationPreference.java | 56 + .../computeschedule/models/Origin.java | 57 + .../models/ResourceOperation.java | 180 +++ .../models/ResourceOperationDetails.java | 425 ++++++ .../models/ResourceOperationError.java | 135 ++ .../models/ResourceOperationType.java | 61 + .../computeschedule/models/Resources.java | 103 ++ .../computeschedule/models/RetryPolicy.java | 121 ++ .../computeschedule/models/Schedule.java | 170 +++ .../models/ScheduledActions.java | 228 ++++ .../StartResourceOperationResponse.java | 49 + .../models/SubmitDeallocateRequest.java | 207 +++ .../models/SubmitHibernateRequest.java | 207 +++ .../models/SubmitStartRequest.java | 205 +++ .../computeschedule/models/package-info.java | 9 + .../computeschedule/package-info.java | 9 + .../src/main/java/module-info.java | 13 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + .../generated/OperationsListSamples.java | 40 + ...irtualMachinesCancelOperationsSamples.java | 51 + ...rtualMachinesExecuteDeallocateSamples.java | 59 + ...irtualMachinesExecuteHibernateSamples.java | 59 + ...onsVirtualMachinesExecuteStartSamples.java | 59 + ...tualMachinesGetOperationStatusSamples.java | 51 + ...irtualMachinesSubmitDeallocateSamples.java | 68 + ...VirtualMachinesSubmitHibernateSamples.java | 68 + ...ionsVirtualMachinesSubmitStartSamples.java | 68 + sdk/computeschedule/ci.yml | 46 + sdk/computeschedule/pom.xml | 15 + 79 files changed, 9414 insertions(+) create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/CHANGELOG.md create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/README.md create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/SAMPLE.md create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/pom.xml create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/ComputescheduleManager.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/MicrosoftComputeScheduleForTesting.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/OperationsClient.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/ScheduledActionsClient.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/CancelOperationsResponseInner.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/DeallocateResourceOperationResponseInner.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/GetOperationStatusResponseInner.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/HibernateResourceOperationResponseInner.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/OperationInner.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/StartResourceOperationResponseInner.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/package-info.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/package-info.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/CancelOperationsResponseImpl.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/DeallocateResourceOperationResponseImpl.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/GetOperationStatusResponseImpl.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/HibernateResourceOperationResponseImpl.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/MicrosoftComputeScheduleForTestingBuilder.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/MicrosoftComputeScheduleForTestingImpl.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/OperationImpl.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/OperationsClientImpl.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/OperationsImpl.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ResourceManagerUtils.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ScheduledActionsClientImpl.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ScheduledActionsImpl.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/StartResourceOperationResponseImpl.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/package-info.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ActionType.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/CancelOperationsRequest.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/CancelOperationsResponse.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/DeadlineType.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/DeallocateResourceOperationResponse.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ExecuteDeallocateRequest.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ExecuteHibernateRequest.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ExecuteStartRequest.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ExecutionParameters.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/GetOperationStatusRequest.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/GetOperationStatusResponse.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/HibernateResourceOperationResponse.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/Operation.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/OperationDisplay.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/OperationListResult.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/OperationState.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/Operations.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/OptimizationPreference.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/Origin.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ResourceOperation.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ResourceOperationDetails.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ResourceOperationError.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ResourceOperationType.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/Resources.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/RetryPolicy.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/Schedule.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ScheduledActions.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/StartResourceOperationResponse.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/SubmitDeallocateRequest.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/SubmitHibernateRequest.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/SubmitStartRequest.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/package-info.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/package-info.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/module-info.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-computeschedule/proxy-config.json create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-computeschedule/reflect-config.json create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/OperationsListSamples.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesCancelOperationsSamples.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesExecuteDeallocateSamples.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesExecuteHibernateSamples.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesExecuteStartSamples.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesGetOperationStatusSamples.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesSubmitDeallocateSamples.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesSubmitHibernateSamples.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesSubmitStartSamples.java create mode 100644 sdk/computeschedule/ci.yml create mode 100644 sdk/computeschedule/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 3f9c30a2daec5..f1a4909d0fcbe 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -468,6 +468,7 @@ com.azure.resourcemanager:azure-resourcemanager-mongocluster;1.0.0-beta.1;1.0.0- com.azure.resourcemanager:azure-resourcemanager-computefleet;1.0.0-beta.2;1.0.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-servicefabricmanagedclusters;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-healthdataaiservices;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-computeschedule;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;1.1.0-beta.1 io.clientcore:clientcore-parent;1.0.0-beta.1;1.0.0-beta.1 diff --git a/pom.xml b/pom.xml index 24c4975f99521..98ea192b8c5ec 100644 --- a/pom.xml +++ b/pom.xml @@ -45,6 +45,7 @@ sdk/commerce sdk/communication sdk/computefleet + sdk/computeschedule sdk/confidentialledger sdk/confluent sdk/connectedvmware diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/CHANGELOG.md b/sdk/computeschedule/azure-resourcemanager-computeschedule/CHANGELOG.md new file mode 100644 index 0000000000000..56b0e805ec051 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2024-08-19) + +- Azure Resource Manager computeschedule client library for Java. This package contains Microsoft Azure SDK for computeschedule Management SDK. Microsoft.ComputeSchedule Resource Provider management API. Package tag package-2024-06-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-computeschedule Java SDK. diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/README.md b/sdk/computeschedule/azure-resourcemanager-computeschedule/README.md new file mode 100644 index 0000000000000..aee7c421d5d51 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/README.md @@ -0,0 +1,104 @@ +# Azure Resource Manager computeschedule client library for Java + +Azure Resource Manager computeschedule client library for Java. + +This package contains Microsoft Azure SDK for computeschedule Management SDK. Microsoft.ComputeSchedule Resource Provider management API. Package tag package-2024-06-01-preview. 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-computeschedule;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-computeschedule + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. + +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +ComputescheduleManager manager = ComputescheduleManager + .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/computeschedule/azure-resourcemanager-computeschedule/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fcomputeschedule%2Fazure-resourcemanager-computeschedule%2FREADME.png) diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/SAMPLE.md b/sdk/computeschedule/azure-resourcemanager-computeschedule/SAMPLE.md new file mode 100644 index 0000000000000..5f63b17a50bae --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/SAMPLE.md @@ -0,0 +1,531 @@ +# Code snippets and samples + + +## Operations + +- [List](#operations_list) + +## ScheduledActions + +- [VirtualMachinesCancelOperations](#scheduledactions_virtualmachinescanceloperations) +- [VirtualMachinesExecuteDeallocate](#scheduledactions_virtualmachinesexecutedeallocate) +- [VirtualMachinesExecuteHibernate](#scheduledactions_virtualmachinesexecutehibernate) +- [VirtualMachinesExecuteStart](#scheduledactions_virtualmachinesexecutestart) +- [VirtualMachinesGetOperationStatus](#scheduledactions_virtualmachinesgetoperationstatus) +- [VirtualMachinesSubmitDeallocate](#scheduledactions_virtualmachinessubmitdeallocate) +- [VirtualMachinesSubmitHibernate](#scheduledactions_virtualmachinessubmithibernate) +- [VirtualMachinesSubmitStart](#scheduledactions_virtualmachinessubmitstart) +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * Operations_List_MinimumSet_Gen.json + */ + /** + * Sample code: Operations_ListMax - generated by [MinimumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void operationsListMaxGeneratedByMinimumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_ListMax - generated by [MaximumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void operationsListMaxGeneratedByMaximumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### ScheduledActions_VirtualMachinesCancelOperations + +```java +import com.azure.resourcemanager.computeschedule.models.CancelOperationsRequest; +import java.util.Arrays; + +/** + * Samples for ScheduledActions VirtualMachinesCancelOperations. + */ +public final class ScheduledActionsVirtualMachinesCancelOperationsSamples { + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesCancelOperations_MaximumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesCancelOperations - generated by [MaximumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesCancelOperationsGeneratedByMaximumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesCancelOperationsWithResponse("juzzyocyywfxwakqmgahb", + new CancelOperationsRequest().withOperationIds(Arrays.asList("23480d2f-1dca-4610-afb4-dd25eec1f34r")) + .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eec1f3c1"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesCancelOperations_MinimumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesCancelOperations - generated by [MinimumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesCancelOperationsGeneratedByMinimumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesCancelOperationsWithResponse("lzrfledwkzrp", + new CancelOperationsRequest().withOperationIds(Arrays.asList("01080d2f-1dca-4610-afb4-dd25eec1f3df")) + .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eec1f3c1"), + com.azure.core.util.Context.NONE); + } +} +``` + +### ScheduledActions_VirtualMachinesExecuteDeallocate + +```java +import com.azure.resourcemanager.computeschedule.models.ExecuteDeallocateRequest; +import com.azure.resourcemanager.computeschedule.models.ExecutionParameters; +import com.azure.resourcemanager.computeschedule.models.OptimizationPreference; +import com.azure.resourcemanager.computeschedule.models.Resources; +import com.azure.resourcemanager.computeschedule.models.RetryPolicy; +import java.util.Arrays; + +/** + * Samples for ScheduledActions VirtualMachinesExecuteDeallocate. + */ +public final class ScheduledActionsVirtualMachinesExecuteDeallocateSamples { + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesExecuteDeallocate_MaximumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesExecuteDeallocate - generated by [MaximumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesExecuteDeallocateGeneratedByMaximumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesExecuteDeallocateWithResponse("dspazcfydfdhxer", new ExecuteDeallocateRequest() + .withExecutionParameters( + new ExecutionParameters().withOptimizationPreference(OptimizationPreference.COST) + .withRetryPolicy(new RetryPolicy().withRetryCount(30).withRetryWindowInMinutes(27))) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2"))) + .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eddf1f3c1"), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesExecuteDeallocate_MinimumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesExecuteDeallocate - generated by [MinimumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesExecuteDeallocateGeneratedByMinimumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesExecuteDeallocateWithResponse("zanmxbtvfqzqqtywqtnslqxfk", new ExecuteDeallocateRequest() + .withExecutionParameters(new ExecutionParameters()) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2"))) + .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eec1f3c1"), com.azure.core.util.Context.NONE); + } +} +``` + +### ScheduledActions_VirtualMachinesExecuteHibernate + +```java +import com.azure.resourcemanager.computeschedule.models.ExecuteHibernateRequest; +import com.azure.resourcemanager.computeschedule.models.ExecutionParameters; +import com.azure.resourcemanager.computeschedule.models.OptimizationPreference; +import com.azure.resourcemanager.computeschedule.models.Resources; +import com.azure.resourcemanager.computeschedule.models.RetryPolicy; +import java.util.Arrays; + +/** + * Samples for ScheduledActions VirtualMachinesExecuteHibernate. + */ +public final class ScheduledActionsVirtualMachinesExecuteHibernateSamples { + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesExecuteHibernate_MinimumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesExecuteHibernate - generated by [MinimumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesExecuteHibernateGeneratedByMinimumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesExecuteHibernateWithResponse("oowpasegipasucmq", new ExecuteHibernateRequest() + .withExecutionParameters(new ExecutionParameters()) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"))) + .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eec1f3c1"), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesExecuteHibernate_MaximumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesExecuteHibernate - generated by [MaximumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesExecuteHibernateGeneratedByMaximumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesExecuteHibernateWithResponse("az", new ExecuteHibernateRequest() + .withExecutionParameters( + new ExecutionParameters().withOptimizationPreference(OptimizationPreference.COST) + .withRetryPolicy(new RetryPolicy().withRetryCount(30).withRetryWindowInMinutes(27))) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"))) + .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eec1f3c1"), com.azure.core.util.Context.NONE); + } +} +``` + +### ScheduledActions_VirtualMachinesExecuteStart + +```java +import com.azure.resourcemanager.computeschedule.models.ExecuteStartRequest; +import com.azure.resourcemanager.computeschedule.models.ExecutionParameters; +import com.azure.resourcemanager.computeschedule.models.OptimizationPreference; +import com.azure.resourcemanager.computeschedule.models.Resources; +import com.azure.resourcemanager.computeschedule.models.RetryPolicy; +import java.util.Arrays; + +/** + * Samples for ScheduledActions VirtualMachinesExecuteStart. + */ +public final class ScheduledActionsVirtualMachinesExecuteStartSamples { + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesExecuteStart_MaximumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesExecuteStart - generated by [MaximumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesExecuteStartGeneratedByMaximumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesExecuteStartWithResponse("cwkjesffxrcxaxbnvqumkjbbymwlpe", new ExecuteStartRequest() + .withExecutionParameters( + new ExecutionParameters().withOptimizationPreference(OptimizationPreference.COST) + .withRetryPolicy(new RetryPolicy().withRetryCount(30).withRetryWindowInMinutes(27))) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4"))) + .withCorrelationid("23230d2f-1dca-4610-afb4-dd25eec1f34"), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesExecuteStart_MinimumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesExecuteStart - generated by [MinimumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesExecuteStartGeneratedByMinimumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesExecuteStartWithResponse("puguskuewwqfrdkmwrnzb", new ExecuteStartRequest() + .withExecutionParameters(new ExecutionParameters()) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4"))) + .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eec1f3c1"), com.azure.core.util.Context.NONE); + } +} +``` + +### ScheduledActions_VirtualMachinesGetOperationStatus + +```java +import com.azure.resourcemanager.computeschedule.models.GetOperationStatusRequest; +import java.util.Arrays; + +/** + * Samples for ScheduledActions VirtualMachinesGetOperationStatus. + */ +public final class ScheduledActionsVirtualMachinesGetOperationStatusSamples { + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesGetOperationStatus_MinimumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesGetOperationStatus - generated by [MinimumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesGetOperationStatusGeneratedByMinimumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesGetOperationStatusWithResponse("csay", + new GetOperationStatusRequest().withOperationIds(Arrays.asList("01080d2f-1dca-4610-afb4-dd25eec1f3df")) + .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eec1f3c1"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesGetOperationStatus_MaximumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesGetOperationStatus - generated by [MaximumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesGetOperationStatusGeneratedByMaximumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesGetOperationStatusWithResponse("lfmx", + new GetOperationStatusRequest().withOperationIds(Arrays.asList("23480d2f-1dca-4610-afb4-dd25eec1f34")) + .withCorrelationid("23519o2f-1dca-4610-afb4-dd25eec1f34"), + com.azure.core.util.Context.NONE); + } +} +``` + +### ScheduledActions_VirtualMachinesSubmitDeallocate + +```java +import com.azure.resourcemanager.computeschedule.models.DeadlineType; +import com.azure.resourcemanager.computeschedule.models.ExecutionParameters; +import com.azure.resourcemanager.computeschedule.models.OptimizationPreference; +import com.azure.resourcemanager.computeschedule.models.Resources; +import com.azure.resourcemanager.computeschedule.models.RetryPolicy; +import com.azure.resourcemanager.computeschedule.models.Schedule; +import com.azure.resourcemanager.computeschedule.models.SubmitDeallocateRequest; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for ScheduledActions VirtualMachinesSubmitDeallocate. + */ +public final class ScheduledActionsVirtualMachinesSubmitDeallocateSamples { + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesSubmitDeallocate_MaximumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesSubmitDeallocate - generated by [MaximumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesSubmitDeallocateGeneratedByMaximumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesSubmitDeallocateWithResponse("nynqafujbcjyrtqve", new SubmitDeallocateRequest() + .withSchedule(new Schedule().withDeadLine(OffsetDateTime.parse("2024-07-12T18:06:53.361Z")) + .withTimeZone("zlcujrtgxtgyik") + .withDeadlineType(DeadlineType.UNKNOWN)) + .withExecutionParameters( + new ExecutionParameters().withOptimizationPreference(OptimizationPreference.COST) + .withRetryPolicy(new RetryPolicy().withRetryCount(30).withRetryWindowInMinutes(27))) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2"))) + .withCorrelationid("23519o2f-1dca-4610-afb4-dd25eec1f34"), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesSubmitDeallocate_MinimumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesSubmitDeallocate - generated by [MinimumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesSubmitDeallocateGeneratedByMinimumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesSubmitDeallocateWithResponse("gfuns", new SubmitDeallocateRequest() + .withSchedule(new Schedule().withDeadLine(OffsetDateTime.parse("2024-07-12T18:06:53.361Z")) + .withTimeZone("zlcujrtgxtgyik") + .withDeadlineType(DeadlineType.UNKNOWN)) + .withExecutionParameters(new ExecutionParameters()) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2"))) + .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eec1f3c1"), com.azure.core.util.Context.NONE); + } +} +``` + +### ScheduledActions_VirtualMachinesSubmitHibernate + +```java +import com.azure.resourcemanager.computeschedule.models.DeadlineType; +import com.azure.resourcemanager.computeschedule.models.ExecutionParameters; +import com.azure.resourcemanager.computeschedule.models.OptimizationPreference; +import com.azure.resourcemanager.computeschedule.models.Resources; +import com.azure.resourcemanager.computeschedule.models.RetryPolicy; +import com.azure.resourcemanager.computeschedule.models.Schedule; +import com.azure.resourcemanager.computeschedule.models.SubmitHibernateRequest; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for ScheduledActions VirtualMachinesSubmitHibernate. + */ +public final class ScheduledActionsVirtualMachinesSubmitHibernateSamples { + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesSubmitHibernate_MaximumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesSubmitHibernate - generated by [MaximumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesSubmitHibernateGeneratedByMaximumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesSubmitHibernateWithResponse("jrulwh", new SubmitHibernateRequest() + .withSchedule(new Schedule().withDeadLine(OffsetDateTime.parse("2024-07-12T18:06:53.361Z")) + .withTimeZone("zlcujrtgxtgyik") + .withDeadlineType(DeadlineType.UNKNOWN)) + .withExecutionParameters( + new ExecutionParameters().withOptimizationPreference(OptimizationPreference.COST) + .withRetryPolicy(new RetryPolicy().withRetryCount(30).withRetryWindowInMinutes(27))) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"))) + .withCorrelationid("23519o2f-1dca-4610-afb4-dd25eec1f34"), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesSubmitHibernate_MinimumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesSubmitHibernate - generated by [MinimumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesSubmitHibernateGeneratedByMinimumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesSubmitHibernateWithResponse("pgedjeucp", new SubmitHibernateRequest() + .withSchedule(new Schedule().withDeadLine(OffsetDateTime.parse("2024-07-12T18:06:53.361Z")) + .withTimeZone("zlcujrtgxtgyik") + .withDeadlineType(DeadlineType.UNKNOWN)) + .withExecutionParameters(new ExecutionParameters()) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"))) + .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eec1f3c1"), com.azure.core.util.Context.NONE); + } +} +``` + +### ScheduledActions_VirtualMachinesSubmitStart + +```java +import com.azure.resourcemanager.computeschedule.models.DeadlineType; +import com.azure.resourcemanager.computeschedule.models.ExecutionParameters; +import com.azure.resourcemanager.computeschedule.models.OptimizationPreference; +import com.azure.resourcemanager.computeschedule.models.Resources; +import com.azure.resourcemanager.computeschedule.models.RetryPolicy; +import com.azure.resourcemanager.computeschedule.models.Schedule; +import com.azure.resourcemanager.computeschedule.models.SubmitStartRequest; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for ScheduledActions VirtualMachinesSubmitStart. + */ +public final class ScheduledActionsVirtualMachinesSubmitStartSamples { + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesSubmitStart_MinimumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesSubmitStart - generated by [MinimumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesSubmitStartGeneratedByMinimumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesSubmitStartWithResponse("vkrnfmvxrtbzgeyqmhtney", new SubmitStartRequest() + .withSchedule(new Schedule().withDeadLine(OffsetDateTime.parse("2024-07-12T18:06:53.361Z")) + .withTimeZone("zlcujrtgxtgyik") + .withDeadlineType(DeadlineType.UNKNOWN)) + .withExecutionParameters(new ExecutionParameters()) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4"))) + .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eec1f3c1"), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesSubmitStart_MaximumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesSubmitStart - generated by [MaximumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesSubmitStartGeneratedByMaximumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesSubmitStartWithResponse("pxbvjarpyzhastophdyu", new SubmitStartRequest() + .withSchedule(new Schedule().withDeadLine(OffsetDateTime.parse("2024-07-12T18:06:53.361Z")) + .withTimeZone("zlcujrtgxtgyik") + .withDeadlineType(DeadlineType.UNKNOWN)) + .withExecutionParameters( + new ExecutionParameters().withOptimizationPreference(OptimizationPreference.COST) + .withRetryPolicy(new RetryPolicy().withRetryCount(30).withRetryWindowInMinutes(27))) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4"))) + .withCorrelationid("23480d2f-1dca-4610-afb4-dd25eec1f34"), com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/pom.xml b/sdk/computeschedule/azure-resourcemanager-computeschedule/pom.xml new file mode 100644 index 0000000000000..bd51d820e983b --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/pom.xml @@ -0,0 +1,67 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-computeschedule + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for computeschedule Management + This package contains Microsoft Azure SDK for computeschedule Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Microsoft.ComputeSchedule Resource Provider management API. Package tag package-2024-06-01-preview. + 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 + 0 + 0 + true + + + + com.azure + azure-json + 1.2.0 + + + com.azure + azure-core + 1.51.0 + + + com.azure + azure-core-management + 1.15.2 + + + diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/ComputescheduleManager.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/ComputescheduleManager.java new file mode 100644 index 0000000000000..26abe45d9d02c --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/ComputescheduleManager.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.computeschedule; + +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.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpLogOptions; +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.computeschedule.fluent.MicrosoftComputeScheduleForTesting; +import com.azure.resourcemanager.computeschedule.implementation.MicrosoftComputeScheduleForTestingBuilder; +import com.azure.resourcemanager.computeschedule.implementation.OperationsImpl; +import com.azure.resourcemanager.computeschedule.implementation.ScheduledActionsImpl; +import com.azure.resourcemanager.computeschedule.models.Operations; +import com.azure.resourcemanager.computeschedule.models.ScheduledActions; +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 ComputescheduleManager. + * Microsoft.ComputeSchedule Resource Provider management API. + */ +public final class ComputescheduleManager { + private Operations operations; + + private ScheduledActions scheduledActions; + + private final MicrosoftComputeScheduleForTesting clientObject; + + private ComputescheduleManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new MicrosoftComputeScheduleForTestingBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of computeschedule service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the computeschedule service API instance. + */ + public static ComputescheduleManager 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 computeschedule service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the computeschedule service API instance. + */ + public static ComputescheduleManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ComputescheduleManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create ComputescheduleManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ComputescheduleManager.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 computeschedule service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the computeschedule service API instance. + */ + public ComputescheduleManager 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.computeschedule") + .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 ComputescheduleManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * 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 ScheduledActions. + * + * @return Resource collection API of ScheduledActions. + */ + public ScheduledActions scheduledActions() { + if (this.scheduledActions == null) { + this.scheduledActions = new ScheduledActionsImpl(clientObject.getScheduledActions(), this); + } + return scheduledActions; + } + + /** + * Gets wrapped service client MicrosoftComputeScheduleForTesting providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + * + * @return Wrapped service client MicrosoftComputeScheduleForTesting. + */ + public MicrosoftComputeScheduleForTesting serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/MicrosoftComputeScheduleForTesting.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/MicrosoftComputeScheduleForTesting.java new file mode 100644 index 0000000000000..18d29ebe43b29 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/MicrosoftComputeScheduleForTesting.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.computeschedule.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for MicrosoftComputeScheduleForTesting class. + */ +public interface MicrosoftComputeScheduleForTesting { + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * 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 OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the ScheduledActionsClient object to access its operations. + * + * @return the ScheduledActionsClient object. + */ + ScheduledActionsClient getScheduledActions(); +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/OperationsClient.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/OperationsClient.java new file mode 100644 index 0000000000000..89e1e59df1e2d --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/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.computeschedule.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.computeschedule.fluent.models.OperationInner; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public interface OperationsClient { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException 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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/ScheduledActionsClient.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/ScheduledActionsClient.java new file mode 100644 index 0000000000000..f7c9e3a8265f8 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/ScheduledActionsClient.java @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.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.computeschedule.fluent.models.CancelOperationsResponseInner; +import com.azure.resourcemanager.computeschedule.fluent.models.DeallocateResourceOperationResponseInner; +import com.azure.resourcemanager.computeschedule.fluent.models.GetOperationStatusResponseInner; +import com.azure.resourcemanager.computeschedule.fluent.models.HibernateResourceOperationResponseInner; +import com.azure.resourcemanager.computeschedule.fluent.models.StartResourceOperationResponseInner; +import com.azure.resourcemanager.computeschedule.models.CancelOperationsRequest; +import com.azure.resourcemanager.computeschedule.models.ExecuteDeallocateRequest; +import com.azure.resourcemanager.computeschedule.models.ExecuteHibernateRequest; +import com.azure.resourcemanager.computeschedule.models.ExecuteStartRequest; +import com.azure.resourcemanager.computeschedule.models.GetOperationStatusRequest; +import com.azure.resourcemanager.computeschedule.models.SubmitDeallocateRequest; +import com.azure.resourcemanager.computeschedule.models.SubmitHibernateRequest; +import com.azure.resourcemanager.computeschedule.models.SubmitStartRequest; + +/** + * An instance of this class provides access to all the operations defined in ScheduledActionsClient. + */ +public interface ScheduledActionsClient { + /** + * virtualMachinesCancelOperations: cancelOperations for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is the response from a cancel operations request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response virtualMachinesCancelOperationsWithResponse(String locationparameter, + CancelOperationsRequest requestBody, Context context); + + /** + * virtualMachinesCancelOperations: cancelOperations for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is the response from a cancel operations request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CancelOperationsResponseInner virtualMachinesCancelOperations(String locationparameter, + CancelOperationsRequest requestBody); + + /** + * virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a deallocate request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response virtualMachinesExecuteDeallocateWithResponse( + String locationparameter, ExecuteDeallocateRequest requestBody, Context context); + + /** + * virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a deallocate request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeallocateResourceOperationResponseInner virtualMachinesExecuteDeallocate(String locationparameter, + ExecuteDeallocateRequest requestBody); + + /** + * virtualMachinesExecuteHibernate: executeHibernate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a Hibernate request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response virtualMachinesExecuteHibernateWithResponse( + String locationparameter, ExecuteHibernateRequest requestBody, Context context); + + /** + * virtualMachinesExecuteHibernate: executeHibernate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a Hibernate request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HibernateResourceOperationResponseInner virtualMachinesExecuteHibernate(String locationparameter, + ExecuteHibernateRequest requestBody); + + /** + * virtualMachinesExecuteStart: executeStart for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a start request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response virtualMachinesExecuteStartWithResponse(String locationparameter, + ExecuteStartRequest requestBody, Context context); + + /** + * virtualMachinesExecuteStart: executeStart for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a start request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StartResourceOperationResponseInner virtualMachinesExecuteStart(String locationparameter, + ExecuteStartRequest requestBody); + + /** + * virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is the response from a get operations status request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response virtualMachinesGetOperationStatusWithResponse(String locationparameter, + GetOperationStatusRequest requestBody, Context context); + + /** + * virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is the response from a get operations status request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GetOperationStatusResponseInner virtualMachinesGetOperationStatus(String locationparameter, + GetOperationStatusRequest requestBody); + + /** + * virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a deallocate request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response virtualMachinesSubmitDeallocateWithResponse( + String locationparameter, SubmitDeallocateRequest requestBody, Context context); + + /** + * virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a deallocate request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DeallocateResourceOperationResponseInner virtualMachinesSubmitDeallocate(String locationparameter, + SubmitDeallocateRequest requestBody); + + /** + * virtualMachinesSubmitHibernate: submitHibernate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a Hibernate request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response virtualMachinesSubmitHibernateWithResponse( + String locationparameter, SubmitHibernateRequest requestBody, Context context); + + /** + * virtualMachinesSubmitHibernate: submitHibernate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a Hibernate request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HibernateResourceOperationResponseInner virtualMachinesSubmitHibernate(String locationparameter, + SubmitHibernateRequest requestBody); + + /** + * virtualMachinesSubmitStart: submitStart for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a start request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response virtualMachinesSubmitStartWithResponse(String locationparameter, + SubmitStartRequest requestBody, Context context); + + /** + * virtualMachinesSubmitStart: submitStart for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a start request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StartResourceOperationResponseInner virtualMachinesSubmitStart(String locationparameter, + SubmitStartRequest requestBody); +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/CancelOperationsResponseInner.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/CancelOperationsResponseInner.java new file mode 100644 index 0000000000000..d7d4b3f94bcd1 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/CancelOperationsResponseInner.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.computeschedule.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.computeschedule.models.ResourceOperation; +import java.io.IOException; +import java.util.List; + +/** + * This is the response from a cancel operations request. + */ +@Fluent +public final class CancelOperationsResponseInner implements JsonSerializable { + /* + * An array of resource operations that were successfully cancelled + */ + private List results; + + /** + * Creates an instance of CancelOperationsResponseInner class. + */ + public CancelOperationsResponseInner() { + } + + /** + * Get the results property: An array of resource operations that were successfully cancelled. + * + * @return the results value. + */ + public List results() { + return this.results; + } + + /** + * Set the results property: An array of resource operations that were successfully cancelled. + * + * @param results the results value to set. + * @return the CancelOperationsResponseInner object itself. + */ + public CancelOperationsResponseInner withResults(List results) { + this.results = results; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (results() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property results in model CancelOperationsResponseInner")); + } else { + results().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CancelOperationsResponseInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("results", this.results, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CancelOperationsResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CancelOperationsResponseInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CancelOperationsResponseInner. + */ + public static CancelOperationsResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CancelOperationsResponseInner deserializedCancelOperationsResponseInner + = new CancelOperationsResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("results".equals(fieldName)) { + List results = reader.readArray(reader1 -> ResourceOperation.fromJson(reader1)); + deserializedCancelOperationsResponseInner.results = results; + } else { + reader.skipChildren(); + } + } + + return deserializedCancelOperationsResponseInner; + }); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/DeallocateResourceOperationResponseInner.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/DeallocateResourceOperationResponseInner.java new file mode 100644 index 0000000000000..141fa9cce4267 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/DeallocateResourceOperationResponseInner.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.computeschedule.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.computeschedule.models.ResourceOperation; +import java.io.IOException; +import java.util.List; + +/** + * The response from a deallocate request. + */ +@Fluent +public final class DeallocateResourceOperationResponseInner + implements JsonSerializable { + /* + * The description of the operation response + */ + private String description; + + /* + * The type of resources used in the deallocate request eg virtual machines + */ + private String type; + + /* + * The location of the deallocate request eg westus + */ + private String location; + + /* + * The results from the deallocate request if no errors exist + */ + private List results; + + /** + * Creates an instance of DeallocateResourceOperationResponseInner class. + */ + public DeallocateResourceOperationResponseInner() { + } + + /** + * Get the description property: The description of the operation response. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the operation response. + * + * @param description the description value to set. + * @return the DeallocateResourceOperationResponseInner object itself. + */ + public DeallocateResourceOperationResponseInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the type property: The type of resources used in the deallocate request eg virtual machines. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The type of resources used in the deallocate request eg virtual machines. + * + * @param type the type value to set. + * @return the DeallocateResourceOperationResponseInner object itself. + */ + public DeallocateResourceOperationResponseInner withType(String type) { + this.type = type; + return this; + } + + /** + * Get the location property: The location of the deallocate request eg westus. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location of the deallocate request eg westus. + * + * @param location the location value to set. + * @return the DeallocateResourceOperationResponseInner object itself. + */ + public DeallocateResourceOperationResponseInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the results property: The results from the deallocate request if no errors exist. + * + * @return the results value. + */ + public List results() { + return this.results; + } + + /** + * Set the results property: The results from the deallocate request if no errors exist. + * + * @param results the results value to set. + * @return the DeallocateResourceOperationResponseInner object itself. + */ + public DeallocateResourceOperationResponseInner withResults(List results) { + this.results = results; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (description() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property description in model DeallocateResourceOperationResponseInner")); + } + if (type() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property type in model DeallocateResourceOperationResponseInner")); + } + if (location() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property location in model DeallocateResourceOperationResponseInner")); + } + if (results() != null) { + results().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DeallocateResourceOperationResponseInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("location", this.location); + jsonWriter.writeArrayField("results", this.results, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DeallocateResourceOperationResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DeallocateResourceOperationResponseInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DeallocateResourceOperationResponseInner. + */ + public static DeallocateResourceOperationResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DeallocateResourceOperationResponseInner deserializedDeallocateResourceOperationResponseInner + = new DeallocateResourceOperationResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedDeallocateResourceOperationResponseInner.description = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDeallocateResourceOperationResponseInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedDeallocateResourceOperationResponseInner.location = reader.getString(); + } else if ("results".equals(fieldName)) { + List results = reader.readArray(reader1 -> ResourceOperation.fromJson(reader1)); + deserializedDeallocateResourceOperationResponseInner.results = results; + } else { + reader.skipChildren(); + } + } + + return deserializedDeallocateResourceOperationResponseInner; + }); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/GetOperationStatusResponseInner.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/GetOperationStatusResponseInner.java new file mode 100644 index 0000000000000..58febebed4d94 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/GetOperationStatusResponseInner.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.computeschedule.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.computeschedule.models.ResourceOperation; +import java.io.IOException; +import java.util.List; + +/** + * This is the response from a get operations status request. + */ +@Fluent +public final class GetOperationStatusResponseInner implements JsonSerializable { + /* + * An array of resource operations based on their operation ids + */ + private List results; + + /** + * Creates an instance of GetOperationStatusResponseInner class. + */ + public GetOperationStatusResponseInner() { + } + + /** + * Get the results property: An array of resource operations based on their operation ids. + * + * @return the results value. + */ + public List results() { + return this.results; + } + + /** + * Set the results property: An array of resource operations based on their operation ids. + * + * @param results the results value to set. + * @return the GetOperationStatusResponseInner object itself. + */ + public GetOperationStatusResponseInner withResults(List results) { + this.results = results; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (results() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property results in model GetOperationStatusResponseInner")); + } else { + results().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GetOperationStatusResponseInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("results", this.results, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetOperationStatusResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetOperationStatusResponseInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GetOperationStatusResponseInner. + */ + public static GetOperationStatusResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GetOperationStatusResponseInner deserializedGetOperationStatusResponseInner + = new GetOperationStatusResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("results".equals(fieldName)) { + List results = reader.readArray(reader1 -> ResourceOperation.fromJson(reader1)); + deserializedGetOperationStatusResponseInner.results = results; + } else { + reader.skipChildren(); + } + } + + return deserializedGetOperationStatusResponseInner; + }); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/HibernateResourceOperationResponseInner.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/HibernateResourceOperationResponseInner.java new file mode 100644 index 0000000000000..f3820ba2a3c24 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/HibernateResourceOperationResponseInner.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.computeschedule.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.computeschedule.models.ResourceOperation; +import java.io.IOException; +import java.util.List; + +/** + * The response from a Hibernate request. + */ +@Fluent +public final class HibernateResourceOperationResponseInner + implements JsonSerializable { + /* + * The description of the operation response + */ + private String description; + + /* + * The type of resources used in the Hibernate request eg virtual machines + */ + private String type; + + /* + * The location of the Hibernate request eg westus + */ + private String location; + + /* + * The results from the Hibernate request if no errors exist + */ + private List results; + + /** + * Creates an instance of HibernateResourceOperationResponseInner class. + */ + public HibernateResourceOperationResponseInner() { + } + + /** + * Get the description property: The description of the operation response. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the operation response. + * + * @param description the description value to set. + * @return the HibernateResourceOperationResponseInner object itself. + */ + public HibernateResourceOperationResponseInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the type property: The type of resources used in the Hibernate request eg virtual machines. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The type of resources used in the Hibernate request eg virtual machines. + * + * @param type the type value to set. + * @return the HibernateResourceOperationResponseInner object itself. + */ + public HibernateResourceOperationResponseInner withType(String type) { + this.type = type; + return this; + } + + /** + * Get the location property: The location of the Hibernate request eg westus. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location of the Hibernate request eg westus. + * + * @param location the location value to set. + * @return the HibernateResourceOperationResponseInner object itself. + */ + public HibernateResourceOperationResponseInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the results property: The results from the Hibernate request if no errors exist. + * + * @return the results value. + */ + public List results() { + return this.results; + } + + /** + * Set the results property: The results from the Hibernate request if no errors exist. + * + * @param results the results value to set. + * @return the HibernateResourceOperationResponseInner object itself. + */ + public HibernateResourceOperationResponseInner withResults(List results) { + this.results = results; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (description() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property description in model HibernateResourceOperationResponseInner")); + } + if (type() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property type in model HibernateResourceOperationResponseInner")); + } + if (location() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property location in model HibernateResourceOperationResponseInner")); + } + if (results() != null) { + results().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HibernateResourceOperationResponseInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("location", this.location); + jsonWriter.writeArrayField("results", this.results, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HibernateResourceOperationResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HibernateResourceOperationResponseInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the HibernateResourceOperationResponseInner. + */ + public static HibernateResourceOperationResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HibernateResourceOperationResponseInner deserializedHibernateResourceOperationResponseInner + = new HibernateResourceOperationResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedHibernateResourceOperationResponseInner.description = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedHibernateResourceOperationResponseInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedHibernateResourceOperationResponseInner.location = reader.getString(); + } else if ("results".equals(fieldName)) { + List results = reader.readArray(reader1 -> ResourceOperation.fromJson(reader1)); + deserializedHibernateResourceOperationResponseInner.results = results; + } else { + reader.skipChildren(); + } + } + + return deserializedHibernateResourceOperationResponseInner; + }); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/OperationInner.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..6a58d063a2684 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/OperationInner.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.computeschedule.models.ActionType; +import com.azure.resourcemanager.computeschedule.models.OperationDisplay; +import com.azure.resourcemanager.computeschedule.models.Origin; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + public OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/StartResourceOperationResponseInner.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/StartResourceOperationResponseInner.java new file mode 100644 index 0000000000000..229584f8c511b --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/StartResourceOperationResponseInner.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.computeschedule.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.computeschedule.models.ResourceOperation; +import java.io.IOException; +import java.util.List; + +/** + * The response from a start request. + */ +@Fluent +public final class StartResourceOperationResponseInner + implements JsonSerializable { + /* + * The description of the operation response + */ + private String description; + + /* + * The type of resources used in the start request eg virtual machines + */ + private String type; + + /* + * The location of the start request eg westus + */ + private String location; + + /* + * The results from the start request if no errors exist + */ + private List results; + + /** + * Creates an instance of StartResourceOperationResponseInner class. + */ + public StartResourceOperationResponseInner() { + } + + /** + * Get the description property: The description of the operation response. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the operation response. + * + * @param description the description value to set. + * @return the StartResourceOperationResponseInner object itself. + */ + public StartResourceOperationResponseInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the type property: The type of resources used in the start request eg virtual machines. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The type of resources used in the start request eg virtual machines. + * + * @param type the type value to set. + * @return the StartResourceOperationResponseInner object itself. + */ + public StartResourceOperationResponseInner withType(String type) { + this.type = type; + return this; + } + + /** + * Get the location property: The location of the start request eg westus. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location of the start request eg westus. + * + * @param location the location value to set. + * @return the StartResourceOperationResponseInner object itself. + */ + public StartResourceOperationResponseInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the results property: The results from the start request if no errors exist. + * + * @return the results value. + */ + public List results() { + return this.results; + } + + /** + * Set the results property: The results from the start request if no errors exist. + * + * @param results the results value to set. + * @return the StartResourceOperationResponseInner object itself. + */ + public StartResourceOperationResponseInner withResults(List results) { + this.results = results; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (description() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property description in model StartResourceOperationResponseInner")); + } + if (type() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property type in model StartResourceOperationResponseInner")); + } + if (location() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property location in model StartResourceOperationResponseInner")); + } + if (results() != null) { + results().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(StartResourceOperationResponseInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("location", this.location); + jsonWriter.writeArrayField("results", this.results, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StartResourceOperationResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StartResourceOperationResponseInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the StartResourceOperationResponseInner. + */ + public static StartResourceOperationResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StartResourceOperationResponseInner deserializedStartResourceOperationResponseInner + = new StartResourceOperationResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedStartResourceOperationResponseInner.description = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedStartResourceOperationResponseInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedStartResourceOperationResponseInner.location = reader.getString(); + } else if ("results".equals(fieldName)) { + List results = reader.readArray(reader1 -> ResourceOperation.fromJson(reader1)); + deserializedStartResourceOperationResponseInner.results = results; + } else { + reader.skipChildren(); + } + } + + return deserializedStartResourceOperationResponseInner; + }); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/package-info.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/package-info.java new file mode 100644 index 0000000000000..0215253425d50 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for MicrosoftComputeScheduleForTesting. + * Microsoft.ComputeSchedule Resource Provider management API. + */ +package com.azure.resourcemanager.computeschedule.fluent.models; diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/package-info.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/package-info.java new file mode 100644 index 0000000000000..4f86829e6e892 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for MicrosoftComputeScheduleForTesting. + * Microsoft.ComputeSchedule Resource Provider management API. + */ +package com.azure.resourcemanager.computeschedule.fluent; diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/CancelOperationsResponseImpl.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/CancelOperationsResponseImpl.java new file mode 100644 index 0000000000000..e17c8766deda2 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/CancelOperationsResponseImpl.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.computeschedule.implementation; + +import com.azure.resourcemanager.computeschedule.fluent.models.CancelOperationsResponseInner; +import com.azure.resourcemanager.computeschedule.models.CancelOperationsResponse; +import com.azure.resourcemanager.computeschedule.models.ResourceOperation; +import java.util.Collections; +import java.util.List; + +public final class CancelOperationsResponseImpl implements CancelOperationsResponse { + private CancelOperationsResponseInner innerObject; + + private final com.azure.resourcemanager.computeschedule.ComputescheduleManager serviceManager; + + CancelOperationsResponseImpl(CancelOperationsResponseInner innerObject, + com.azure.resourcemanager.computeschedule.ComputescheduleManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List results() { + List inner = this.innerModel().results(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public CancelOperationsResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.computeschedule.ComputescheduleManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/DeallocateResourceOperationResponseImpl.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/DeallocateResourceOperationResponseImpl.java new file mode 100644 index 0000000000000..e60efe6cafc5a --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/DeallocateResourceOperationResponseImpl.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.computeschedule.implementation; + +import com.azure.resourcemanager.computeschedule.fluent.models.DeallocateResourceOperationResponseInner; +import com.azure.resourcemanager.computeschedule.models.DeallocateResourceOperationResponse; +import com.azure.resourcemanager.computeschedule.models.ResourceOperation; +import java.util.Collections; +import java.util.List; + +public final class DeallocateResourceOperationResponseImpl implements DeallocateResourceOperationResponse { + private DeallocateResourceOperationResponseInner innerObject; + + private final com.azure.resourcemanager.computeschedule.ComputescheduleManager serviceManager; + + DeallocateResourceOperationResponseImpl(DeallocateResourceOperationResponseInner innerObject, + com.azure.resourcemanager.computeschedule.ComputescheduleManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String description() { + return this.innerModel().description(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public List results() { + List inner = this.innerModel().results(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public DeallocateResourceOperationResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.computeschedule.ComputescheduleManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/GetOperationStatusResponseImpl.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/GetOperationStatusResponseImpl.java new file mode 100644 index 0000000000000..435f7b8b77fe3 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/GetOperationStatusResponseImpl.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.computeschedule.implementation; + +import com.azure.resourcemanager.computeschedule.fluent.models.GetOperationStatusResponseInner; +import com.azure.resourcemanager.computeschedule.models.GetOperationStatusResponse; +import com.azure.resourcemanager.computeschedule.models.ResourceOperation; +import java.util.Collections; +import java.util.List; + +public final class GetOperationStatusResponseImpl implements GetOperationStatusResponse { + private GetOperationStatusResponseInner innerObject; + + private final com.azure.resourcemanager.computeschedule.ComputescheduleManager serviceManager; + + GetOperationStatusResponseImpl(GetOperationStatusResponseInner innerObject, + com.azure.resourcemanager.computeschedule.ComputescheduleManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List results() { + List inner = this.innerModel().results(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public GetOperationStatusResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.computeschedule.ComputescheduleManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/HibernateResourceOperationResponseImpl.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/HibernateResourceOperationResponseImpl.java new file mode 100644 index 0000000000000..b742dd2b3d0b9 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/HibernateResourceOperationResponseImpl.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.computeschedule.implementation; + +import com.azure.resourcemanager.computeschedule.fluent.models.HibernateResourceOperationResponseInner; +import com.azure.resourcemanager.computeschedule.models.HibernateResourceOperationResponse; +import com.azure.resourcemanager.computeschedule.models.ResourceOperation; +import java.util.Collections; +import java.util.List; + +public final class HibernateResourceOperationResponseImpl implements HibernateResourceOperationResponse { + private HibernateResourceOperationResponseInner innerObject; + + private final com.azure.resourcemanager.computeschedule.ComputescheduleManager serviceManager; + + HibernateResourceOperationResponseImpl(HibernateResourceOperationResponseInner innerObject, + com.azure.resourcemanager.computeschedule.ComputescheduleManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String description() { + return this.innerModel().description(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public List results() { + List inner = this.innerModel().results(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public HibernateResourceOperationResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.computeschedule.ComputescheduleManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/MicrosoftComputeScheduleForTestingBuilder.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/MicrosoftComputeScheduleForTestingBuilder.java new file mode 100644 index 0000000000000..5c348a6946c33 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/MicrosoftComputeScheduleForTestingBuilder.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.computeschedule.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 MicrosoftComputeScheduleForTestingImpl type. + */ +@ServiceClientBuilder(serviceClients = { MicrosoftComputeScheduleForTestingImpl.class }) +public final class MicrosoftComputeScheduleForTestingBuilder { + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the MicrosoftComputeScheduleForTestingBuilder. + */ + public MicrosoftComputeScheduleForTestingBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the MicrosoftComputeScheduleForTestingBuilder. + */ + public MicrosoftComputeScheduleForTestingBuilder 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 MicrosoftComputeScheduleForTestingBuilder. + */ + public MicrosoftComputeScheduleForTestingBuilder 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 MicrosoftComputeScheduleForTestingBuilder. + */ + public MicrosoftComputeScheduleForTestingBuilder 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 MicrosoftComputeScheduleForTestingBuilder. + */ + public MicrosoftComputeScheduleForTestingBuilder 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 MicrosoftComputeScheduleForTestingBuilder. + */ + public MicrosoftComputeScheduleForTestingBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of MicrosoftComputeScheduleForTestingImpl with the provided parameters. + * + * @return an instance of MicrosoftComputeScheduleForTestingImpl. + */ + public MicrosoftComputeScheduleForTestingImpl 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(); + MicrosoftComputeScheduleForTestingImpl client = new MicrosoftComputeScheduleForTestingImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + return client; + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/MicrosoftComputeScheduleForTestingImpl.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/MicrosoftComputeScheduleForTestingImpl.java new file mode 100644 index 0000000000000..8ea44d4e77cd6 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/MicrosoftComputeScheduleForTestingImpl.java @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +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.PollerFactory; +import com.azure.core.management.polling.PollResult; +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.computeschedule.fluent.MicrosoftComputeScheduleForTesting; +import com.azure.resourcemanager.computeschedule.fluent.OperationsClient; +import com.azure.resourcemanager.computeschedule.fluent.ScheduledActionsClient; +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 MicrosoftComputeScheduleForTestingImpl type. + */ +@ServiceClient(builder = MicrosoftComputeScheduleForTestingBuilder.class) +public final class MicrosoftComputeScheduleForTestingImpl implements MicrosoftComputeScheduleForTesting { + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * server parameter. + */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Api Version. + */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * 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 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 ScheduledActionsClient object to access its operations. + */ + private final ScheduledActionsClient scheduledActions; + + /** + * Gets the ScheduledActionsClient object to access its operations. + * + * @return the ScheduledActionsClient object. + */ + public ScheduledActionsClient getScheduledActions() { + return this.scheduledActions; + } + + /** + * Initializes an instance of MicrosoftComputeScheduleForTesting client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param endpoint server parameter. + */ + MicrosoftComputeScheduleForTestingImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String subscriptionId, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2024-06-01-preview"; + this.operations = new OperationsClientImpl(this); + this.scheduledActions = new ScheduledActionsClientImpl(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(HttpHeaderName.fromString(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(MicrosoftComputeScheduleForTestingImpl.class); +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/OperationImpl.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/OperationImpl.java new file mode 100644 index 0000000000000..4be2ae2fa2895 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/OperationImpl.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.computeschedule.implementation; + +import com.azure.resourcemanager.computeschedule.fluent.models.OperationInner; +import com.azure.resourcemanager.computeschedule.models.ActionType; +import com.azure.resourcemanager.computeschedule.models.Operation; +import com.azure.resourcemanager.computeschedule.models.OperationDisplay; +import com.azure.resourcemanager.computeschedule.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.computeschedule.ComputescheduleManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.computeschedule.ComputescheduleManager 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 Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.computeschedule.ComputescheduleManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/OperationsClientImpl.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..151cec8fc4587 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/OperationsClientImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.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.computeschedule.fluent.OperationsClient; +import com.azure.resourcemanager.computeschedule.fluent.models.OperationInner; +import com.azure.resourcemanager.computeschedule.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public final class OperationsClientImpl implements OperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final OperationsService service; + + /** + * The service client containing this operation class. + */ + private final MicrosoftComputeScheduleForTestingImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(MicrosoftComputeScheduleForTestingImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftComputeScheduleForTestingOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftComputeSche") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.ComputeSchedule/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); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException 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 REST API operations supported by an Azure Resource Provider 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 accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider 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 accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException 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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException 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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 REST API operations supported by an Azure Resource Provider 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 REST API operations supported by an Azure Resource Provider 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/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/OperationsImpl.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..29900c298d31b --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/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.computeschedule.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.computeschedule.fluent.OperationsClient; +import com.azure.resourcemanager.computeschedule.fluent.models.OperationInner; +import com.azure.resourcemanager.computeschedule.models.Operation; +import com.azure.resourcemanager.computeschedule.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.computeschedule.ComputescheduleManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.computeschedule.ComputescheduleManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.computeschedule.ComputescheduleManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ResourceManagerUtils.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ResourceManagerUtils.java new file mode 100644 index 0000000000000..af8c57b834a8c --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.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 ResourceManagerUtils { + private ResourceManagerUtils() { + } + + 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.isEmpty() && 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<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(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/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ScheduledActionsClientImpl.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ScheduledActionsClientImpl.java new file mode 100644 index 0000000000000..4b6223d21fa98 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ScheduledActionsClientImpl.java @@ -0,0 +1,1173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.computeschedule.fluent.ScheduledActionsClient; +import com.azure.resourcemanager.computeschedule.fluent.models.CancelOperationsResponseInner; +import com.azure.resourcemanager.computeschedule.fluent.models.DeallocateResourceOperationResponseInner; +import com.azure.resourcemanager.computeschedule.fluent.models.GetOperationStatusResponseInner; +import com.azure.resourcemanager.computeschedule.fluent.models.HibernateResourceOperationResponseInner; +import com.azure.resourcemanager.computeschedule.fluent.models.StartResourceOperationResponseInner; +import com.azure.resourcemanager.computeschedule.models.CancelOperationsRequest; +import com.azure.resourcemanager.computeschedule.models.ExecuteDeallocateRequest; +import com.azure.resourcemanager.computeschedule.models.ExecuteHibernateRequest; +import com.azure.resourcemanager.computeschedule.models.ExecuteStartRequest; +import com.azure.resourcemanager.computeschedule.models.GetOperationStatusRequest; +import com.azure.resourcemanager.computeschedule.models.SubmitDeallocateRequest; +import com.azure.resourcemanager.computeschedule.models.SubmitHibernateRequest; +import com.azure.resourcemanager.computeschedule.models.SubmitStartRequest; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ScheduledActionsClient. + */ +public final class ScheduledActionsClientImpl implements ScheduledActionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ScheduledActionsService service; + + /** + * The service client containing this operation class. + */ + private final MicrosoftComputeScheduleForTestingImpl client; + + /** + * Initializes an instance of ScheduledActionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ScheduledActionsClientImpl(MicrosoftComputeScheduleForTestingImpl client) { + this.service + = RestProxy.create(ScheduledActionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MicrosoftComputeScheduleForTestingScheduledActions to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MicrosoftComputeSche") + public interface ScheduledActionsService { + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesCancelOperations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> virtualMachinesCancelOperations( + @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("locationparameter") String locationparameter, + @BodyParam("application/json") CancelOperationsRequest requestBody, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteDeallocate") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> virtualMachinesExecuteDeallocate( + @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("locationparameter") String locationparameter, + @BodyParam("application/json") ExecuteDeallocateRequest requestBody, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteHibernate") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> virtualMachinesExecuteHibernate( + @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("locationparameter") String locationparameter, + @BodyParam("application/json") ExecuteHibernateRequest requestBody, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteStart") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> virtualMachinesExecuteStart( + @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("locationparameter") String locationparameter, + @BodyParam("application/json") ExecuteStartRequest requestBody, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesGetOperationStatus") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> virtualMachinesGetOperationStatus( + @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("locationparameter") String locationparameter, + @BodyParam("application/json") GetOperationStatusRequest requestBody, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitDeallocate") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> virtualMachinesSubmitDeallocate( + @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("locationparameter") String locationparameter, + @BodyParam("application/json") SubmitDeallocateRequest requestBody, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitHibernate") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> virtualMachinesSubmitHibernate( + @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("locationparameter") String locationparameter, + @BodyParam("application/json") SubmitHibernateRequest requestBody, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitStart") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> virtualMachinesSubmitStart( + @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("locationparameter") String locationparameter, + @BodyParam("application/json") SubmitStartRequest requestBody, @HeaderParam("Accept") String accept, + Context context); + } + + /** + * virtualMachinesCancelOperations: cancelOperations for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is the response from a cancel operations request along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> virtualMachinesCancelOperationsWithResponseAsync( + String locationparameter, CancelOperationsRequest requestBody) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationparameter == null) { + return Mono + .error(new IllegalArgumentException("Parameter locationparameter is required and cannot be null.")); + } + if (requestBody == null) { + return Mono.error(new IllegalArgumentException("Parameter requestBody is required and cannot be null.")); + } else { + requestBody.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.virtualMachinesCancelOperations(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), locationparameter, requestBody, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * virtualMachinesCancelOperations: cancelOperations for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is the response from a cancel operations request along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> virtualMachinesCancelOperationsWithResponseAsync( + String locationparameter, CancelOperationsRequest requestBody, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationparameter == null) { + return Mono + .error(new IllegalArgumentException("Parameter locationparameter is required and cannot be null.")); + } + if (requestBody == null) { + return Mono.error(new IllegalArgumentException("Parameter requestBody is required and cannot be null.")); + } else { + requestBody.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.virtualMachinesCancelOperations(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), locationparameter, requestBody, accept, context); + } + + /** + * virtualMachinesCancelOperations: cancelOperations for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is the response from a cancel operations request on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono virtualMachinesCancelOperationsAsync(String locationparameter, + CancelOperationsRequest requestBody) { + return virtualMachinesCancelOperationsWithResponseAsync(locationparameter, requestBody) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * virtualMachinesCancelOperations: cancelOperations for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is the response from a cancel operations request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response virtualMachinesCancelOperationsWithResponse(String locationparameter, + CancelOperationsRequest requestBody, Context context) { + return virtualMachinesCancelOperationsWithResponseAsync(locationparameter, requestBody, context).block(); + } + + /** + * virtualMachinesCancelOperations: cancelOperations for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is the response from a cancel operations request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CancelOperationsResponseInner virtualMachinesCancelOperations(String locationparameter, + CancelOperationsRequest requestBody) { + return virtualMachinesCancelOperationsWithResponse(locationparameter, requestBody, Context.NONE).getValue(); + } + + /** + * virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a deallocate request along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> virtualMachinesExecuteDeallocateWithResponseAsync( + String locationparameter, ExecuteDeallocateRequest requestBody) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationparameter == null) { + return Mono + .error(new IllegalArgumentException("Parameter locationparameter is required and cannot be null.")); + } + if (requestBody == null) { + return Mono.error(new IllegalArgumentException("Parameter requestBody is required and cannot be null.")); + } else { + requestBody.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.virtualMachinesExecuteDeallocate(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), locationparameter, requestBody, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a deallocate request along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> virtualMachinesExecuteDeallocateWithResponseAsync( + String locationparameter, ExecuteDeallocateRequest requestBody, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationparameter == null) { + return Mono + .error(new IllegalArgumentException("Parameter locationparameter is required and cannot be null.")); + } + if (requestBody == null) { + return Mono.error(new IllegalArgumentException("Parameter requestBody is required and cannot be null.")); + } else { + requestBody.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.virtualMachinesExecuteDeallocate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), locationparameter, requestBody, accept, context); + } + + /** + * virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a deallocate request on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono + virtualMachinesExecuteDeallocateAsync(String locationparameter, ExecuteDeallocateRequest requestBody) { + return virtualMachinesExecuteDeallocateWithResponseAsync(locationparameter, requestBody) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a deallocate request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response virtualMachinesExecuteDeallocateWithResponse( + String locationparameter, ExecuteDeallocateRequest requestBody, Context context) { + return virtualMachinesExecuteDeallocateWithResponseAsync(locationparameter, requestBody, context).block(); + } + + /** + * virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a deallocate request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeallocateResourceOperationResponseInner virtualMachinesExecuteDeallocate(String locationparameter, + ExecuteDeallocateRequest requestBody) { + return virtualMachinesExecuteDeallocateWithResponse(locationparameter, requestBody, Context.NONE).getValue(); + } + + /** + * virtualMachinesExecuteHibernate: executeHibernate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a Hibernate request along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> virtualMachinesExecuteHibernateWithResponseAsync( + String locationparameter, ExecuteHibernateRequest requestBody) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationparameter == null) { + return Mono + .error(new IllegalArgumentException("Parameter locationparameter is required and cannot be null.")); + } + if (requestBody == null) { + return Mono.error(new IllegalArgumentException("Parameter requestBody is required and cannot be null.")); + } else { + requestBody.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.virtualMachinesExecuteHibernate(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), locationparameter, requestBody, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * virtualMachinesExecuteHibernate: executeHibernate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a Hibernate request along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> virtualMachinesExecuteHibernateWithResponseAsync( + String locationparameter, ExecuteHibernateRequest requestBody, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationparameter == null) { + return Mono + .error(new IllegalArgumentException("Parameter locationparameter is required and cannot be null.")); + } + if (requestBody == null) { + return Mono.error(new IllegalArgumentException("Parameter requestBody is required and cannot be null.")); + } else { + requestBody.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.virtualMachinesExecuteHibernate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), locationparameter, requestBody, accept, context); + } + + /** + * virtualMachinesExecuteHibernate: executeHibernate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a Hibernate request on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono virtualMachinesExecuteHibernateAsync(String locationparameter, + ExecuteHibernateRequest requestBody) { + return virtualMachinesExecuteHibernateWithResponseAsync(locationparameter, requestBody) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * virtualMachinesExecuteHibernate: executeHibernate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a Hibernate request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response virtualMachinesExecuteHibernateWithResponse( + String locationparameter, ExecuteHibernateRequest requestBody, Context context) { + return virtualMachinesExecuteHibernateWithResponseAsync(locationparameter, requestBody, context).block(); + } + + /** + * virtualMachinesExecuteHibernate: executeHibernate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a Hibernate request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HibernateResourceOperationResponseInner virtualMachinesExecuteHibernate(String locationparameter, + ExecuteHibernateRequest requestBody) { + return virtualMachinesExecuteHibernateWithResponse(locationparameter, requestBody, Context.NONE).getValue(); + } + + /** + * virtualMachinesExecuteStart: executeStart for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a start request along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + virtualMachinesExecuteStartWithResponseAsync(String locationparameter, ExecuteStartRequest requestBody) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationparameter == null) { + return Mono + .error(new IllegalArgumentException("Parameter locationparameter is required and cannot be null.")); + } + if (requestBody == null) { + return Mono.error(new IllegalArgumentException("Parameter requestBody is required and cannot be null.")); + } else { + requestBody.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.virtualMachinesExecuteStart(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), locationparameter, requestBody, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * virtualMachinesExecuteStart: executeStart for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a start request along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> virtualMachinesExecuteStartWithResponseAsync( + String locationparameter, ExecuteStartRequest requestBody, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationparameter == null) { + return Mono + .error(new IllegalArgumentException("Parameter locationparameter is required and cannot be null.")); + } + if (requestBody == null) { + return Mono.error(new IllegalArgumentException("Parameter requestBody is required and cannot be null.")); + } else { + requestBody.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.virtualMachinesExecuteStart(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), locationparameter, requestBody, accept, context); + } + + /** + * virtualMachinesExecuteStart: executeStart for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a start request on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono virtualMachinesExecuteStartAsync(String locationparameter, + ExecuteStartRequest requestBody) { + return virtualMachinesExecuteStartWithResponseAsync(locationparameter, requestBody) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * virtualMachinesExecuteStart: executeStart for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a start request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response virtualMachinesExecuteStartWithResponse( + String locationparameter, ExecuteStartRequest requestBody, Context context) { + return virtualMachinesExecuteStartWithResponseAsync(locationparameter, requestBody, context).block(); + } + + /** + * virtualMachinesExecuteStart: executeStart for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a start request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StartResourceOperationResponseInner virtualMachinesExecuteStart(String locationparameter, + ExecuteStartRequest requestBody) { + return virtualMachinesExecuteStartWithResponse(locationparameter, requestBody, Context.NONE).getValue(); + } + + /** + * virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is the response from a get operations status request along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> virtualMachinesGetOperationStatusWithResponseAsync( + String locationparameter, GetOperationStatusRequest requestBody) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationparameter == null) { + return Mono + .error(new IllegalArgumentException("Parameter locationparameter is required and cannot be null.")); + } + if (requestBody == null) { + return Mono.error(new IllegalArgumentException("Parameter requestBody is required and cannot be null.")); + } else { + requestBody.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.virtualMachinesGetOperationStatus(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), locationparameter, requestBody, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is the response from a get operations status request along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> virtualMachinesGetOperationStatusWithResponseAsync( + String locationparameter, GetOperationStatusRequest requestBody, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationparameter == null) { + return Mono + .error(new IllegalArgumentException("Parameter locationparameter is required and cannot be null.")); + } + if (requestBody == null) { + return Mono.error(new IllegalArgumentException("Parameter requestBody is required and cannot be null.")); + } else { + requestBody.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.virtualMachinesGetOperationStatus(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), locationparameter, requestBody, accept, context); + } + + /** + * virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is the response from a get operations status request on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono virtualMachinesGetOperationStatusAsync(String locationparameter, + GetOperationStatusRequest requestBody) { + return virtualMachinesGetOperationStatusWithResponseAsync(locationparameter, requestBody) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is the response from a get operations status request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response virtualMachinesGetOperationStatusWithResponse( + String locationparameter, GetOperationStatusRequest requestBody, Context context) { + return virtualMachinesGetOperationStatusWithResponseAsync(locationparameter, requestBody, context).block(); + } + + /** + * virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is the response from a get operations status request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GetOperationStatusResponseInner virtualMachinesGetOperationStatus(String locationparameter, + GetOperationStatusRequest requestBody) { + return virtualMachinesGetOperationStatusWithResponse(locationparameter, requestBody, Context.NONE).getValue(); + } + + /** + * virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a deallocate request along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> virtualMachinesSubmitDeallocateWithResponseAsync( + String locationparameter, SubmitDeallocateRequest requestBody) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationparameter == null) { + return Mono + .error(new IllegalArgumentException("Parameter locationparameter is required and cannot be null.")); + } + if (requestBody == null) { + return Mono.error(new IllegalArgumentException("Parameter requestBody is required and cannot be null.")); + } else { + requestBody.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.virtualMachinesSubmitDeallocate(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), locationparameter, requestBody, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a deallocate request along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> virtualMachinesSubmitDeallocateWithResponseAsync( + String locationparameter, SubmitDeallocateRequest requestBody, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationparameter == null) { + return Mono + .error(new IllegalArgumentException("Parameter locationparameter is required and cannot be null.")); + } + if (requestBody == null) { + return Mono.error(new IllegalArgumentException("Parameter requestBody is required and cannot be null.")); + } else { + requestBody.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.virtualMachinesSubmitDeallocate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), locationparameter, requestBody, accept, context); + } + + /** + * virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a deallocate request on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono + virtualMachinesSubmitDeallocateAsync(String locationparameter, SubmitDeallocateRequest requestBody) { + return virtualMachinesSubmitDeallocateWithResponseAsync(locationparameter, requestBody) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a deallocate request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response virtualMachinesSubmitDeallocateWithResponse( + String locationparameter, SubmitDeallocateRequest requestBody, Context context) { + return virtualMachinesSubmitDeallocateWithResponseAsync(locationparameter, requestBody, context).block(); + } + + /** + * virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a deallocate request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DeallocateResourceOperationResponseInner virtualMachinesSubmitDeallocate(String locationparameter, + SubmitDeallocateRequest requestBody) { + return virtualMachinesSubmitDeallocateWithResponse(locationparameter, requestBody, Context.NONE).getValue(); + } + + /** + * virtualMachinesSubmitHibernate: submitHibernate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a Hibernate request along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + virtualMachinesSubmitHibernateWithResponseAsync(String locationparameter, SubmitHibernateRequest requestBody) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationparameter == null) { + return Mono + .error(new IllegalArgumentException("Parameter locationparameter is required and cannot be null.")); + } + if (requestBody == null) { + return Mono.error(new IllegalArgumentException("Parameter requestBody is required and cannot be null.")); + } else { + requestBody.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.virtualMachinesSubmitHibernate(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), locationparameter, requestBody, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * virtualMachinesSubmitHibernate: submitHibernate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a Hibernate request along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> virtualMachinesSubmitHibernateWithResponseAsync( + String locationparameter, SubmitHibernateRequest requestBody, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationparameter == null) { + return Mono + .error(new IllegalArgumentException("Parameter locationparameter is required and cannot be null.")); + } + if (requestBody == null) { + return Mono.error(new IllegalArgumentException("Parameter requestBody is required and cannot be null.")); + } else { + requestBody.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.virtualMachinesSubmitHibernate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), locationparameter, requestBody, accept, context); + } + + /** + * virtualMachinesSubmitHibernate: submitHibernate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a Hibernate request on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono virtualMachinesSubmitHibernateAsync(String locationparameter, + SubmitHibernateRequest requestBody) { + return virtualMachinesSubmitHibernateWithResponseAsync(locationparameter, requestBody) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * virtualMachinesSubmitHibernate: submitHibernate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a Hibernate request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response virtualMachinesSubmitHibernateWithResponse( + String locationparameter, SubmitHibernateRequest requestBody, Context context) { + return virtualMachinesSubmitHibernateWithResponseAsync(locationparameter, requestBody, context).block(); + } + + /** + * virtualMachinesSubmitHibernate: submitHibernate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a Hibernate request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HibernateResourceOperationResponseInner virtualMachinesSubmitHibernate(String locationparameter, + SubmitHibernateRequest requestBody) { + return virtualMachinesSubmitHibernateWithResponse(locationparameter, requestBody, Context.NONE).getValue(); + } + + /** + * virtualMachinesSubmitStart: submitStart for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a start request along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + virtualMachinesSubmitStartWithResponseAsync(String locationparameter, SubmitStartRequest requestBody) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationparameter == null) { + return Mono + .error(new IllegalArgumentException("Parameter locationparameter is required and cannot be null.")); + } + if (requestBody == null) { + return Mono.error(new IllegalArgumentException("Parameter requestBody is required and cannot be null.")); + } else { + requestBody.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.virtualMachinesSubmitStart(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), locationparameter, requestBody, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * virtualMachinesSubmitStart: submitStart for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a start request along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> virtualMachinesSubmitStartWithResponseAsync( + String locationparameter, SubmitStartRequest requestBody, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationparameter == null) { + return Mono + .error(new IllegalArgumentException("Parameter locationparameter is required and cannot be null.")); + } + if (requestBody == null) { + return Mono.error(new IllegalArgumentException("Parameter requestBody is required and cannot be null.")); + } else { + requestBody.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.virtualMachinesSubmitStart(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), locationparameter, requestBody, accept, context); + } + + /** + * virtualMachinesSubmitStart: submitStart for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a start request on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono virtualMachinesSubmitStartAsync(String locationparameter, + SubmitStartRequest requestBody) { + return virtualMachinesSubmitStartWithResponseAsync(locationparameter, requestBody) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * virtualMachinesSubmitStart: submitStart for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a start request along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response virtualMachinesSubmitStartWithResponse( + String locationparameter, SubmitStartRequest requestBody, Context context) { + return virtualMachinesSubmitStartWithResponseAsync(locationparameter, requestBody, context).block(); + } + + /** + * virtualMachinesSubmitStart: submitStart for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 from a start request. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StartResourceOperationResponseInner virtualMachinesSubmitStart(String locationparameter, + SubmitStartRequest requestBody) { + return virtualMachinesSubmitStartWithResponse(locationparameter, requestBody, Context.NONE).getValue(); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ScheduledActionsImpl.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ScheduledActionsImpl.java new file mode 100644 index 0000000000000..09eb1d811d24d --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ScheduledActionsImpl.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.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.computeschedule.fluent.ScheduledActionsClient; +import com.azure.resourcemanager.computeschedule.fluent.models.CancelOperationsResponseInner; +import com.azure.resourcemanager.computeschedule.fluent.models.DeallocateResourceOperationResponseInner; +import com.azure.resourcemanager.computeschedule.fluent.models.GetOperationStatusResponseInner; +import com.azure.resourcemanager.computeschedule.fluent.models.HibernateResourceOperationResponseInner; +import com.azure.resourcemanager.computeschedule.fluent.models.StartResourceOperationResponseInner; +import com.azure.resourcemanager.computeschedule.models.CancelOperationsRequest; +import com.azure.resourcemanager.computeschedule.models.CancelOperationsResponse; +import com.azure.resourcemanager.computeschedule.models.DeallocateResourceOperationResponse; +import com.azure.resourcemanager.computeschedule.models.ExecuteDeallocateRequest; +import com.azure.resourcemanager.computeschedule.models.ExecuteHibernateRequest; +import com.azure.resourcemanager.computeschedule.models.ExecuteStartRequest; +import com.azure.resourcemanager.computeschedule.models.GetOperationStatusRequest; +import com.azure.resourcemanager.computeschedule.models.GetOperationStatusResponse; +import com.azure.resourcemanager.computeschedule.models.HibernateResourceOperationResponse; +import com.azure.resourcemanager.computeschedule.models.ScheduledActions; +import com.azure.resourcemanager.computeschedule.models.StartResourceOperationResponse; +import com.azure.resourcemanager.computeschedule.models.SubmitDeallocateRequest; +import com.azure.resourcemanager.computeschedule.models.SubmitHibernateRequest; +import com.azure.resourcemanager.computeschedule.models.SubmitStartRequest; + +public final class ScheduledActionsImpl implements ScheduledActions { + private static final ClientLogger LOGGER = new ClientLogger(ScheduledActionsImpl.class); + + private final ScheduledActionsClient innerClient; + + private final com.azure.resourcemanager.computeschedule.ComputescheduleManager serviceManager; + + public ScheduledActionsImpl(ScheduledActionsClient innerClient, + com.azure.resourcemanager.computeschedule.ComputescheduleManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response virtualMachinesCancelOperationsWithResponse(String locationparameter, + CancelOperationsRequest requestBody, Context context) { + Response inner + = this.serviceClient().virtualMachinesCancelOperationsWithResponse(locationparameter, requestBody, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CancelOperationsResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CancelOperationsResponse virtualMachinesCancelOperations(String locationparameter, + CancelOperationsRequest requestBody) { + CancelOperationsResponseInner inner + = this.serviceClient().virtualMachinesCancelOperations(locationparameter, requestBody); + if (inner != null) { + return new CancelOperationsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response virtualMachinesExecuteDeallocateWithResponse( + String locationparameter, ExecuteDeallocateRequest requestBody, Context context) { + Response inner = this.serviceClient() + .virtualMachinesExecuteDeallocateWithResponse(locationparameter, requestBody, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DeallocateResourceOperationResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DeallocateResourceOperationResponse virtualMachinesExecuteDeallocate(String locationparameter, + ExecuteDeallocateRequest requestBody) { + DeallocateResourceOperationResponseInner inner + = this.serviceClient().virtualMachinesExecuteDeallocate(locationparameter, requestBody); + if (inner != null) { + return new DeallocateResourceOperationResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response virtualMachinesExecuteHibernateWithResponse( + String locationparameter, ExecuteHibernateRequest requestBody, Context context) { + Response inner + = this.serviceClient().virtualMachinesExecuteHibernateWithResponse(locationparameter, requestBody, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new HibernateResourceOperationResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public HibernateResourceOperationResponse virtualMachinesExecuteHibernate(String locationparameter, + ExecuteHibernateRequest requestBody) { + HibernateResourceOperationResponseInner inner + = this.serviceClient().virtualMachinesExecuteHibernate(locationparameter, requestBody); + if (inner != null) { + return new HibernateResourceOperationResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response virtualMachinesExecuteStartWithResponse(String locationparameter, + ExecuteStartRequest requestBody, Context context) { + Response inner + = this.serviceClient().virtualMachinesExecuteStartWithResponse(locationparameter, requestBody, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new StartResourceOperationResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public StartResourceOperationResponse virtualMachinesExecuteStart(String locationparameter, + ExecuteStartRequest requestBody) { + StartResourceOperationResponseInner inner + = this.serviceClient().virtualMachinesExecuteStart(locationparameter, requestBody); + if (inner != null) { + return new StartResourceOperationResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response virtualMachinesGetOperationStatusWithResponse(String locationparameter, + GetOperationStatusRequest requestBody, Context context) { + Response inner = this.serviceClient() + .virtualMachinesGetOperationStatusWithResponse(locationparameter, requestBody, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GetOperationStatusResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public GetOperationStatusResponse virtualMachinesGetOperationStatus(String locationparameter, + GetOperationStatusRequest requestBody) { + GetOperationStatusResponseInner inner + = this.serviceClient().virtualMachinesGetOperationStatus(locationparameter, requestBody); + if (inner != null) { + return new GetOperationStatusResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response virtualMachinesSubmitDeallocateWithResponse( + String locationparameter, SubmitDeallocateRequest requestBody, Context context) { + Response inner + = this.serviceClient().virtualMachinesSubmitDeallocateWithResponse(locationparameter, requestBody, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DeallocateResourceOperationResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DeallocateResourceOperationResponse virtualMachinesSubmitDeallocate(String locationparameter, + SubmitDeallocateRequest requestBody) { + DeallocateResourceOperationResponseInner inner + = this.serviceClient().virtualMachinesSubmitDeallocate(locationparameter, requestBody); + if (inner != null) { + return new DeallocateResourceOperationResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response virtualMachinesSubmitHibernateWithResponse( + String locationparameter, SubmitHibernateRequest requestBody, Context context) { + Response inner + = this.serviceClient().virtualMachinesSubmitHibernateWithResponse(locationparameter, requestBody, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new HibernateResourceOperationResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public HibernateResourceOperationResponse virtualMachinesSubmitHibernate(String locationparameter, + SubmitHibernateRequest requestBody) { + HibernateResourceOperationResponseInner inner + = this.serviceClient().virtualMachinesSubmitHibernate(locationparameter, requestBody); + if (inner != null) { + return new HibernateResourceOperationResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response virtualMachinesSubmitStartWithResponse(String locationparameter, + SubmitStartRequest requestBody, Context context) { + Response inner + = this.serviceClient().virtualMachinesSubmitStartWithResponse(locationparameter, requestBody, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new StartResourceOperationResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public StartResourceOperationResponse virtualMachinesSubmitStart(String locationparameter, + SubmitStartRequest requestBody) { + StartResourceOperationResponseInner inner + = this.serviceClient().virtualMachinesSubmitStart(locationparameter, requestBody); + if (inner != null) { + return new StartResourceOperationResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private ScheduledActionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.computeschedule.ComputescheduleManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/StartResourceOperationResponseImpl.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/StartResourceOperationResponseImpl.java new file mode 100644 index 0000000000000..cab53c5f93701 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/StartResourceOperationResponseImpl.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.computeschedule.implementation; + +import com.azure.resourcemanager.computeschedule.fluent.models.StartResourceOperationResponseInner; +import com.azure.resourcemanager.computeschedule.models.ResourceOperation; +import com.azure.resourcemanager.computeschedule.models.StartResourceOperationResponse; +import java.util.Collections; +import java.util.List; + +public final class StartResourceOperationResponseImpl implements StartResourceOperationResponse { + private StartResourceOperationResponseInner innerObject; + + private final com.azure.resourcemanager.computeschedule.ComputescheduleManager serviceManager; + + StartResourceOperationResponseImpl(StartResourceOperationResponseInner innerObject, + com.azure.resourcemanager.computeschedule.ComputescheduleManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String description() { + return this.innerModel().description(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public List results() { + List inner = this.innerModel().results(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public StartResourceOperationResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.computeschedule.ComputescheduleManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/package-info.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/package-info.java new file mode 100644 index 0000000000000..26d376ec51138 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for MicrosoftComputeScheduleForTesting. + * Microsoft.ComputeSchedule Resource Provider management API. + */ +package com.azure.resourcemanager.computeschedule.implementation; diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ActionType.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ActionType.java new file mode 100644 index 0000000000000..c871ae61f4363 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ActionType.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.computeschedule.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Static value Internal for ActionType. + */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/CancelOperationsRequest.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/CancelOperationsRequest.java new file mode 100644 index 0000000000000..04683cdd5c104 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/CancelOperationsRequest.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * This is the request to cancel running operations in scheduled actions using the operation ids. + */ +@Fluent +public final class CancelOperationsRequest implements JsonSerializable { + /* + * The list of operation ids to cancel operations on + */ + private List operationIds; + + /* + * Correlationid item + */ + private String correlationid; + + /** + * Creates an instance of CancelOperationsRequest class. + */ + public CancelOperationsRequest() { + } + + /** + * Get the operationIds property: The list of operation ids to cancel operations on. + * + * @return the operationIds value. + */ + public List operationIds() { + return this.operationIds; + } + + /** + * Set the operationIds property: The list of operation ids to cancel operations on. + * + * @param operationIds the operationIds value to set. + * @return the CancelOperationsRequest object itself. + */ + public CancelOperationsRequest withOperationIds(List operationIds) { + this.operationIds = operationIds; + return this; + } + + /** + * Get the correlationid property: Correlationid item. + * + * @return the correlationid value. + */ + public String correlationid() { + return this.correlationid; + } + + /** + * Set the correlationid property: Correlationid item. + * + * @param correlationid the correlationid value to set. + * @return the CancelOperationsRequest object itself. + */ + public CancelOperationsRequest withCorrelationid(String correlationid) { + this.correlationid = correlationid; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (operationIds() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property operationIds in model CancelOperationsRequest")); + } + if (correlationid() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property correlationid in model CancelOperationsRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CancelOperationsRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("operationIds", this.operationIds, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("correlationid", this.correlationid); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CancelOperationsRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CancelOperationsRequest if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CancelOperationsRequest. + */ + public static CancelOperationsRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CancelOperationsRequest deserializedCancelOperationsRequest = new CancelOperationsRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operationIds".equals(fieldName)) { + List operationIds = reader.readArray(reader1 -> reader1.getString()); + deserializedCancelOperationsRequest.operationIds = operationIds; + } else if ("correlationid".equals(fieldName)) { + deserializedCancelOperationsRequest.correlationid = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCancelOperationsRequest; + }); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/CancelOperationsResponse.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/CancelOperationsResponse.java new file mode 100644 index 0000000000000..658b5cf6ad892 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/CancelOperationsResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.models; + +import com.azure.resourcemanager.computeschedule.fluent.models.CancelOperationsResponseInner; +import java.util.List; + +/** + * An immutable client-side representation of CancelOperationsResponse. + */ +public interface CancelOperationsResponse { + /** + * Gets the results property: An array of resource operations that were successfully cancelled. + * + * @return the results value. + */ + List results(); + + /** + * Gets the inner com.azure.resourcemanager.computeschedule.fluent.models.CancelOperationsResponseInner object. + * + * @return the inner object. + */ + CancelOperationsResponseInner innerModel(); +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/DeadlineType.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/DeadlineType.java new file mode 100644 index 0000000000000..8e699f802950a --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/DeadlineType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The types of deadlines supported by ScheduledActions. + */ +public final class DeadlineType extends ExpandableStringEnum { + /** + * Static value Unknown for DeadlineType. + */ + public static final DeadlineType UNKNOWN = fromString("Unknown"); + + /** + * Static value InitiateAt for DeadlineType. + */ + public static final DeadlineType INITIATE_AT = fromString("InitiateAt"); + + /** + * Static value CompleteBy for DeadlineType. + */ + public static final DeadlineType COMPLETE_BY = fromString("CompleteBy"); + + /** + * Creates a new instance of DeadlineType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DeadlineType() { + } + + /** + * Creates or finds a DeadlineType from its string representation. + * + * @param name a name to look for. + * @return the corresponding DeadlineType. + */ + public static DeadlineType fromString(String name) { + return fromString(name, DeadlineType.class); + } + + /** + * Gets known DeadlineType values. + * + * @return known DeadlineType values. + */ + public static Collection values() { + return values(DeadlineType.class); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/DeallocateResourceOperationResponse.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/DeallocateResourceOperationResponse.java new file mode 100644 index 0000000000000..9b44ed3b56e4a --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/DeallocateResourceOperationResponse.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.computeschedule.models; + +import com.azure.resourcemanager.computeschedule.fluent.models.DeallocateResourceOperationResponseInner; +import java.util.List; + +/** + * An immutable client-side representation of DeallocateResourceOperationResponse. + */ +public interface DeallocateResourceOperationResponse { + /** + * Gets the description property: The description of the operation response. + * + * @return the description value. + */ + String description(); + + /** + * Gets the type property: The type of resources used in the deallocate request eg virtual machines. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The location of the deallocate request eg westus. + * + * @return the location value. + */ + String location(); + + /** + * Gets the results property: The results from the deallocate request if no errors exist. + * + * @return the results value. + */ + List results(); + + /** + * Gets the inner com.azure.resourcemanager.computeschedule.fluent.models.DeallocateResourceOperationResponseInner + * object. + * + * @return the inner object. + */ + DeallocateResourceOperationResponseInner innerModel(); +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ExecuteDeallocateRequest.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ExecuteDeallocateRequest.java new file mode 100644 index 0000000000000..a3c1ce0cc5ece --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ExecuteDeallocateRequest.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ExecuteDeallocateRequest request for executeDeallocate operations. + */ +@Fluent +public final class ExecuteDeallocateRequest implements JsonSerializable { + /* + * The execution parameters for the request + */ + private ExecutionParameters executionParameters; + + /* + * The resources for the request + */ + private Resources resources; + + /* + * Correlationid item + */ + private String correlationid; + + /** + * Creates an instance of ExecuteDeallocateRequest class. + */ + public ExecuteDeallocateRequest() { + } + + /** + * Get the executionParameters property: The execution parameters for the request. + * + * @return the executionParameters value. + */ + public ExecutionParameters executionParameters() { + return this.executionParameters; + } + + /** + * Set the executionParameters property: The execution parameters for the request. + * + * @param executionParameters the executionParameters value to set. + * @return the ExecuteDeallocateRequest object itself. + */ + public ExecuteDeallocateRequest withExecutionParameters(ExecutionParameters executionParameters) { + this.executionParameters = executionParameters; + return this; + } + + /** + * Get the resources property: The resources for the request. + * + * @return the resources value. + */ + public Resources resources() { + return this.resources; + } + + /** + * Set the resources property: The resources for the request. + * + * @param resources the resources value to set. + * @return the ExecuteDeallocateRequest object itself. + */ + public ExecuteDeallocateRequest withResources(Resources resources) { + this.resources = resources; + return this; + } + + /** + * Get the correlationid property: Correlationid item. + * + * @return the correlationid value. + */ + public String correlationid() { + return this.correlationid; + } + + /** + * Set the correlationid property: Correlationid item. + * + * @param correlationid the correlationid value to set. + * @return the ExecuteDeallocateRequest object itself. + */ + public ExecuteDeallocateRequest withCorrelationid(String correlationid) { + this.correlationid = correlationid; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (executionParameters() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property executionParameters in model ExecuteDeallocateRequest")); + } else { + executionParameters().validate(); + } + if (resources() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property resources in model ExecuteDeallocateRequest")); + } else { + resources().validate(); + } + if (correlationid() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property correlationid in model ExecuteDeallocateRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ExecuteDeallocateRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("executionParameters", this.executionParameters); + jsonWriter.writeJsonField("resources", this.resources); + jsonWriter.writeStringField("correlationid", this.correlationid); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExecuteDeallocateRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExecuteDeallocateRequest if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExecuteDeallocateRequest. + */ + public static ExecuteDeallocateRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExecuteDeallocateRequest deserializedExecuteDeallocateRequest = new ExecuteDeallocateRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("executionParameters".equals(fieldName)) { + deserializedExecuteDeallocateRequest.executionParameters = ExecutionParameters.fromJson(reader); + } else if ("resources".equals(fieldName)) { + deserializedExecuteDeallocateRequest.resources = Resources.fromJson(reader); + } else if ("correlationid".equals(fieldName)) { + deserializedExecuteDeallocateRequest.correlationid = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedExecuteDeallocateRequest; + }); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ExecuteHibernateRequest.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ExecuteHibernateRequest.java new file mode 100644 index 0000000000000..5686a7f39d02b --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ExecuteHibernateRequest.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ExecuteHibernateRequest request for executeHibernate operations. + */ +@Fluent +public final class ExecuteHibernateRequest implements JsonSerializable { + /* + * The execution parameters for the request + */ + private ExecutionParameters executionParameters; + + /* + * The resources for the request + */ + private Resources resources; + + /* + * Correlationid item + */ + private String correlationid; + + /** + * Creates an instance of ExecuteHibernateRequest class. + */ + public ExecuteHibernateRequest() { + } + + /** + * Get the executionParameters property: The execution parameters for the request. + * + * @return the executionParameters value. + */ + public ExecutionParameters executionParameters() { + return this.executionParameters; + } + + /** + * Set the executionParameters property: The execution parameters for the request. + * + * @param executionParameters the executionParameters value to set. + * @return the ExecuteHibernateRequest object itself. + */ + public ExecuteHibernateRequest withExecutionParameters(ExecutionParameters executionParameters) { + this.executionParameters = executionParameters; + return this; + } + + /** + * Get the resources property: The resources for the request. + * + * @return the resources value. + */ + public Resources resources() { + return this.resources; + } + + /** + * Set the resources property: The resources for the request. + * + * @param resources the resources value to set. + * @return the ExecuteHibernateRequest object itself. + */ + public ExecuteHibernateRequest withResources(Resources resources) { + this.resources = resources; + return this; + } + + /** + * Get the correlationid property: Correlationid item. + * + * @return the correlationid value. + */ + public String correlationid() { + return this.correlationid; + } + + /** + * Set the correlationid property: Correlationid item. + * + * @param correlationid the correlationid value to set. + * @return the ExecuteHibernateRequest object itself. + */ + public ExecuteHibernateRequest withCorrelationid(String correlationid) { + this.correlationid = correlationid; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (executionParameters() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property executionParameters in model ExecuteHibernateRequest")); + } else { + executionParameters().validate(); + } + if (resources() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property resources in model ExecuteHibernateRequest")); + } else { + resources().validate(); + } + if (correlationid() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property correlationid in model ExecuteHibernateRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ExecuteHibernateRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("executionParameters", this.executionParameters); + jsonWriter.writeJsonField("resources", this.resources); + jsonWriter.writeStringField("correlationid", this.correlationid); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExecuteHibernateRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExecuteHibernateRequest if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExecuteHibernateRequest. + */ + public static ExecuteHibernateRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExecuteHibernateRequest deserializedExecuteHibernateRequest = new ExecuteHibernateRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("executionParameters".equals(fieldName)) { + deserializedExecuteHibernateRequest.executionParameters = ExecutionParameters.fromJson(reader); + } else if ("resources".equals(fieldName)) { + deserializedExecuteHibernateRequest.resources = Resources.fromJson(reader); + } else if ("correlationid".equals(fieldName)) { + deserializedExecuteHibernateRequest.correlationid = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedExecuteHibernateRequest; + }); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ExecuteStartRequest.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ExecuteStartRequest.java new file mode 100644 index 0000000000000..065b5e4970701 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ExecuteStartRequest.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The ExecuteStartRequest request for executeStart operations. + */ +@Fluent +public final class ExecuteStartRequest implements JsonSerializable { + /* + * The execution parameters for the request + */ + private ExecutionParameters executionParameters; + + /* + * The resources for the request + */ + private Resources resources; + + /* + * Correlationid item + */ + private String correlationid; + + /** + * Creates an instance of ExecuteStartRequest class. + */ + public ExecuteStartRequest() { + } + + /** + * Get the executionParameters property: The execution parameters for the request. + * + * @return the executionParameters value. + */ + public ExecutionParameters executionParameters() { + return this.executionParameters; + } + + /** + * Set the executionParameters property: The execution parameters for the request. + * + * @param executionParameters the executionParameters value to set. + * @return the ExecuteStartRequest object itself. + */ + public ExecuteStartRequest withExecutionParameters(ExecutionParameters executionParameters) { + this.executionParameters = executionParameters; + return this; + } + + /** + * Get the resources property: The resources for the request. + * + * @return the resources value. + */ + public Resources resources() { + return this.resources; + } + + /** + * Set the resources property: The resources for the request. + * + * @param resources the resources value to set. + * @return the ExecuteStartRequest object itself. + */ + public ExecuteStartRequest withResources(Resources resources) { + this.resources = resources; + return this; + } + + /** + * Get the correlationid property: Correlationid item. + * + * @return the correlationid value. + */ + public String correlationid() { + return this.correlationid; + } + + /** + * Set the correlationid property: Correlationid item. + * + * @param correlationid the correlationid value to set. + * @return the ExecuteStartRequest object itself. + */ + public ExecuteStartRequest withCorrelationid(String correlationid) { + this.correlationid = correlationid; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (executionParameters() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property executionParameters in model ExecuteStartRequest")); + } else { + executionParameters().validate(); + } + if (resources() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property resources in model ExecuteStartRequest")); + } else { + resources().validate(); + } + if (correlationid() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property correlationid in model ExecuteStartRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ExecuteStartRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("executionParameters", this.executionParameters); + jsonWriter.writeJsonField("resources", this.resources); + jsonWriter.writeStringField("correlationid", this.correlationid); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExecuteStartRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExecuteStartRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExecuteStartRequest. + */ + public static ExecuteStartRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExecuteStartRequest deserializedExecuteStartRequest = new ExecuteStartRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("executionParameters".equals(fieldName)) { + deserializedExecuteStartRequest.executionParameters = ExecutionParameters.fromJson(reader); + } else if ("resources".equals(fieldName)) { + deserializedExecuteStartRequest.resources = Resources.fromJson(reader); + } else if ("correlationid".equals(fieldName)) { + deserializedExecuteStartRequest.correlationid = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedExecuteStartRequest; + }); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ExecutionParameters.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ExecutionParameters.java new file mode 100644 index 0000000000000..02700d07aa011 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ExecutionParameters.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.computeschedule.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Extra details needed to run the user's request. + */ +@Fluent +public final class ExecutionParameters implements JsonSerializable { + /* + * Details that could optimize the user's request + */ + private OptimizationPreference optimizationPreference; + + /* + * Retry policy the user can pass + */ + private RetryPolicy retryPolicy; + + /** + * Creates an instance of ExecutionParameters class. + */ + public ExecutionParameters() { + } + + /** + * Get the optimizationPreference property: Details that could optimize the user's request. + * + * @return the optimizationPreference value. + */ + public OptimizationPreference optimizationPreference() { + return this.optimizationPreference; + } + + /** + * Set the optimizationPreference property: Details that could optimize the user's request. + * + * @param optimizationPreference the optimizationPreference value to set. + * @return the ExecutionParameters object itself. + */ + public ExecutionParameters withOptimizationPreference(OptimizationPreference optimizationPreference) { + this.optimizationPreference = optimizationPreference; + return this; + } + + /** + * Get the retryPolicy property: Retry policy the user can pass. + * + * @return the retryPolicy value. + */ + public RetryPolicy retryPolicy() { + return this.retryPolicy; + } + + /** + * Set the retryPolicy property: Retry policy the user can pass. + * + * @param retryPolicy the retryPolicy value to set. + * @return the ExecutionParameters object itself. + */ + public ExecutionParameters withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (retryPolicy() != null) { + retryPolicy().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("optimizationPreference", + this.optimizationPreference == null ? null : this.optimizationPreference.toString()); + jsonWriter.writeJsonField("retryPolicy", this.retryPolicy); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExecutionParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExecutionParameters if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ExecutionParameters. + */ + public static ExecutionParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExecutionParameters deserializedExecutionParameters = new ExecutionParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("optimizationPreference".equals(fieldName)) { + deserializedExecutionParameters.optimizationPreference + = OptimizationPreference.fromString(reader.getString()); + } else if ("retryPolicy".equals(fieldName)) { + deserializedExecutionParameters.retryPolicy = RetryPolicy.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedExecutionParameters; + }); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/GetOperationStatusRequest.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/GetOperationStatusRequest.java new file mode 100644 index 0000000000000..6d6f41f14dda3 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/GetOperationStatusRequest.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * This is the request to get operation status using operationids. + */ +@Fluent +public final class GetOperationStatusRequest implements JsonSerializable { + /* + * The list of operation ids to get the status of + */ + private List operationIds; + + /* + * Correlationid item + */ + private String correlationid; + + /** + * Creates an instance of GetOperationStatusRequest class. + */ + public GetOperationStatusRequest() { + } + + /** + * Get the operationIds property: The list of operation ids to get the status of. + * + * @return the operationIds value. + */ + public List operationIds() { + return this.operationIds; + } + + /** + * Set the operationIds property: The list of operation ids to get the status of. + * + * @param operationIds the operationIds value to set. + * @return the GetOperationStatusRequest object itself. + */ + public GetOperationStatusRequest withOperationIds(List operationIds) { + this.operationIds = operationIds; + return this; + } + + /** + * Get the correlationid property: Correlationid item. + * + * @return the correlationid value. + */ + public String correlationid() { + return this.correlationid; + } + + /** + * Set the correlationid property: Correlationid item. + * + * @param correlationid the correlationid value to set. + * @return the GetOperationStatusRequest object itself. + */ + public GetOperationStatusRequest withCorrelationid(String correlationid) { + this.correlationid = correlationid; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (operationIds() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property operationIds in model GetOperationStatusRequest")); + } + if (correlationid() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property correlationid in model GetOperationStatusRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GetOperationStatusRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("operationIds", this.operationIds, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("correlationid", this.correlationid); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetOperationStatusRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetOperationStatusRequest if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GetOperationStatusRequest. + */ + public static GetOperationStatusRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GetOperationStatusRequest deserializedGetOperationStatusRequest = new GetOperationStatusRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operationIds".equals(fieldName)) { + List operationIds = reader.readArray(reader1 -> reader1.getString()); + deserializedGetOperationStatusRequest.operationIds = operationIds; + } else if ("correlationid".equals(fieldName)) { + deserializedGetOperationStatusRequest.correlationid = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGetOperationStatusRequest; + }); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/GetOperationStatusResponse.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/GetOperationStatusResponse.java new file mode 100644 index 0000000000000..cf35dd53d703f --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/GetOperationStatusResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.models; + +import com.azure.resourcemanager.computeschedule.fluent.models.GetOperationStatusResponseInner; +import java.util.List; + +/** + * An immutable client-side representation of GetOperationStatusResponse. + */ +public interface GetOperationStatusResponse { + /** + * Gets the results property: An array of resource operations based on their operation ids. + * + * @return the results value. + */ + List results(); + + /** + * Gets the inner com.azure.resourcemanager.computeschedule.fluent.models.GetOperationStatusResponseInner object. + * + * @return the inner object. + */ + GetOperationStatusResponseInner innerModel(); +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/HibernateResourceOperationResponse.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/HibernateResourceOperationResponse.java new file mode 100644 index 0000000000000..ef6a149eb26d2 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/HibernateResourceOperationResponse.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.computeschedule.models; + +import com.azure.resourcemanager.computeschedule.fluent.models.HibernateResourceOperationResponseInner; +import java.util.List; + +/** + * An immutable client-side representation of HibernateResourceOperationResponse. + */ +public interface HibernateResourceOperationResponse { + /** + * Gets the description property: The description of the operation response. + * + * @return the description value. + */ + String description(); + + /** + * Gets the type property: The type of resources used in the Hibernate request eg virtual machines. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The location of the Hibernate request eg westus. + * + * @return the location value. + */ + String location(); + + /** + * Gets the results property: The results from the Hibernate request if no errors exist. + * + * @return the results value. + */ + List results(); + + /** + * Gets the inner com.azure.resourcemanager.computeschedule.fluent.models.HibernateResourceOperationResponseInner + * object. + * + * @return the inner object. + */ + HibernateResourceOperationResponseInner innerModel(); +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/Operation.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/Operation.java new file mode 100644 index 0000000000000..2af05a5494136 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.models; + +import com.azure.resourcemanager.computeschedule.fluent.models.OperationInner; + +/** + * An immutable client-side representation of Operation. + */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.computeschedule.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/OperationDisplay.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/OperationDisplay.java new file mode 100644 index 0000000000000..ba060185c3430 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/OperationDisplay.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Localized display information for this particular operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + public OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/OperationListResult.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/OperationListResult.java new file mode 100644 index 0000000000000..95b6cf3a73517 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/OperationListResult.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.computeschedule.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.computeschedule.fluent.models.OperationInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult implements JsonSerializable { + /* + * List of operations supported by the resource provider + */ + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + public OperationListResult() { + } + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/OperationState.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/OperationState.java new file mode 100644 index 0000000000000..d7fcc531db95d --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/OperationState.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Values that define the states of operations in Scheduled Actions. + */ +public final class OperationState extends ExpandableStringEnum { + /** + * Static value Unknown for OperationState. + */ + public static final OperationState UNKNOWN = fromString("Unknown"); + + /** + * Static value PendingScheduling for OperationState. + */ + public static final OperationState PENDING_SCHEDULING = fromString("PendingScheduling"); + + /** + * Static value Scheduled for OperationState. + */ + public static final OperationState SCHEDULED = fromString("Scheduled"); + + /** + * Static value PendingExecution for OperationState. + */ + public static final OperationState PENDING_EXECUTION = fromString("PendingExecution"); + + /** + * Static value Executing for OperationState. + */ + public static final OperationState EXECUTING = fromString("Executing"); + + /** + * Static value Succeeded for OperationState. + */ + public static final OperationState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for OperationState. + */ + public static final OperationState FAILED = fromString("Failed"); + + /** + * Static value Cancelled for OperationState. + */ + public static final OperationState CANCELLED = fromString("Cancelled"); + + /** + * Static value Blocked for OperationState. + */ + public static final OperationState BLOCKED = fromString("Blocked"); + + /** + * Creates a new instance of OperationState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OperationState() { + } + + /** + * Creates or finds a OperationState from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperationState. + */ + public static OperationState fromString(String name) { + return fromString(name, OperationState.class); + } + + /** + * Gets known OperationState values. + * + * @return known OperationState values. + */ + public static Collection values() { + return values(OperationState.class); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/Operations.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/Operations.java new file mode 100644 index 0000000000000..170a145a244ca --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/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.computeschedule.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Operations. + */ +public interface Operations { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException 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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/OptimizationPreference.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/OptimizationPreference.java new file mode 100644 index 0000000000000..37bef359f54ec --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/OptimizationPreference.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The preferences customers can select to optimize their requests to ScheduledActions. + */ +public final class OptimizationPreference extends ExpandableStringEnum { + /** + * Static value Cost for OptimizationPreference. + */ + public static final OptimizationPreference COST = fromString("Cost"); + + /** + * Static value Availability for OptimizationPreference. + */ + public static final OptimizationPreference AVAILABILITY = fromString("Availability"); + + /** + * Static value CostAvailabilityBalanced for OptimizationPreference. + */ + public static final OptimizationPreference COST_AVAILABILITY_BALANCED = fromString("CostAvailabilityBalanced"); + + /** + * Creates a new instance of OptimizationPreference value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OptimizationPreference() { + } + + /** + * Creates or finds a OptimizationPreference from its string representation. + * + * @param name a name to look for. + * @return the corresponding OptimizationPreference. + */ + public static OptimizationPreference fromString(String name) { + return fromString(name, OptimizationPreference.class); + } + + /** + * Gets known OptimizationPreference values. + * + * @return known OptimizationPreference values. + */ + public static Collection values() { + return values(OptimizationPreference.class); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/Origin.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/Origin.java new file mode 100644 index 0000000000000..f8383501a9f9b --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/Origin.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.computeschedule.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** + * Static value user for Origin. + */ + public static final Origin USER = fromString("user"); + + /** + * Static value system for Origin. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Static value user,system for Origin. + */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ResourceOperation.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ResourceOperation.java new file mode 100644 index 0000000000000..7420efabc17a4 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ResourceOperation.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * High level response from an operation on a resource. + */ +@Fluent +public final class ResourceOperation implements JsonSerializable { + /* + * Unique identifier for the resource involved in the operation, eg ArmId + */ + private String resourceId; + + /* + * Resource level error code if it exists + */ + private String errorCode; + + /* + * Resource level error details if they exist + */ + private String errorDetails; + + /* + * Details of the operation performed on a resource + */ + private ResourceOperationDetails operation; + + /** + * Creates an instance of ResourceOperation class. + */ + public ResourceOperation() { + } + + /** + * Get the resourceId property: Unique identifier for the resource involved in the operation, eg ArmId. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: Unique identifier for the resource involved in the operation, eg ArmId. + * + * @param resourceId the resourceId value to set. + * @return the ResourceOperation object itself. + */ + public ResourceOperation withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the errorCode property: Resource level error code if it exists. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Set the errorCode property: Resource level error code if it exists. + * + * @param errorCode the errorCode value to set. + * @return the ResourceOperation object itself. + */ + public ResourceOperation withErrorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * Get the errorDetails property: Resource level error details if they exist. + * + * @return the errorDetails value. + */ + public String errorDetails() { + return this.errorDetails; + } + + /** + * Set the errorDetails property: Resource level error details if they exist. + * + * @param errorDetails the errorDetails value to set. + * @return the ResourceOperation object itself. + */ + public ResourceOperation withErrorDetails(String errorDetails) { + this.errorDetails = errorDetails; + return this; + } + + /** + * Get the operation property: Details of the operation performed on a resource. + * + * @return the operation value. + */ + public ResourceOperationDetails operation() { + return this.operation; + } + + /** + * Set the operation property: Details of the operation performed on a resource. + * + * @param operation the operation value to set. + * @return the ResourceOperation object itself. + */ + public ResourceOperation withOperation(ResourceOperationDetails operation) { + this.operation = operation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (operation() != null) { + operation().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceId", this.resourceId); + jsonWriter.writeStringField("errorCode", this.errorCode); + jsonWriter.writeStringField("errorDetails", this.errorDetails); + jsonWriter.writeJsonField("operation", this.operation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceOperation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceOperation if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ResourceOperation. + */ + public static ResourceOperation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceOperation deserializedResourceOperation = new ResourceOperation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceId".equals(fieldName)) { + deserializedResourceOperation.resourceId = reader.getString(); + } else if ("errorCode".equals(fieldName)) { + deserializedResourceOperation.errorCode = reader.getString(); + } else if ("errorDetails".equals(fieldName)) { + deserializedResourceOperation.errorDetails = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedResourceOperation.operation = ResourceOperationDetails.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceOperation; + }); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ResourceOperationDetails.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ResourceOperationDetails.java new file mode 100644 index 0000000000000..e6f95a003034a --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ResourceOperationDetails.java @@ -0,0 +1,425 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * The details of a response from an operation on a resource. + */ +@Fluent +public final class ResourceOperationDetails implements JsonSerializable { + /* + * Operation identifier for the unique operation + */ + private String operationId; + + /* + * Unique identifier for the resource involved in the operation, eg ArmId + */ + private String resourceId; + + /* + * Type of operation performed on the resources + */ + private ResourceOperationType opType; + + /* + * Subscription id attached to the request + */ + private String subscriptionId; + + /* + * Deadline for the operation + */ + private OffsetDateTime deadline; + + /* + * Type of deadline of the operation + */ + private DeadlineType deadlineType; + + /* + * Current state of the operation + */ + private OperationState state; + + /* + * Timezone for the operation + */ + private String timeZone; + + /* + * Operation level errors if they exist + */ + private ResourceOperationError resourceOperationError; + + /* + * Time the operation was complete if errors are null + */ + private OffsetDateTime completedAt; + + /* + * Retry policy the user can pass + */ + private RetryPolicy retryPolicy; + + /** + * Creates an instance of ResourceOperationDetails class. + */ + public ResourceOperationDetails() { + } + + /** + * Get the operationId property: Operation identifier for the unique operation. + * + * @return the operationId value. + */ + public String operationId() { + return this.operationId; + } + + /** + * Set the operationId property: Operation identifier for the unique operation. + * + * @param operationId the operationId value to set. + * @return the ResourceOperationDetails object itself. + */ + public ResourceOperationDetails withOperationId(String operationId) { + this.operationId = operationId; + return this; + } + + /** + * Get the resourceId property: Unique identifier for the resource involved in the operation, eg ArmId. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: Unique identifier for the resource involved in the operation, eg ArmId. + * + * @param resourceId the resourceId value to set. + * @return the ResourceOperationDetails object itself. + */ + public ResourceOperationDetails withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the opType property: Type of operation performed on the resources. + * + * @return the opType value. + */ + public ResourceOperationType opType() { + return this.opType; + } + + /** + * Set the opType property: Type of operation performed on the resources. + * + * @param opType the opType value to set. + * @return the ResourceOperationDetails object itself. + */ + public ResourceOperationDetails withOpType(ResourceOperationType opType) { + this.opType = opType; + return this; + } + + /** + * Get the subscriptionId property: Subscription id attached to the request. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: Subscription id attached to the request. + * + * @param subscriptionId the subscriptionId value to set. + * @return the ResourceOperationDetails object itself. + */ + public ResourceOperationDetails withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the deadline property: Deadline for the operation. + * + * @return the deadline value. + */ + public OffsetDateTime deadline() { + return this.deadline; + } + + /** + * Set the deadline property: Deadline for the operation. + * + * @param deadline the deadline value to set. + * @return the ResourceOperationDetails object itself. + */ + public ResourceOperationDetails withDeadline(OffsetDateTime deadline) { + this.deadline = deadline; + return this; + } + + /** + * Get the deadlineType property: Type of deadline of the operation. + * + * @return the deadlineType value. + */ + public DeadlineType deadlineType() { + return this.deadlineType; + } + + /** + * Set the deadlineType property: Type of deadline of the operation. + * + * @param deadlineType the deadlineType value to set. + * @return the ResourceOperationDetails object itself. + */ + public ResourceOperationDetails withDeadlineType(DeadlineType deadlineType) { + this.deadlineType = deadlineType; + return this; + } + + /** + * Get the state property: Current state of the operation. + * + * @return the state value. + */ + public OperationState state() { + return this.state; + } + + /** + * Set the state property: Current state of the operation. + * + * @param state the state value to set. + * @return the ResourceOperationDetails object itself. + */ + public ResourceOperationDetails withState(OperationState state) { + this.state = state; + return this; + } + + /** + * Get the timeZone property: Timezone for the operation. + * + * @return the timeZone value. + */ + public String timeZone() { + return this.timeZone; + } + + /** + * Set the timeZone property: Timezone for the operation. + * + * @param timeZone the timeZone value to set. + * @return the ResourceOperationDetails object itself. + */ + public ResourceOperationDetails withTimeZone(String timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + * Get the resourceOperationError property: Operation level errors if they exist. + * + * @return the resourceOperationError value. + */ + public ResourceOperationError resourceOperationError() { + return this.resourceOperationError; + } + + /** + * Set the resourceOperationError property: Operation level errors if they exist. + * + * @param resourceOperationError the resourceOperationError value to set. + * @return the ResourceOperationDetails object itself. + */ + public ResourceOperationDetails withResourceOperationError(ResourceOperationError resourceOperationError) { + this.resourceOperationError = resourceOperationError; + return this; + } + + /** + * Get the completedAt property: Time the operation was complete if errors are null. + * + * @return the completedAt value. + */ + public OffsetDateTime completedAt() { + return this.completedAt; + } + + /** + * Set the completedAt property: Time the operation was complete if errors are null. + * + * @param completedAt the completedAt value to set. + * @return the ResourceOperationDetails object itself. + */ + public ResourceOperationDetails withCompletedAt(OffsetDateTime completedAt) { + this.completedAt = completedAt; + return this; + } + + /** + * Get the retryPolicy property: Retry policy the user can pass. + * + * @return the retryPolicy value. + */ + public RetryPolicy retryPolicy() { + return this.retryPolicy; + } + + /** + * Set the retryPolicy property: Retry policy the user can pass. + * + * @param retryPolicy the retryPolicy value to set. + * @return the ResourceOperationDetails object itself. + */ + public ResourceOperationDetails withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (operationId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property operationId in model ResourceOperationDetails")); + } + if (resourceId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property resourceId in model ResourceOperationDetails")); + } + if (opType() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property opType in model ResourceOperationDetails")); + } + if (subscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property subscriptionId in model ResourceOperationDetails")); + } + if (deadline() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property deadline in model ResourceOperationDetails")); + } + if (deadlineType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property deadlineType in model ResourceOperationDetails")); + } + if (state() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property state in model ResourceOperationDetails")); + } + if (resourceOperationError() != null) { + resourceOperationError().validate(); + } + if (retryPolicy() != null) { + retryPolicy().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ResourceOperationDetails.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("operationId", this.operationId); + jsonWriter.writeStringField("resourceId", this.resourceId); + jsonWriter.writeStringField("opType", this.opType == null ? null : this.opType.toString()); + jsonWriter.writeStringField("subscriptionId", this.subscriptionId); + jsonWriter.writeStringField("deadline", + this.deadline == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.deadline)); + jsonWriter.writeStringField("deadlineType", this.deadlineType == null ? null : this.deadlineType.toString()); + jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString()); + jsonWriter.writeStringField("timeZone", this.timeZone); + jsonWriter.writeJsonField("resourceOperationError", this.resourceOperationError); + jsonWriter.writeStringField("completedAt", + this.completedAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.completedAt)); + jsonWriter.writeJsonField("retryPolicy", this.retryPolicy); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceOperationDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceOperationDetails if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResourceOperationDetails. + */ + public static ResourceOperationDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceOperationDetails deserializedResourceOperationDetails = new ResourceOperationDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operationId".equals(fieldName)) { + deserializedResourceOperationDetails.operationId = reader.getString(); + } else if ("resourceId".equals(fieldName)) { + deserializedResourceOperationDetails.resourceId = reader.getString(); + } else if ("opType".equals(fieldName)) { + deserializedResourceOperationDetails.opType = ResourceOperationType.fromString(reader.getString()); + } else if ("subscriptionId".equals(fieldName)) { + deserializedResourceOperationDetails.subscriptionId = reader.getString(); + } else if ("deadline".equals(fieldName)) { + deserializedResourceOperationDetails.deadline = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("deadlineType".equals(fieldName)) { + deserializedResourceOperationDetails.deadlineType = DeadlineType.fromString(reader.getString()); + } else if ("state".equals(fieldName)) { + deserializedResourceOperationDetails.state = OperationState.fromString(reader.getString()); + } else if ("timeZone".equals(fieldName)) { + deserializedResourceOperationDetails.timeZone = reader.getString(); + } else if ("resourceOperationError".equals(fieldName)) { + deserializedResourceOperationDetails.resourceOperationError + = ResourceOperationError.fromJson(reader); + } else if ("completedAt".equals(fieldName)) { + deserializedResourceOperationDetails.completedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("retryPolicy".equals(fieldName)) { + deserializedResourceOperationDetails.retryPolicy = RetryPolicy.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceOperationDetails; + }); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ResourceOperationError.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ResourceOperationError.java new file mode 100644 index 0000000000000..f9e933db1393a --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ResourceOperationError.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.computeschedule.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * These describe errors that occur at the resource level. + */ +@Fluent +public final class ResourceOperationError implements JsonSerializable { + /* + * Code for the error eg 404, 500 + */ + private String errorCode; + + /* + * Detailed message about the error + */ + private String errorDetails; + + /** + * Creates an instance of ResourceOperationError class. + */ + public ResourceOperationError() { + } + + /** + * Get the errorCode property: Code for the error eg 404, 500. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Set the errorCode property: Code for the error eg 404, 500. + * + * @param errorCode the errorCode value to set. + * @return the ResourceOperationError object itself. + */ + public ResourceOperationError withErrorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * Get the errorDetails property: Detailed message about the error. + * + * @return the errorDetails value. + */ + public String errorDetails() { + return this.errorDetails; + } + + /** + * Set the errorDetails property: Detailed message about the error. + * + * @param errorDetails the errorDetails value to set. + * @return the ResourceOperationError object itself. + */ + public ResourceOperationError withErrorDetails(String errorDetails) { + this.errorDetails = errorDetails; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (errorCode() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property errorCode in model ResourceOperationError")); + } + if (errorDetails() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property errorDetails in model ResourceOperationError")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ResourceOperationError.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("errorCode", this.errorCode); + jsonWriter.writeStringField("errorDetails", this.errorDetails); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceOperationError from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceOperationError if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ResourceOperationError. + */ + public static ResourceOperationError fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceOperationError deserializedResourceOperationError = new ResourceOperationError(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("errorCode".equals(fieldName)) { + deserializedResourceOperationError.errorCode = reader.getString(); + } else if ("errorDetails".equals(fieldName)) { + deserializedResourceOperationError.errorDetails = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceOperationError; + }); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ResourceOperationType.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ResourceOperationType.java new file mode 100644 index 0000000000000..f95c9a574b401 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ResourceOperationType.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.computeschedule.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of operation performed on the resources. + */ +public final class ResourceOperationType extends ExpandableStringEnum { + /** + * Static value Unknown for ResourceOperationType. + */ + public static final ResourceOperationType UNKNOWN = fromString("Unknown"); + + /** + * Static value Start for ResourceOperationType. + */ + public static final ResourceOperationType START = fromString("Start"); + + /** + * Static value Deallocate for ResourceOperationType. + */ + public static final ResourceOperationType DEALLOCATE = fromString("Deallocate"); + + /** + * Static value Hibernate for ResourceOperationType. + */ + public static final ResourceOperationType HIBERNATE = fromString("Hibernate"); + + /** + * Creates a new instance of ResourceOperationType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ResourceOperationType() { + } + + /** + * Creates or finds a ResourceOperationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceOperationType. + */ + public static ResourceOperationType fromString(String name) { + return fromString(name, ResourceOperationType.class); + } + + /** + * Gets known ResourceOperationType values. + * + * @return known ResourceOperationType values. + */ + public static Collection values() { + return values(ResourceOperationType.class); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/Resources.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/Resources.java new file mode 100644 index 0000000000000..dec59e62140e9 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/Resources.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The resources needed for the user request. + */ +@Fluent +public final class Resources implements JsonSerializable { + /* + * The resource ids used for the request + */ + private List ids; + + /** + * Creates an instance of Resources class. + */ + public Resources() { + } + + /** + * Get the ids property: The resource ids used for the request. + * + * @return the ids value. + */ + public List ids() { + return this.ids; + } + + /** + * Set the ids property: The resource ids used for the request. + * + * @param ids the ids value to set. + * @return the Resources object itself. + */ + public Resources withIds(List ids) { + this.ids = ids; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ids() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property ids in model Resources")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Resources.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("ids", this.ids, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Resources from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Resources if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Resources. + */ + public static Resources fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Resources deserializedResources = new Resources(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ids".equals(fieldName)) { + List ids = reader.readArray(reader1 -> reader1.getString()); + deserializedResources.ids = ids; + } else { + reader.skipChildren(); + } + } + + return deserializedResources; + }); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/RetryPolicy.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/RetryPolicy.java new file mode 100644 index 0000000000000..948b30f5c161a --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/RetryPolicy.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The retry policy for the user request. + */ +@Fluent +public final class RetryPolicy implements JsonSerializable { + /* + * Retry count for user request + */ + private Integer retryCount; + + /* + * Retry window in minutes for user request + */ + private Integer retryWindowInMinutes; + + /** + * Creates an instance of RetryPolicy class. + */ + public RetryPolicy() { + } + + /** + * Get the retryCount property: Retry count for user request. + * + * @return the retryCount value. + */ + public Integer retryCount() { + return this.retryCount; + } + + /** + * Set the retryCount property: Retry count for user request. + * + * @param retryCount the retryCount value to set. + * @return the RetryPolicy object itself. + */ + public RetryPolicy withRetryCount(Integer retryCount) { + this.retryCount = retryCount; + return this; + } + + /** + * Get the retryWindowInMinutes property: Retry window in minutes for user request. + * + * @return the retryWindowInMinutes value. + */ + public Integer retryWindowInMinutes() { + return this.retryWindowInMinutes; + } + + /** + * Set the retryWindowInMinutes property: Retry window in minutes for user request. + * + * @param retryWindowInMinutes the retryWindowInMinutes value to set. + * @return the RetryPolicy object itself. + */ + public RetryPolicy withRetryWindowInMinutes(Integer retryWindowInMinutes) { + this.retryWindowInMinutes = retryWindowInMinutes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("retryCount", this.retryCount); + jsonWriter.writeNumberField("retryWindowInMinutes", this.retryWindowInMinutes); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RetryPolicy from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RetryPolicy if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the RetryPolicy. + */ + public static RetryPolicy fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RetryPolicy deserializedRetryPolicy = new RetryPolicy(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("retryCount".equals(fieldName)) { + deserializedRetryPolicy.retryCount = reader.getNullable(JsonReader::getInt); + } else if ("retryWindowInMinutes".equals(fieldName)) { + deserializedRetryPolicy.retryWindowInMinutes = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedRetryPolicy; + }); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/Schedule.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/Schedule.java new file mode 100644 index 0000000000000..2485647dc1585 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/Schedule.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * The schedule details for the user request. + */ +@Fluent +public final class Schedule implements JsonSerializable { + /* + * The deadline for the operation + */ + private OffsetDateTime deadLine; + + /* + * The timezone for the operation + */ + private String timeZone; + + /* + * The deadlinetype of the operation, this can either be InitiateAt or CompleteBy + */ + private DeadlineType deadlineType; + + /** + * Creates an instance of Schedule class. + */ + public Schedule() { + } + + /** + * Get the deadLine property: The deadline for the operation. + * + * @return the deadLine value. + */ + public OffsetDateTime deadLine() { + return this.deadLine; + } + + /** + * Set the deadLine property: The deadline for the operation. + * + * @param deadLine the deadLine value to set. + * @return the Schedule object itself. + */ + public Schedule withDeadLine(OffsetDateTime deadLine) { + this.deadLine = deadLine; + return this; + } + + /** + * Get the timeZone property: The timezone for the operation. + * + * @return the timeZone value. + */ + public String timeZone() { + return this.timeZone; + } + + /** + * Set the timeZone property: The timezone for the operation. + * + * @param timeZone the timeZone value to set. + * @return the Schedule object itself. + */ + public Schedule withTimeZone(String timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + * Get the deadlineType property: The deadlinetype of the operation, this can either be InitiateAt or CompleteBy. + * + * @return the deadlineType value. + */ + public DeadlineType deadlineType() { + return this.deadlineType; + } + + /** + * Set the deadlineType property: The deadlinetype of the operation, this can either be InitiateAt or CompleteBy. + * + * @param deadlineType the deadlineType value to set. + * @return the Schedule object itself. + */ + public Schedule withDeadlineType(DeadlineType deadlineType) { + this.deadlineType = deadlineType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (deadLine() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property deadLine in model Schedule")); + } + if (timeZone() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property timeZone in model Schedule")); + } + if (deadlineType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property deadlineType in model Schedule")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Schedule.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("deadLine", + this.deadLine == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.deadLine)); + jsonWriter.writeStringField("timeZone", this.timeZone); + jsonWriter.writeStringField("deadlineType", this.deadlineType == null ? null : this.deadlineType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Schedule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Schedule if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Schedule. + */ + public static Schedule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Schedule deserializedSchedule = new Schedule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("deadLine".equals(fieldName)) { + deserializedSchedule.deadLine = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("timeZone".equals(fieldName)) { + deserializedSchedule.timeZone = reader.getString(); + } else if ("deadlineType".equals(fieldName)) { + deserializedSchedule.deadlineType = DeadlineType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSchedule; + }); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ScheduledActions.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ScheduledActions.java new file mode 100644 index 0000000000000..35ec26ad22c42 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/ScheduledActions.java @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of ScheduledActions. + */ +public interface ScheduledActions { + /** + * virtualMachinesCancelOperations: cancelOperations for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is the response from a cancel operations request along with {@link Response}. + */ + Response virtualMachinesCancelOperationsWithResponse(String locationparameter, + CancelOperationsRequest requestBody, Context context); + + /** + * virtualMachinesCancelOperations: cancelOperations for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is the response from a cancel operations request. + */ + CancelOperationsResponse virtualMachinesCancelOperations(String locationparameter, + CancelOperationsRequest requestBody); + + /** + * virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a deallocate request along with {@link Response}. + */ + Response virtualMachinesExecuteDeallocateWithResponse(String locationparameter, + ExecuteDeallocateRequest requestBody, Context context); + + /** + * virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a deallocate request. + */ + DeallocateResourceOperationResponse virtualMachinesExecuteDeallocate(String locationparameter, + ExecuteDeallocateRequest requestBody); + + /** + * virtualMachinesExecuteHibernate: executeHibernate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a Hibernate request along with {@link Response}. + */ + Response virtualMachinesExecuteHibernateWithResponse(String locationparameter, + ExecuteHibernateRequest requestBody, Context context); + + /** + * virtualMachinesExecuteHibernate: executeHibernate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a Hibernate request. + */ + HibernateResourceOperationResponse virtualMachinesExecuteHibernate(String locationparameter, + ExecuteHibernateRequest requestBody); + + /** + * virtualMachinesExecuteStart: executeStart for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a start request along with {@link Response}. + */ + Response virtualMachinesExecuteStartWithResponse(String locationparameter, + ExecuteStartRequest requestBody, Context context); + + /** + * virtualMachinesExecuteStart: executeStart for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a start request. + */ + StartResourceOperationResponse virtualMachinesExecuteStart(String locationparameter, + ExecuteStartRequest requestBody); + + /** + * virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is the response from a get operations status request along with {@link Response}. + */ + Response virtualMachinesGetOperationStatusWithResponse(String locationparameter, + GetOperationStatusRequest requestBody, Context context); + + /** + * virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return this is the response from a get operations status request. + */ + GetOperationStatusResponse virtualMachinesGetOperationStatus(String locationparameter, + GetOperationStatusRequest requestBody); + + /** + * virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a deallocate request along with {@link Response}. + */ + Response virtualMachinesSubmitDeallocateWithResponse(String locationparameter, + SubmitDeallocateRequest requestBody, Context context); + + /** + * virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a deallocate request. + */ + DeallocateResourceOperationResponse virtualMachinesSubmitDeallocate(String locationparameter, + SubmitDeallocateRequest requestBody); + + /** + * virtualMachinesSubmitHibernate: submitHibernate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a Hibernate request along with {@link Response}. + */ + Response virtualMachinesSubmitHibernateWithResponse(String locationparameter, + SubmitHibernateRequest requestBody, Context context); + + /** + * virtualMachinesSubmitHibernate: submitHibernate for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a Hibernate request. + */ + HibernateResourceOperationResponse virtualMachinesSubmitHibernate(String locationparameter, + SubmitHibernateRequest requestBody); + + /** + * virtualMachinesSubmitStart: submitStart for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a start request along with {@link Response}. + */ + Response virtualMachinesSubmitStartWithResponse(String locationparameter, + SubmitStartRequest requestBody, Context context); + + /** + * virtualMachinesSubmitStart: submitStart for a virtual machine. + * + * @param locationparameter The location name. + * @param requestBody The request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 from a start request. + */ + StartResourceOperationResponse virtualMachinesSubmitStart(String locationparameter, SubmitStartRequest requestBody); +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/StartResourceOperationResponse.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/StartResourceOperationResponse.java new file mode 100644 index 0000000000000..fcdf5b5927d39 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/StartResourceOperationResponse.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.computeschedule.models; + +import com.azure.resourcemanager.computeschedule.fluent.models.StartResourceOperationResponseInner; +import java.util.List; + +/** + * An immutable client-side representation of StartResourceOperationResponse. + */ +public interface StartResourceOperationResponse { + /** + * Gets the description property: The description of the operation response. + * + * @return the description value. + */ + String description(); + + /** + * Gets the type property: The type of resources used in the start request eg virtual machines. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The location of the start request eg westus. + * + * @return the location value. + */ + String location(); + + /** + * Gets the results property: The results from the start request if no errors exist. + * + * @return the results value. + */ + List results(); + + /** + * Gets the inner com.azure.resourcemanager.computeschedule.fluent.models.StartResourceOperationResponseInner + * object. + * + * @return the inner object. + */ + StartResourceOperationResponseInner innerModel(); +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/SubmitDeallocateRequest.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/SubmitDeallocateRequest.java new file mode 100644 index 0000000000000..45a6b6e53fb4b --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/SubmitDeallocateRequest.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The deallocate request for resources. + */ +@Fluent +public final class SubmitDeallocateRequest implements JsonSerializable { + /* + * The schedule for the request + */ + private Schedule schedule; + + /* + * The execution parameters for the request + */ + private ExecutionParameters executionParameters; + + /* + * The resources for the request + */ + private Resources resources; + + /* + * Correlationid item + */ + private String correlationid; + + /** + * Creates an instance of SubmitDeallocateRequest class. + */ + public SubmitDeallocateRequest() { + } + + /** + * Get the schedule property: The schedule for the request. + * + * @return the schedule value. + */ + public Schedule schedule() { + return this.schedule; + } + + /** + * Set the schedule property: The schedule for the request. + * + * @param schedule the schedule value to set. + * @return the SubmitDeallocateRequest object itself. + */ + public SubmitDeallocateRequest withSchedule(Schedule schedule) { + this.schedule = schedule; + return this; + } + + /** + * Get the executionParameters property: The execution parameters for the request. + * + * @return the executionParameters value. + */ + public ExecutionParameters executionParameters() { + return this.executionParameters; + } + + /** + * Set the executionParameters property: The execution parameters for the request. + * + * @param executionParameters the executionParameters value to set. + * @return the SubmitDeallocateRequest object itself. + */ + public SubmitDeallocateRequest withExecutionParameters(ExecutionParameters executionParameters) { + this.executionParameters = executionParameters; + return this; + } + + /** + * Get the resources property: The resources for the request. + * + * @return the resources value. + */ + public Resources resources() { + return this.resources; + } + + /** + * Set the resources property: The resources for the request. + * + * @param resources the resources value to set. + * @return the SubmitDeallocateRequest object itself. + */ + public SubmitDeallocateRequest withResources(Resources resources) { + this.resources = resources; + return this; + } + + /** + * Get the correlationid property: Correlationid item. + * + * @return the correlationid value. + */ + public String correlationid() { + return this.correlationid; + } + + /** + * Set the correlationid property: Correlationid item. + * + * @param correlationid the correlationid value to set. + * @return the SubmitDeallocateRequest object itself. + */ + public SubmitDeallocateRequest withCorrelationid(String correlationid) { + this.correlationid = correlationid; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (schedule() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property schedule in model SubmitDeallocateRequest")); + } else { + schedule().validate(); + } + if (executionParameters() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property executionParameters in model SubmitDeallocateRequest")); + } else { + executionParameters().validate(); + } + if (resources() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property resources in model SubmitDeallocateRequest")); + } else { + resources().validate(); + } + if (correlationid() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property correlationid in model SubmitDeallocateRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SubmitDeallocateRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("schedule", this.schedule); + jsonWriter.writeJsonField("executionParameters", this.executionParameters); + jsonWriter.writeJsonField("resources", this.resources); + jsonWriter.writeStringField("correlationid", this.correlationid); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubmitDeallocateRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubmitDeallocateRequest if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SubmitDeallocateRequest. + */ + public static SubmitDeallocateRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SubmitDeallocateRequest deserializedSubmitDeallocateRequest = new SubmitDeallocateRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("schedule".equals(fieldName)) { + deserializedSubmitDeallocateRequest.schedule = Schedule.fromJson(reader); + } else if ("executionParameters".equals(fieldName)) { + deserializedSubmitDeallocateRequest.executionParameters = ExecutionParameters.fromJson(reader); + } else if ("resources".equals(fieldName)) { + deserializedSubmitDeallocateRequest.resources = Resources.fromJson(reader); + } else if ("correlationid".equals(fieldName)) { + deserializedSubmitDeallocateRequest.correlationid = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSubmitDeallocateRequest; + }); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/SubmitHibernateRequest.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/SubmitHibernateRequest.java new file mode 100644 index 0000000000000..832479ccf9457 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/SubmitHibernateRequest.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * This is the request for hibernate. + */ +@Fluent +public final class SubmitHibernateRequest implements JsonSerializable { + /* + * The schedule for the request + */ + private Schedule schedule; + + /* + * The execution parameters for the request + */ + private ExecutionParameters executionParameters; + + /* + * The resources for the request + */ + private Resources resources; + + /* + * Correlationid item + */ + private String correlationid; + + /** + * Creates an instance of SubmitHibernateRequest class. + */ + public SubmitHibernateRequest() { + } + + /** + * Get the schedule property: The schedule for the request. + * + * @return the schedule value. + */ + public Schedule schedule() { + return this.schedule; + } + + /** + * Set the schedule property: The schedule for the request. + * + * @param schedule the schedule value to set. + * @return the SubmitHibernateRequest object itself. + */ + public SubmitHibernateRequest withSchedule(Schedule schedule) { + this.schedule = schedule; + return this; + } + + /** + * Get the executionParameters property: The execution parameters for the request. + * + * @return the executionParameters value. + */ + public ExecutionParameters executionParameters() { + return this.executionParameters; + } + + /** + * Set the executionParameters property: The execution parameters for the request. + * + * @param executionParameters the executionParameters value to set. + * @return the SubmitHibernateRequest object itself. + */ + public SubmitHibernateRequest withExecutionParameters(ExecutionParameters executionParameters) { + this.executionParameters = executionParameters; + return this; + } + + /** + * Get the resources property: The resources for the request. + * + * @return the resources value. + */ + public Resources resources() { + return this.resources; + } + + /** + * Set the resources property: The resources for the request. + * + * @param resources the resources value to set. + * @return the SubmitHibernateRequest object itself. + */ + public SubmitHibernateRequest withResources(Resources resources) { + this.resources = resources; + return this; + } + + /** + * Get the correlationid property: Correlationid item. + * + * @return the correlationid value. + */ + public String correlationid() { + return this.correlationid; + } + + /** + * Set the correlationid property: Correlationid item. + * + * @param correlationid the correlationid value to set. + * @return the SubmitHibernateRequest object itself. + */ + public SubmitHibernateRequest withCorrelationid(String correlationid) { + this.correlationid = correlationid; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (schedule() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property schedule in model SubmitHibernateRequest")); + } else { + schedule().validate(); + } + if (executionParameters() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property executionParameters in model SubmitHibernateRequest")); + } else { + executionParameters().validate(); + } + if (resources() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property resources in model SubmitHibernateRequest")); + } else { + resources().validate(); + } + if (correlationid() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property correlationid in model SubmitHibernateRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SubmitHibernateRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("schedule", this.schedule); + jsonWriter.writeJsonField("executionParameters", this.executionParameters); + jsonWriter.writeJsonField("resources", this.resources); + jsonWriter.writeStringField("correlationid", this.correlationid); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubmitHibernateRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubmitHibernateRequest if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SubmitHibernateRequest. + */ + public static SubmitHibernateRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SubmitHibernateRequest deserializedSubmitHibernateRequest = new SubmitHibernateRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("schedule".equals(fieldName)) { + deserializedSubmitHibernateRequest.schedule = Schedule.fromJson(reader); + } else if ("executionParameters".equals(fieldName)) { + deserializedSubmitHibernateRequest.executionParameters = ExecutionParameters.fromJson(reader); + } else if ("resources".equals(fieldName)) { + deserializedSubmitHibernateRequest.resources = Resources.fromJson(reader); + } else if ("correlationid".equals(fieldName)) { + deserializedSubmitHibernateRequest.correlationid = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSubmitHibernateRequest; + }); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/SubmitStartRequest.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/SubmitStartRequest.java new file mode 100644 index 0000000000000..d79ba290a2f46 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/SubmitStartRequest.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * This is the request for start. + */ +@Fluent +public final class SubmitStartRequest implements JsonSerializable { + /* + * The schedule for the request + */ + private Schedule schedule; + + /* + * The execution parameters for the request + */ + private ExecutionParameters executionParameters; + + /* + * The resources for the request + */ + private Resources resources; + + /* + * Correlationid item + */ + private String correlationid; + + /** + * Creates an instance of SubmitStartRequest class. + */ + public SubmitStartRequest() { + } + + /** + * Get the schedule property: The schedule for the request. + * + * @return the schedule value. + */ + public Schedule schedule() { + return this.schedule; + } + + /** + * Set the schedule property: The schedule for the request. + * + * @param schedule the schedule value to set. + * @return the SubmitStartRequest object itself. + */ + public SubmitStartRequest withSchedule(Schedule schedule) { + this.schedule = schedule; + return this; + } + + /** + * Get the executionParameters property: The execution parameters for the request. + * + * @return the executionParameters value. + */ + public ExecutionParameters executionParameters() { + return this.executionParameters; + } + + /** + * Set the executionParameters property: The execution parameters for the request. + * + * @param executionParameters the executionParameters value to set. + * @return the SubmitStartRequest object itself. + */ + public SubmitStartRequest withExecutionParameters(ExecutionParameters executionParameters) { + this.executionParameters = executionParameters; + return this; + } + + /** + * Get the resources property: The resources for the request. + * + * @return the resources value. + */ + public Resources resources() { + return this.resources; + } + + /** + * Set the resources property: The resources for the request. + * + * @param resources the resources value to set. + * @return the SubmitStartRequest object itself. + */ + public SubmitStartRequest withResources(Resources resources) { + this.resources = resources; + return this; + } + + /** + * Get the correlationid property: Correlationid item. + * + * @return the correlationid value. + */ + public String correlationid() { + return this.correlationid; + } + + /** + * Set the correlationid property: Correlationid item. + * + * @param correlationid the correlationid value to set. + * @return the SubmitStartRequest object itself. + */ + public SubmitStartRequest withCorrelationid(String correlationid) { + this.correlationid = correlationid; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (schedule() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property schedule in model SubmitStartRequest")); + } else { + schedule().validate(); + } + if (executionParameters() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property executionParameters in model SubmitStartRequest")); + } else { + executionParameters().validate(); + } + if (resources() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property resources in model SubmitStartRequest")); + } else { + resources().validate(); + } + if (correlationid() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property correlationid in model SubmitStartRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SubmitStartRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("schedule", this.schedule); + jsonWriter.writeJsonField("executionParameters", this.executionParameters); + jsonWriter.writeJsonField("resources", this.resources); + jsonWriter.writeStringField("correlationid", this.correlationid); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubmitStartRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubmitStartRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SubmitStartRequest. + */ + public static SubmitStartRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SubmitStartRequest deserializedSubmitStartRequest = new SubmitStartRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("schedule".equals(fieldName)) { + deserializedSubmitStartRequest.schedule = Schedule.fromJson(reader); + } else if ("executionParameters".equals(fieldName)) { + deserializedSubmitStartRequest.executionParameters = ExecutionParameters.fromJson(reader); + } else if ("resources".equals(fieldName)) { + deserializedSubmitStartRequest.resources = Resources.fromJson(reader); + } else if ("correlationid".equals(fieldName)) { + deserializedSubmitStartRequest.correlationid = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSubmitStartRequest; + }); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/package-info.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/package-info.java new file mode 100644 index 0000000000000..284ad79320574 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for MicrosoftComputeScheduleForTesting. + * Microsoft.ComputeSchedule Resource Provider management API. + */ +package com.azure.resourcemanager.computeschedule.models; diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/package-info.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/package-info.java new file mode 100644 index 0000000000000..9275f4163eda2 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for MicrosoftComputeScheduleForTesting. + * Microsoft.ComputeSchedule Resource Provider management API. + */ +package com.azure.resourcemanager.computeschedule; diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/module-info.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/module-info.java new file mode 100644 index 0000000000000..b820836f70e9a --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/module-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.computeschedule { + requires transitive com.azure.core.management; + exports com.azure.resourcemanager.computeschedule; + exports com.azure.resourcemanager.computeschedule.fluent; + exports com.azure.resourcemanager.computeschedule.fluent.models; + exports com.azure.resourcemanager.computeschedule.models; + opens com.azure.resourcemanager.computeschedule.fluent.models to com.azure.core; + opens com.azure.resourcemanager.computeschedule.models to com.azure.core; +} \ No newline at end of file diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-computeschedule/proxy-config.json b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-computeschedule/proxy-config.json new file mode 100644 index 0000000000000..56118b9e4435a --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-computeschedule/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.computeschedule.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.computeschedule.implementation.ScheduledActionsClientImpl$ScheduledActionsService"]] \ No newline at end of file diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-computeschedule/reflect-config.json b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-computeschedule/reflect-config.json new file mode 100644 index 0000000000000..0637a088a01e8 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-computeschedule/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/OperationsListSamples.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..58853da493712 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/OperationsListSamples.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.computeschedule.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * Operations_List_MinimumSet_Gen.json + */ + /** + * Sample code: Operations_ListMax - generated by [MinimumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void operationsListMaxGeneratedByMinimumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_ListMax - generated by [MaximumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void operationsListMaxGeneratedByMaximumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesCancelOperationsSamples.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesCancelOperationsSamples.java new file mode 100644 index 0000000000000..4055f4d7a3d80 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesCancelOperationsSamples.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.computeschedule.generated; + +import com.azure.resourcemanager.computeschedule.models.CancelOperationsRequest; +import java.util.Arrays; + +/** + * Samples for ScheduledActions VirtualMachinesCancelOperations. + */ +public final class ScheduledActionsVirtualMachinesCancelOperationsSamples { + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesCancelOperations_MaximumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesCancelOperations - generated by [MaximumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesCancelOperationsGeneratedByMaximumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesCancelOperationsWithResponse("juzzyocyywfxwakqmgahb", + new CancelOperationsRequest().withOperationIds(Arrays.asList("23480d2f-1dca-4610-afb4-dd25eec1f34r")) + .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eec1f3c1"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesCancelOperations_MinimumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesCancelOperations - generated by [MinimumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesCancelOperationsGeneratedByMinimumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesCancelOperationsWithResponse("lzrfledwkzrp", + new CancelOperationsRequest().withOperationIds(Arrays.asList("01080d2f-1dca-4610-afb4-dd25eec1f3df")) + .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eec1f3c1"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesExecuteDeallocateSamples.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesExecuteDeallocateSamples.java new file mode 100644 index 0000000000000..e465ca2dd9663 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesExecuteDeallocateSamples.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.generated; + +import com.azure.resourcemanager.computeschedule.models.ExecuteDeallocateRequest; +import com.azure.resourcemanager.computeschedule.models.ExecutionParameters; +import com.azure.resourcemanager.computeschedule.models.OptimizationPreference; +import com.azure.resourcemanager.computeschedule.models.Resources; +import com.azure.resourcemanager.computeschedule.models.RetryPolicy; +import java.util.Arrays; + +/** + * Samples for ScheduledActions VirtualMachinesExecuteDeallocate. + */ +public final class ScheduledActionsVirtualMachinesExecuteDeallocateSamples { + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesExecuteDeallocate_MaximumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesExecuteDeallocate - generated by [MaximumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesExecuteDeallocateGeneratedByMaximumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesExecuteDeallocateWithResponse("dspazcfydfdhxer", new ExecuteDeallocateRequest() + .withExecutionParameters( + new ExecutionParameters().withOptimizationPreference(OptimizationPreference.COST) + .withRetryPolicy(new RetryPolicy().withRetryCount(30).withRetryWindowInMinutes(27))) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2"))) + .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eddf1f3c1"), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesExecuteDeallocate_MinimumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesExecuteDeallocate - generated by [MinimumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesExecuteDeallocateGeneratedByMinimumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesExecuteDeallocateWithResponse("zanmxbtvfqzqqtywqtnslqxfk", new ExecuteDeallocateRequest() + .withExecutionParameters(new ExecutionParameters()) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2"))) + .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eec1f3c1"), com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesExecuteHibernateSamples.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesExecuteHibernateSamples.java new file mode 100644 index 0000000000000..d3b706d80673d --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesExecuteHibernateSamples.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.generated; + +import com.azure.resourcemanager.computeschedule.models.ExecuteHibernateRequest; +import com.azure.resourcemanager.computeschedule.models.ExecutionParameters; +import com.azure.resourcemanager.computeschedule.models.OptimizationPreference; +import com.azure.resourcemanager.computeschedule.models.Resources; +import com.azure.resourcemanager.computeschedule.models.RetryPolicy; +import java.util.Arrays; + +/** + * Samples for ScheduledActions VirtualMachinesExecuteHibernate. + */ +public final class ScheduledActionsVirtualMachinesExecuteHibernateSamples { + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesExecuteHibernate_MinimumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesExecuteHibernate - generated by [MinimumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesExecuteHibernateGeneratedByMinimumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesExecuteHibernateWithResponse("oowpasegipasucmq", new ExecuteHibernateRequest() + .withExecutionParameters(new ExecutionParameters()) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"))) + .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eec1f3c1"), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesExecuteHibernate_MaximumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesExecuteHibernate - generated by [MaximumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesExecuteHibernateGeneratedByMaximumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesExecuteHibernateWithResponse("az", new ExecuteHibernateRequest() + .withExecutionParameters( + new ExecutionParameters().withOptimizationPreference(OptimizationPreference.COST) + .withRetryPolicy(new RetryPolicy().withRetryCount(30).withRetryWindowInMinutes(27))) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"))) + .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eec1f3c1"), com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesExecuteStartSamples.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesExecuteStartSamples.java new file mode 100644 index 0000000000000..83e2a0c18f625 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesExecuteStartSamples.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.generated; + +import com.azure.resourcemanager.computeschedule.models.ExecuteStartRequest; +import com.azure.resourcemanager.computeschedule.models.ExecutionParameters; +import com.azure.resourcemanager.computeschedule.models.OptimizationPreference; +import com.azure.resourcemanager.computeschedule.models.Resources; +import com.azure.resourcemanager.computeschedule.models.RetryPolicy; +import java.util.Arrays; + +/** + * Samples for ScheduledActions VirtualMachinesExecuteStart. + */ +public final class ScheduledActionsVirtualMachinesExecuteStartSamples { + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesExecuteStart_MaximumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesExecuteStart - generated by [MaximumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesExecuteStartGeneratedByMaximumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesExecuteStartWithResponse("cwkjesffxrcxaxbnvqumkjbbymwlpe", new ExecuteStartRequest() + .withExecutionParameters( + new ExecutionParameters().withOptimizationPreference(OptimizationPreference.COST) + .withRetryPolicy(new RetryPolicy().withRetryCount(30).withRetryWindowInMinutes(27))) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4"))) + .withCorrelationid("23230d2f-1dca-4610-afb4-dd25eec1f34"), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesExecuteStart_MinimumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesExecuteStart - generated by [MinimumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesExecuteStartGeneratedByMinimumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesExecuteStartWithResponse("puguskuewwqfrdkmwrnzb", new ExecuteStartRequest() + .withExecutionParameters(new ExecutionParameters()) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4"))) + .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eec1f3c1"), com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesGetOperationStatusSamples.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesGetOperationStatusSamples.java new file mode 100644 index 0000000000000..fce9e66301b9d --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesGetOperationStatusSamples.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.computeschedule.generated; + +import com.azure.resourcemanager.computeschedule.models.GetOperationStatusRequest; +import java.util.Arrays; + +/** + * Samples for ScheduledActions VirtualMachinesGetOperationStatus. + */ +public final class ScheduledActionsVirtualMachinesGetOperationStatusSamples { + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesGetOperationStatus_MinimumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesGetOperationStatus - generated by [MinimumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesGetOperationStatusGeneratedByMinimumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesGetOperationStatusWithResponse("csay", + new GetOperationStatusRequest().withOperationIds(Arrays.asList("01080d2f-1dca-4610-afb4-dd25eec1f3df")) + .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eec1f3c1"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesGetOperationStatus_MaximumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesGetOperationStatus - generated by [MaximumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesGetOperationStatusGeneratedByMaximumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesGetOperationStatusWithResponse("lfmx", + new GetOperationStatusRequest().withOperationIds(Arrays.asList("23480d2f-1dca-4610-afb4-dd25eec1f34")) + .withCorrelationid("23519o2f-1dca-4610-afb4-dd25eec1f34"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesSubmitDeallocateSamples.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesSubmitDeallocateSamples.java new file mode 100644 index 0000000000000..44513c9cf73cd --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesSubmitDeallocateSamples.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.generated; + +import com.azure.resourcemanager.computeschedule.models.DeadlineType; +import com.azure.resourcemanager.computeschedule.models.ExecutionParameters; +import com.azure.resourcemanager.computeschedule.models.OptimizationPreference; +import com.azure.resourcemanager.computeschedule.models.Resources; +import com.azure.resourcemanager.computeschedule.models.RetryPolicy; +import com.azure.resourcemanager.computeschedule.models.Schedule; +import com.azure.resourcemanager.computeschedule.models.SubmitDeallocateRequest; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for ScheduledActions VirtualMachinesSubmitDeallocate. + */ +public final class ScheduledActionsVirtualMachinesSubmitDeallocateSamples { + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesSubmitDeallocate_MaximumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesSubmitDeallocate - generated by [MaximumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesSubmitDeallocateGeneratedByMaximumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesSubmitDeallocateWithResponse("nynqafujbcjyrtqve", new SubmitDeallocateRequest() + .withSchedule(new Schedule().withDeadLine(OffsetDateTime.parse("2024-07-12T18:06:53.361Z")) + .withTimeZone("zlcujrtgxtgyik") + .withDeadlineType(DeadlineType.UNKNOWN)) + .withExecutionParameters( + new ExecutionParameters().withOptimizationPreference(OptimizationPreference.COST) + .withRetryPolicy(new RetryPolicy().withRetryCount(30).withRetryWindowInMinutes(27))) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2"))) + .withCorrelationid("23519o2f-1dca-4610-afb4-dd25eec1f34"), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesSubmitDeallocate_MinimumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesSubmitDeallocate - generated by [MinimumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesSubmitDeallocateGeneratedByMinimumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesSubmitDeallocateWithResponse("gfuns", new SubmitDeallocateRequest() + .withSchedule(new Schedule().withDeadLine(OffsetDateTime.parse("2024-07-12T18:06:53.361Z")) + .withTimeZone("zlcujrtgxtgyik") + .withDeadlineType(DeadlineType.UNKNOWN)) + .withExecutionParameters(new ExecutionParameters()) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource2"))) + .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eec1f3c1"), com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesSubmitHibernateSamples.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesSubmitHibernateSamples.java new file mode 100644 index 0000000000000..bd24089f8f04b --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesSubmitHibernateSamples.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.generated; + +import com.azure.resourcemanager.computeschedule.models.DeadlineType; +import com.azure.resourcemanager.computeschedule.models.ExecutionParameters; +import com.azure.resourcemanager.computeschedule.models.OptimizationPreference; +import com.azure.resourcemanager.computeschedule.models.Resources; +import com.azure.resourcemanager.computeschedule.models.RetryPolicy; +import com.azure.resourcemanager.computeschedule.models.Schedule; +import com.azure.resourcemanager.computeschedule.models.SubmitHibernateRequest; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for ScheduledActions VirtualMachinesSubmitHibernate. + */ +public final class ScheduledActionsVirtualMachinesSubmitHibernateSamples { + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesSubmitHibernate_MaximumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesSubmitHibernate - generated by [MaximumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesSubmitHibernateGeneratedByMaximumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesSubmitHibernateWithResponse("jrulwh", new SubmitHibernateRequest() + .withSchedule(new Schedule().withDeadLine(OffsetDateTime.parse("2024-07-12T18:06:53.361Z")) + .withTimeZone("zlcujrtgxtgyik") + .withDeadlineType(DeadlineType.UNKNOWN)) + .withExecutionParameters( + new ExecutionParameters().withOptimizationPreference(OptimizationPreference.COST) + .withRetryPolicy(new RetryPolicy().withRetryCount(30).withRetryWindowInMinutes(27))) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"))) + .withCorrelationid("23519o2f-1dca-4610-afb4-dd25eec1f34"), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesSubmitHibernate_MinimumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesSubmitHibernate - generated by [MinimumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesSubmitHibernateGeneratedByMinimumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesSubmitHibernateWithResponse("pgedjeucp", new SubmitHibernateRequest() + .withSchedule(new Schedule().withDeadLine(OffsetDateTime.parse("2024-07-12T18:06:53.361Z")) + .withTimeZone("zlcujrtgxtgyik") + .withDeadlineType(DeadlineType.UNKNOWN)) + .withExecutionParameters(new ExecutionParameters()) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"))) + .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eec1f3c1"), com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesSubmitStartSamples.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesSubmitStartSamples.java new file mode 100644 index 0000000000000..f71ffc4ad85c7 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/samples/java/com/azure/resourcemanager/computeschedule/generated/ScheduledActionsVirtualMachinesSubmitStartSamples.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.computeschedule.generated; + +import com.azure.resourcemanager.computeschedule.models.DeadlineType; +import com.azure.resourcemanager.computeschedule.models.ExecutionParameters; +import com.azure.resourcemanager.computeschedule.models.OptimizationPreference; +import com.azure.resourcemanager.computeschedule.models.Resources; +import com.azure.resourcemanager.computeschedule.models.RetryPolicy; +import com.azure.resourcemanager.computeschedule.models.Schedule; +import com.azure.resourcemanager.computeschedule.models.SubmitStartRequest; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for ScheduledActions VirtualMachinesSubmitStart. + */ +public final class ScheduledActionsVirtualMachinesSubmitStartSamples { + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesSubmitStart_MinimumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesSubmitStart - generated by [MinimumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesSubmitStartGeneratedByMinimumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesSubmitStartWithResponse("vkrnfmvxrtbzgeyqmhtney", new SubmitStartRequest() + .withSchedule(new Schedule().withDeadLine(OffsetDateTime.parse("2024-07-12T18:06:53.361Z")) + .withTimeZone("zlcujrtgxtgyik") + .withDeadlineType(DeadlineType.UNKNOWN)) + .withExecutionParameters(new ExecutionParameters()) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4"))) + .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eec1f3c1"), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/preview/2024-06-01-preview/examples/ + * ScheduledActions_VirtualMachinesSubmitStart_MaximumSet_Gen.json + */ + /** + * Sample code: ScheduledActions_VirtualMachinesSubmitStart - generated by [MaximumSet] rule. + * + * @param manager Entry point to ComputescheduleManager. + */ + public static void scheduledActionsVirtualMachinesSubmitStartGeneratedByMaximumSetRule( + com.azure.resourcemanager.computeschedule.ComputescheduleManager manager) { + manager.scheduledActions() + .virtualMachinesSubmitStartWithResponse("pxbvjarpyzhastophdyu", new SubmitStartRequest() + .withSchedule(new Schedule().withDeadLine(OffsetDateTime.parse("2024-07-12T18:06:53.361Z")) + .withTimeZone("zlcujrtgxtgyik") + .withDeadlineType(DeadlineType.UNKNOWN)) + .withExecutionParameters( + new ExecutionParameters().withOptimizationPreference(OptimizationPreference.COST) + .withRetryPolicy(new RetryPolicy().withRetryCount(30).withRetryWindowInMinutes(27))) + .withResources(new Resources().withIds(Arrays.asList( + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource4"))) + .withCorrelationid("23480d2f-1dca-4610-afb4-dd25eec1f34"), com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/computeschedule/ci.yml b/sdk/computeschedule/ci.yml new file mode 100644 index 0000000000000..ff446a8f60c4c --- /dev/null +++ b/sdk/computeschedule/ci.yml @@ -0,0 +1,46 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/computeschedule/ci.yml + - sdk/computeschedule/azure-resourcemanager-computeschedule/ + exclude: + - sdk/computeschedule/pom.xml + - sdk/computeschedule/azure-resourcemanager-computeschedule/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/computeschedule/ci.yml + - sdk/computeschedule/azure-resourcemanager-computeschedule/ + exclude: + - sdk/computeschedule/pom.xml + - sdk/computeschedule/azure-resourcemanager-computeschedule/pom.xml + +parameters: + - name: release_azureresourcemanagercomputeschedule + displayName: azure-resourcemanager-computeschedule + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: computeschedule + Artifacts: + - name: azure-resourcemanager-computeschedule + groupId: com.azure.resourcemanager + safeName: azureresourcemanagercomputeschedule + releaseInBatch: ${{ parameters.release_azureresourcemanagercomputeschedule }} diff --git a/sdk/computeschedule/pom.xml b/sdk/computeschedule/pom.xml new file mode 100644 index 0000000000000..efdbefb7dd204 --- /dev/null +++ b/sdk/computeschedule/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-computeschedule-service + pom + 1.0.0 + + + azure-resourcemanager-computeschedule + +