From 0ef48365a27bb42af4e6f31835f13c3fe9c2dc0e Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Wed, 22 Jan 2025 06:27:32 +0000 Subject: [PATCH 1/4] [Automation] External Change --- eng/versioning/version_client.txt | 2 +- .../CHANGELOG.md | 4 +- .../SAMPLE.md | 373 ++++-------------- .../pom.xml | 13 +- .../ComputeScheduleManager.java | 16 +- .../fluent/ComputeScheduleMgmtClient.java | 62 +++ .../fluent/ScheduledActionsClient.java | 48 ++- .../ComputeScheduleMgmtClientBuilder.java | 138 +++++++ .../ComputeScheduleMgmtClientImpl.java | 304 ++++++++++++++ .../implementation/OperationsClientImpl.java | 10 +- .../ScheduledActionsClientImpl.java | 130 +++--- .../models/CancelOperationsRequest.java | 6 +- .../models/ExecuteDeallocateRequest.java | 6 +- .../models/ExecuteHibernateRequest.java | 6 +- .../models/ExecuteStartRequest.java | 6 +- .../models/GetOperationStatusRequest.java | 6 +- .../models/OperationErrorDetails.java | 58 ++- .../models/OperationState.java | 2 +- .../models/ResourceOperationDetails.java | 46 +-- .../computeschedule/models/Schedule.java | 74 +++- .../models/ScheduledActions.java | 48 ++- .../models/SubmitDeallocateRequest.java | 6 +- .../models/SubmitHibernateRequest.java | 6 +- .../models/SubmitStartRequest.java | 6 +- .../generated/OperationsListSamples.java | 20 +- ...irtualMachinesCancelOperationsSamples.java | 33 +- ...rtualMachinesExecuteDeallocateSamples.java | 42 +- ...irtualMachinesExecuteHibernateSamples.java | 40 +- ...onsVirtualMachinesExecuteStartSamples.java | 38 +- ...tualMachinesGetOperationErrorsSamples.java | 26 +- ...tualMachinesGetOperationStatusSamples.java | 31 +- ...irtualMachinesSubmitDeallocateSamples.java | 51 +-- ...VirtualMachinesSubmitHibernateSamples.java | 45 +-- ...ionsVirtualMachinesSubmitStartSamples.java | 47 +-- .../CancelOperationsRequestTests.java | 14 +- .../ExecuteDeallocateRequestTests.java | 25 +- .../ExecuteHibernateRequestTests.java | 33 +- .../generated/ExecuteStartRequestTests.java | 34 +- .../generated/ExecutionParametersTests.java | 18 +- .../GetOperationErrorsRequestTests.java | 11 +- .../GetOperationStatusRequestTests.java | 17 +- .../generated/OperationInnerTests.java | 3 - .../generated/OperationListResultTests.java | 2 - .../generated/OperationsListMockTests.java | 5 +- .../generated/ResourcesTests.java | 8 +- .../generated/RetryPolicyTests.java | 12 +- .../generated/ScheduleTests.java | 22 +- .../SubmitDeallocateRequestTests.java | 58 +-- .../SubmitHibernateRequestTests.java | 49 +-- .../generated/SubmitStartRequestTests.java | 48 ++- .../tsp-location.yaml | 2 +- 51 files changed, 1158 insertions(+), 952 deletions(-) create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/ComputeScheduleMgmtClient.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ComputeScheduleMgmtClientBuilder.java create mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ComputeScheduleMgmtClientImpl.java diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 1dc0d6dca9718..919ada3e7876f 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -461,7 +461,7 @@ com.azure.resourcemanager:azure-resourcemanager-servicefabricmanagedclusters;1.0 com.azure.resourcemanager:azure-resourcemanager-healthdataaiservices;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-redhatopenshift;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-fabric;1.0.0;1.1.0-beta.1 -com.azure.resourcemanager:azure-resourcemanager-computeschedule;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-computeschedule;1.0.0-beta.1;1.0.0 com.azure.resourcemanager:azure-resourcemanager-trustedsigning;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-iotoperations;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-containerorchestratorruntime;1.0.0-beta.1;1.0.0-beta.2 diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/CHANGELOG.md b/sdk/computeschedule/azure-resourcemanager-computeschedule/CHANGELOG.md index 1a9502d5ccb9d..77001876f3836 100644 --- a/sdk/computeschedule/azure-resourcemanager-computeschedule/CHANGELOG.md +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.1 (2025-01-22) + +- Azure Resource Manager Compute Schedule client library for Java. This package contains Microsoft Azure SDK for Compute Schedule Management SDK. Microsoft.ComputeSchedule Resource Provider management API. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Features Added diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/SAMPLE.md b/sdk/computeschedule/azure-resourcemanager-computeschedule/SAMPLE.md index f8d13e6eeeb33..c2a9848216b90 100644 --- a/sdk/computeschedule/azure-resourcemanager-computeschedule/SAMPLE.md +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/SAMPLE.md @@ -24,28 +24,14 @@ */ public final class OperationsListSamples { /* - * x-ms-original-file: 2024-08-15-preview/Operations_List_MaximumSet_Gen.json + * x-ms-original-file: 2024-10-01/Operations_List.json */ /** - * Sample code: Operations_ListMax - generated by [MaximumSet] rule - generated by [MaximumSet] rule. + * Sample code: Operations_List. * * @param manager Entry point to ComputeScheduleManager. */ - public static void operationsListMaxGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( - com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { - manager.operations().list(com.azure.core.util.Context.NONE); - } - - /* - * x-ms-original-file: 2024-08-15-preview/Operations_List_MinimumSet_Gen.json - */ - /** - * Sample code: Operations_ListMax - generated by [MaximumSet] rule - generated by [MinimumSet] rule. - * - * @param manager Entry point to ComputeScheduleManager. - */ - public static void operationsListMaxGeneratedByMaximumSetRuleGeneratedByMinimumSetRule( - com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { + public static void operationsList(com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { manager.operations().list(com.azure.core.util.Context.NONE); } } @@ -62,40 +48,19 @@ import java.util.Arrays; */ public final class ScheduledActionsVirtualMachinesCancelOperationsSamples { /* - * x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesCancelOperations_MinimumSet_Gen.json + * x-ms-original-file: 2024-10-01/ScheduledActions_VirtualMachinesCancelOperations.json */ /** - * Sample code: ScheduledActions_VirtualMachinesCancelOperations - generated by [MaximumSet] rule - generated by - * [MinimumSet] rule. + * Sample code: ScheduledActions_VirtualMachinesCancelOperations. * * @param manager Entry point to ComputeScheduleManager. */ - public static void - scheduledActionsVirtualMachinesCancelOperationsGeneratedByMaximumSetRuleGeneratedByMinimumSetRule( - com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { - manager.scheduledActions() - .virtualMachinesCancelOperationsWithResponse("lwapkjsbltcqp", - 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: 2024-08-15-preview/ScheduledActions_VirtualMachinesCancelOperations_MaximumSet_Gen.json - */ - /** - * Sample code: ScheduledActions_VirtualMachinesCancelOperations - generated by [MaximumSet] rule - generated by - * [MaximumSet] rule. - * - * @param manager Entry point to ComputeScheduleManager. - */ - public static void - scheduledActionsVirtualMachinesCancelOperationsGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( - com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { + public static void scheduledActionsVirtualMachinesCancelOperations( + com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { manager.scheduledActions() - .virtualMachinesCancelOperationsWithResponse("tdxypnse", + .virtualMachinesCancelOperationsWithResponse("eastus2euap", new CancelOperationsRequest().withOperationIds(Arrays.asList("23480d2f-1dca-4610-afb4-dd25eec1f34r")) - .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eec1f3c1"), + .withCorrelationid("23480d2f-1dca-4610-afb4-gg25eec1f34r"), com.azure.core.util.Context.NONE); } } @@ -106,7 +71,6 @@ public final class ScheduledActionsVirtualMachinesCancelOperationsSamples { ```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; @@ -116,45 +80,22 @@ import java.util.Arrays; */ public final class ScheduledActionsVirtualMachinesExecuteDeallocateSamples { /* - * x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteDeallocate_MaximumSet_Gen.json - */ - /** - * Sample code: ScheduledActions_VirtualMachinesExecuteDeallocate - generated by [MaximumSet] rule - generated by - * [MaximumSet] rule. - * - * @param manager Entry point to ComputeScheduleManager. - */ - public static void - scheduledActionsVirtualMachinesExecuteDeallocateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( - com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { - manager.scheduledActions() - .virtualMachinesExecuteDeallocateWithResponse("mklyzgztbivwzo", 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: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteDeallocate_MinimumSet_Gen.json + * x-ms-original-file: 2024-10-01/ScheduledActions_VirtualMachinesExecuteDeallocate.json */ /** - * Sample code: ScheduledActions_VirtualMachinesExecuteDeallocate - generated by [MaximumSet] rule - generated by - * [MinimumSet] rule. + * Sample code: ScheduledActions_VirtualMachinesExecuteDeallocate. * * @param manager Entry point to ComputeScheduleManager. */ - public static void - scheduledActionsVirtualMachinesExecuteDeallocateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule( - com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { + public static void scheduledActionsVirtualMachinesExecuteDeallocate( + com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { manager.scheduledActions() - .virtualMachinesExecuteDeallocateWithResponse("irbtacrhjgfpyvhvjo", new ExecuteDeallocateRequest() - .withExecutionParameters(new ExecutionParameters()) + .virtualMachinesExecuteDeallocateWithResponse("eastus2euap", new ExecuteDeallocateRequest() + .withExecutionParameters(new ExecutionParameters() + .withRetryPolicy(new RetryPolicy().withRetryCount(4).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); + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"))) + .withCorrelationid("23480d2f-1dca-4610-afb4-dd25eec1f34r"), com.azure.core.util.Context.NONE); } } ``` @@ -164,7 +105,6 @@ public final class ScheduledActionsVirtualMachinesExecuteDeallocateSamples { ```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; @@ -174,45 +114,22 @@ import java.util.Arrays; */ public final class ScheduledActionsVirtualMachinesExecuteHibernateSamples { /* - * x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteHibernate_MinimumSet_Gen.json + * x-ms-original-file: 2024-10-01/ScheduledActions_VirtualMachinesExecuteHibernate.json */ /** - * Sample code: ScheduledActions_VirtualMachinesExecuteHibernate - generated by [MaximumSet] rule - generated by - * [MinimumSet] rule. + * Sample code: ScheduledActions_VirtualMachinesExecuteHibernate. * * @param manager Entry point to ComputeScheduleManager. */ - public static void - scheduledActionsVirtualMachinesExecuteHibernateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule( - com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { - manager.scheduledActions() - .virtualMachinesExecuteHibernateWithResponse("kga", 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: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteHibernate_MaximumSet_Gen.json - */ - /** - * Sample code: ScheduledActions_VirtualMachinesExecuteHibernate - generated by [MaximumSet] rule - generated by - * [MaximumSet] rule. - * - * @param manager Entry point to ComputeScheduleManager. - */ - public static void - scheduledActionsVirtualMachinesExecuteHibernateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( - com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { + public static void scheduledActionsVirtualMachinesExecuteHibernate( + com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { manager.scheduledActions() - .virtualMachinesExecuteHibernateWithResponse("sejdmamuhhvfpljomwumsplc", new ExecuteHibernateRequest() - .withExecutionParameters( - new ExecutionParameters().withOptimizationPreference(OptimizationPreference.COST) - .withRetryPolicy(new RetryPolicy().withRetryCount(30).withRetryWindowInMinutes(27))) + .virtualMachinesExecuteHibernateWithResponse("eastus2euap", new ExecuteHibernateRequest() + .withExecutionParameters(new ExecutionParameters() + .withRetryPolicy(new RetryPolicy().withRetryCount(5).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); + .withCorrelationid("23480d2f-1dca-4610-afb4-dd25eec1f34r"), com.azure.core.util.Context.NONE); } } ``` @@ -222,7 +139,6 @@ public final class ScheduledActionsVirtualMachinesExecuteHibernateSamples { ```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; @@ -232,43 +148,22 @@ import java.util.Arrays; */ public final class ScheduledActionsVirtualMachinesExecuteStartSamples { /* - * x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteStart_MaximumSet_Gen.json - */ - /** - * Sample code: ScheduledActions_VirtualMachinesExecuteStart - generated by [MaximumSet] rule - generated by - * [MaximumSet] rule. - * - * @param manager Entry point to ComputeScheduleManager. - */ - public static void scheduledActionsVirtualMachinesExecuteStartGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( - com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { - manager.scheduledActions() - .virtualMachinesExecuteStartWithResponse("ysfrwcfmfsh", 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: 2024-08-15-preview/ScheduledActions_VirtualMachinesExecuteStart_MinimumSet_Gen.json + * x-ms-original-file: 2024-10-01/ScheduledActions_VirtualMachinesExecuteStart.json */ /** - * Sample code: ScheduledActions_VirtualMachinesExecuteStart - generated by [MaximumSet] rule - generated by - * [MinimumSet] rule. + * Sample code: ScheduledActions_VirtualMachinesExecuteStart. * * @param manager Entry point to ComputeScheduleManager. */ - public static void scheduledActionsVirtualMachinesExecuteStartGeneratedByMaximumSetRuleGeneratedByMinimumSetRule( + public static void scheduledActionsVirtualMachinesExecuteStart( com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { manager.scheduledActions() - .virtualMachinesExecuteStartWithResponse("qegbgjculewswqvnmaclcgpqqidl", new ExecuteStartRequest() - .withExecutionParameters(new ExecutionParameters()) + .virtualMachinesExecuteStartWithResponse("eastus2euap", new ExecuteStartRequest() + .withExecutionParameters(new ExecutionParameters() + .withRetryPolicy(new RetryPolicy().withRetryCount(2).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); + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"))) + .withCorrelationid("23480d2f-1dca-4610-afb4-dd25eec1f34r"), com.azure.core.util.Context.NONE); } } ``` @@ -284,34 +179,18 @@ import java.util.Arrays; */ public final class ScheduledActionsVirtualMachinesGetOperationErrorsSamples { /* - * x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesGetOperationErrors_MinimumSet_Gen.json + * x-ms-original-file: 2024-10-01/ScheduledActions_VirtualMachinesGetOperationErrors.json */ /** - * Sample code: CS_ScheduledActions_VirtualMachinesGetOperationErrors_Min. + * Sample code: ScheduledActions_VirtualMachinesGetOperationErrors. * * @param manager Entry point to ComputeScheduleManager. */ - public static void csScheduledActionsVirtualMachinesGetOperationErrorsMin( + public static void scheduledActionsVirtualMachinesGetOperationErrors( com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { manager.scheduledActions() - .virtualMachinesGetOperationErrorsWithResponse("ggxoaxzxtdbi", - new GetOperationErrorsRequest().withOperationIds(Arrays.asList("qeicik")), - com.azure.core.util.Context.NONE); - } - - /* - * x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesGetOperationErrors_MaximumSet_Gen.json - */ - /** - * Sample code: CS_ScheduledActions_VirtualMachinesGetOperationErrors_Max. - * - * @param manager Entry point to ComputeScheduleManager. - */ - public static void csScheduledActionsVirtualMachinesGetOperationErrorsMax( - com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { - manager.scheduledActions() - .virtualMachinesGetOperationErrorsWithResponse("hfsa", - new GetOperationErrorsRequest().withOperationIds(Arrays.asList("DE84A209-5715-43E7-BC76-3E208A9A323")), + .virtualMachinesGetOperationErrorsWithResponse("eastus2euap", + new GetOperationErrorsRequest().withOperationIds(Arrays.asList("23480d2f-1dca-4610-afb4-dd25eec1f34r")), com.azure.core.util.Context.NONE); } } @@ -328,38 +207,19 @@ import java.util.Arrays; */ public final class ScheduledActionsVirtualMachinesGetOperationStatusSamples { /* - * x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesGetOperationStatus_MinimumSet_Gen.json + * x-ms-original-file: 2024-10-01/ScheduledActions_VirtualMachinesGetOperationStatus.json */ /** - * Sample code: ScheduledActions_VirtualMachinesGetOperationStatus - generated by [MinimumSet] rule. + * Sample code: ScheduledActions_VirtualMachinesGetOperationStatus. * * @param manager Entry point to ComputeScheduleManager. */ - public static void scheduledActionsVirtualMachinesGetOperationStatusGeneratedByMinimumSetRule( + public static void scheduledActionsVirtualMachinesGetOperationStatus( 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: 2024-08-15-preview/ScheduledActions_VirtualMachinesGetOperationStatus_MaximumSet_Gen.json - */ - /** - * Sample code: ScheduledActions_VirtualMachinesGetOperationStatus - generated by [MinimumSet] rule - generated by - * [MaximumSet] rule. - * - * @param manager Entry point to ComputeScheduleManager. - */ - public static void - scheduledActionsVirtualMachinesGetOperationStatusGeneratedByMinimumSetRuleGeneratedByMaximumSetRule( - com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { - manager.scheduledActions() - .virtualMachinesGetOperationStatusWithResponse("htxxasfxaesuecem", - new GetOperationStatusRequest().withOperationIds(Arrays.asList("01080d2f-1dca-4610-afb4-dd25eec1f3df")) - .withCorrelationid("01080d2f-1dca-4610-afb4-dd25eec1f3c1"), + .virtualMachinesGetOperationStatusWithResponse("eastus2euap", + new GetOperationStatusRequest().withOperationIds(Arrays.asList("23480d2f-1dca-4610-afb4-dd25eec1f34r")) + .withCorrelationid("35780d2f-1dca-4610-afb4-dd25eec1f34r"), com.azure.core.util.Context.NONE); } } @@ -370,7 +230,6 @@ public final class ScheduledActionsVirtualMachinesGetOperationStatusSamples { ```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; @@ -383,51 +242,25 @@ import java.util.Arrays; */ public final class ScheduledActionsVirtualMachinesSubmitDeallocateSamples { /* - * x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitDeallocate_MaximumSet_Gen.json - */ - /** - * Sample code: ScheduledActions_VirtualMachinesSubmitDeallocate - generated by [MaximumSet] rule - generated by - * [MaximumSet] rule. - * - * @param manager Entry point to ComputeScheduleManager. - */ - public static void - scheduledActionsVirtualMachinesSubmitDeallocateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( - com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { - manager.scheduledActions() - .virtualMachinesSubmitDeallocateWithResponse("ibfxsvilwrgqttuslbduzdtxcckdet", 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: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitDeallocate_MinimumSet_Gen.json + * x-ms-original-file: 2024-10-01/ScheduledActions_VirtualMachinesSubmitDeallocate.json */ /** - * Sample code: ScheduledActions_VirtualMachinesSubmitDeallocate - generated by [MaximumSet] rule - generated by - * [MinimumSet] rule. + * Sample code: ScheduledActions_VirtualMachinesSubmitDeallocate. * * @param manager Entry point to ComputeScheduleManager. */ - public static void - scheduledActionsVirtualMachinesSubmitDeallocateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule( - com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { + public static void scheduledActionsVirtualMachinesSubmitDeallocate( + com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { manager.scheduledActions() - .virtualMachinesSubmitDeallocateWithResponse("qwfcdtmshnlownbkyh", new SubmitDeallocateRequest() - .withSchedule(new Schedule().withDeadLine(OffsetDateTime.parse("2024-07-12T18:06:53.361Z")) - .withTimeZone("zlcujrtgxtgyik") - .withDeadlineType(DeadlineType.UNKNOWN)) - .withExecutionParameters(new ExecutionParameters()) + .virtualMachinesSubmitDeallocateWithResponse("eastus2euap", new SubmitDeallocateRequest() + .withSchedule(new Schedule().withDeadline(OffsetDateTime.parse("2024-11-01T17:52:54.215Z")) + .withTimezone("UTC") + .withDeadlineType(DeadlineType.INITIATE_AT)) + .withExecutionParameters(new ExecutionParameters() + .withRetryPolicy(new RetryPolicy().withRetryCount(4).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); + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"))) + .withCorrelationid("23480d2f-1dca-4610-afb4-dd25eec1f34r"), com.azure.core.util.Context.NONE); } } ``` @@ -437,7 +270,6 @@ public final class ScheduledActionsVirtualMachinesSubmitDeallocateSamples { ```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; @@ -450,49 +282,25 @@ import java.util.Arrays; */ public final class ScheduledActionsVirtualMachinesSubmitHibernateSamples { /* - * x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitHibernate_MinimumSet_Gen.json + * x-ms-original-file: 2024-10-01/ScheduledActions_VirtualMachinesSubmitHibernate.json */ /** - * Sample code: ScheduledActions_VirtualMachinesSubmitHibernate - generated by [MaximumSet] rule - generated by - * [MinimumSet] rule. + * Sample code: ScheduledActions_VirtualMachinesSubmitHibernate. * * @param manager Entry point to ComputeScheduleManager. */ - public static void scheduledActionsVirtualMachinesSubmitHibernateGeneratedByMaximumSetRuleGeneratedByMinimumSetRule( + public static void scheduledActionsVirtualMachinesSubmitHibernate( com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { manager.scheduledActions() - .virtualMachinesSubmitHibernateWithResponse("fvjciwudfbndlqumcgqs", new SubmitHibernateRequest() - .withSchedule(new Schedule().withDeadLine(OffsetDateTime.parse("2024-07-12T18:06:53.361Z")) - .withTimeZone("zlcujrtgxtgyik") - .withDeadlineType(DeadlineType.UNKNOWN)) - .withExecutionParameters(new ExecutionParameters()) + .virtualMachinesSubmitHibernateWithResponse("eastus2euap", new SubmitHibernateRequest() + .withSchedule(new Schedule().withDeadline(OffsetDateTime.parse("2024-11-01T17:52:54.215Z")) + .withTimezone("UTC") + .withDeadlineType(DeadlineType.INITIATE_AT)) + .withExecutionParameters(new ExecutionParameters() + .withRetryPolicy(new RetryPolicy().withRetryCount(2).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: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitHibernate_MaximumSet_Gen.json - */ - /** - * Sample code: ScheduledActions_VirtualMachinesSubmitHibernate - generated by [MaximumSet] rule - generated by - * [MaximumSet] rule. - * - * @param manager Entry point to ComputeScheduleManager. - */ - public static void scheduledActionsVirtualMachinesSubmitHibernateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( - com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { - manager.scheduledActions() - .virtualMachinesSubmitHibernateWithResponse("bgxeayimbxqzev", 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); + .withCorrelationid("23480d2f-1dca-4610-afb4-dd25eec1f34r"), com.azure.core.util.Context.NONE); } } ``` @@ -502,7 +310,6 @@ public final class ScheduledActionsVirtualMachinesSubmitHibernateSamples { ```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; @@ -515,49 +322,25 @@ import java.util.Arrays; */ public final class ScheduledActionsVirtualMachinesSubmitStartSamples { /* - * x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitStart_MaximumSet_Gen.json - */ - /** - * Sample code: ScheduledActions_VirtualMachinesSubmitStart - generated by [MaximumSet] rule - generated by - * [MaximumSet] rule. - * - * @param manager Entry point to ComputeScheduleManager. - */ - public static void scheduledActionsVirtualMachinesSubmitStartGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( - com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { - manager.scheduledActions() - .virtualMachinesSubmitStartWithResponse("fxiidszhrokwjmewlahfqjiocnes", 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); - } - - /* - * x-ms-original-file: 2024-08-15-preview/ScheduledActions_VirtualMachinesSubmitStart_MinimumSet_Gen.json + * x-ms-original-file: 2024-10-01/ScheduledActions_VirtualMachinesSubmitStart.json */ /** - * Sample code: ScheduledActions_VirtualMachinesSubmitStart - generated by [MaximumSet] rule - generated by - * [MinimumSet] rule. + * Sample code: ScheduledActions_VirtualMachinesSubmitStart. * * @param manager Entry point to ComputeScheduleManager. */ - public static void scheduledActionsVirtualMachinesSubmitStartGeneratedByMaximumSetRuleGeneratedByMinimumSetRule( + public static void scheduledActionsVirtualMachinesSubmitStart( com.azure.resourcemanager.computeschedule.ComputeScheduleManager manager) { manager.scheduledActions() - .virtualMachinesSubmitStartWithResponse("httzei", new SubmitStartRequest() - .withSchedule(new Schedule().withDeadLine(OffsetDateTime.parse("2024-07-12T18:06:53.361Z")) - .withTimeZone("zlcujrtgxtgyik") - .withDeadlineType(DeadlineType.UNKNOWN)) - .withExecutionParameters(new ExecutionParameters()) + .virtualMachinesSubmitStartWithResponse("eastus2euap", new SubmitStartRequest() + .withSchedule(new Schedule().withDeadline(OffsetDateTime.parse("2024-11-01T17:52:54.215Z")) + .withTimezone("UTC") + .withDeadlineType(DeadlineType.INITIATE_AT)) + .withExecutionParameters(new ExecutionParameters() + .withRetryPolicy(new RetryPolicy().withRetryCount(5).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); + "/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"))) + .withCorrelationid("23480d2f-1dca-4610-afb4-dd25eec1f34r"), com.azure.core.util.Context.NONE); } } ``` diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/pom.xml b/sdk/computeschedule/azure-resourcemanager-computeschedule/pom.xml index 7e43f5c307239..5076c3e7d8e4a 100644 --- a/sdk/computeschedule/azure-resourcemanager-computeschedule/pom.xml +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/pom.xml @@ -14,7 +14,7 @@ com.azure.resourcemanager azure-resourcemanager-computeschedule - 1.0.0-beta.2 + 1.0.0-beta.1 jar Microsoft Azure SDK for Compute Schedule Management @@ -46,13 +46,9 @@ 0 0 true + false - - com.azure - azure-json - 1.3.0 - com.azure azure-core @@ -75,5 +71,10 @@ 1.15.0 test + + com.azure + azure-json + 1.3.0 + 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 index 564a621153163..25c3f4eb7a7df 100644 --- 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 @@ -23,8 +23,8 @@ 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.ComputeScheduleClient; -import com.azure.resourcemanager.computeschedule.implementation.ComputeScheduleClientBuilder; +import com.azure.resourcemanager.computeschedule.fluent.ComputeScheduleMgmtClient; +import com.azure.resourcemanager.computeschedule.implementation.ComputeScheduleMgmtClientBuilder; import com.azure.resourcemanager.computeschedule.implementation.OperationsImpl; import com.azure.resourcemanager.computeschedule.implementation.ScheduledActionsImpl; import com.azure.resourcemanager.computeschedule.models.Operations; @@ -45,12 +45,12 @@ public final class ComputeScheduleManager { private ScheduledActions scheduledActions; - private final ComputeScheduleClient clientObject; + private final ComputeScheduleMgmtClient 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 ComputeScheduleClientBuilder().pipeline(httpPipeline) + this.clientObject = new ComputeScheduleMgmtClientBuilder().pipeline(httpPipeline) .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) .subscriptionId(profile.getSubscriptionId()) .defaultPollInterval(defaultPollInterval) @@ -280,12 +280,12 @@ public ScheduledActions scheduledActions() { } /** - * Gets wrapped service client ComputeScheduleClient providing direct access to the underlying auto-generated API - * implementation, based on Azure REST API. + * Gets wrapped service client ComputeScheduleMgmtClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. * - * @return Wrapped service client ComputeScheduleClient. + * @return Wrapped service client ComputeScheduleMgmtClient. */ - public ComputeScheduleClient serviceClient() { + public ComputeScheduleMgmtClient serviceClient() { return this.clientObject; } } diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/ComputeScheduleMgmtClient.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/ComputeScheduleMgmtClient.java new file mode 100644 index 0000000000000..d42ac61bf6442 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/ComputeScheduleMgmtClient.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.computeschedule.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for ComputeScheduleMgmtClient class. + */ +public interface ComputeScheduleMgmtClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * 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/ScheduledActionsClient.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/ScheduledActionsClient.java index 4e35bfcd1e534..197f2dbc9c7ab 100644 --- 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 @@ -29,7 +29,8 @@ */ public interface ScheduledActionsClient { /** - * virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine. + * VirtualMachinesSubmitDeallocate: Schedule deallocate operation for a batch of virtual machines at datetime in + * future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -44,7 +45,8 @@ Response virtualMachinesSubmitDealloca String locationparameter, SubmitDeallocateRequest requestBody, Context context); /** - * virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine. + * VirtualMachinesSubmitDeallocate: Schedule deallocate operation for a batch of virtual machines at datetime in + * future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -58,7 +60,8 @@ DeallocateResourceOperationResponseInner virtualMachinesSubmitDeallocate(String SubmitDeallocateRequest requestBody); /** - * virtualMachinesSubmitHibernate: submitHibernate for a virtual machine. + * VirtualMachinesSubmitHibernate: Schedule hibernate operation for a batch of virtual machines at datetime in + * future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -73,7 +76,8 @@ Response virtualMachinesSubmitHibernate String locationparameter, SubmitHibernateRequest requestBody, Context context); /** - * virtualMachinesSubmitHibernate: submitHibernate for a virtual machine. + * VirtualMachinesSubmitHibernate: Schedule hibernate operation for a batch of virtual machines at datetime in + * future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -87,7 +91,7 @@ HibernateResourceOperationResponseInner virtualMachinesSubmitHibernate(String lo SubmitHibernateRequest requestBody); /** - * virtualMachinesSubmitStart: submitStart for a virtual machine. + * VirtualMachinesSubmitStart: Schedule start operation for a batch of virtual machines at datetime in future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -102,7 +106,7 @@ Response virtualMachinesSubmitStartWithResp SubmitStartRequest requestBody, Context context); /** - * virtualMachinesSubmitStart: submitStart for a virtual machine. + * VirtualMachinesSubmitStart: Schedule start operation for a batch of virtual machines at datetime in future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -116,7 +120,8 @@ StartResourceOperationResponseInner virtualMachinesSubmitStart(String locationpa SubmitStartRequest requestBody); /** - * virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine. + * VirtualMachinesExecuteDeallocate: Execute deallocate operation for a batch of virtual machines, this operation is + * triggered as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -131,7 +136,8 @@ Response virtualMachinesExecuteDealloc String locationparameter, ExecuteDeallocateRequest requestBody, Context context); /** - * virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine. + * VirtualMachinesExecuteDeallocate: Execute deallocate operation for a batch of virtual machines, this operation is + * triggered as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -145,7 +151,8 @@ DeallocateResourceOperationResponseInner virtualMachinesExecuteDeallocate(String ExecuteDeallocateRequest requestBody); /** - * virtualMachinesExecuteHibernate: executeHibernate for a virtual machine. + * VirtualMachinesExecuteHibernate: Execute hibernate operation for a batch of virtual machines, this operation is + * triggered as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -160,7 +167,8 @@ Response virtualMachinesExecuteHibernat String locationparameter, ExecuteHibernateRequest requestBody, Context context); /** - * virtualMachinesExecuteHibernate: executeHibernate for a virtual machine. + * VirtualMachinesExecuteHibernate: Execute hibernate operation for a batch of virtual machines, this operation is + * triggered as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -174,7 +182,8 @@ HibernateResourceOperationResponseInner virtualMachinesExecuteHibernate(String l ExecuteHibernateRequest requestBody); /** - * virtualMachinesExecuteStart: executeStart for a virtual machine. + * VirtualMachinesExecuteStart: Execute start operation for a batch of virtual machines, this operation is triggered + * as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -189,7 +198,8 @@ Response virtualMachinesExecuteStartWithRes ExecuteStartRequest requestBody, Context context); /** - * virtualMachinesExecuteStart: executeStart for a virtual machine. + * VirtualMachinesExecuteStart: Execute start operation for a batch of virtual machines, this operation is triggered + * as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -203,7 +213,7 @@ StartResourceOperationResponseInner virtualMachinesExecuteStart(String locationp ExecuteStartRequest requestBody); /** - * virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine. + * VirtualMachinesGetOperationStatus: Polling endpoint to read status of operations performed on virtual machines. * * @param locationparameter The location name. * @param requestBody The request body. @@ -218,7 +228,7 @@ Response virtualMachinesGetOperationStatusWithR GetOperationStatusRequest requestBody, Context context); /** - * virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine. + * VirtualMachinesGetOperationStatus: Polling endpoint to read status of operations performed on virtual machines. * * @param locationparameter The location name. * @param requestBody The request body. @@ -232,7 +242,7 @@ GetOperationStatusResponseInner virtualMachinesGetOperationStatus(String locatio GetOperationStatusRequest requestBody); /** - * virtualMachinesCancelOperations: cancelOperations for a virtual machine. + * VirtualMachinesCancelOperations: Cancel a previously submitted (start/deallocate/hibernate) request. * * @param locationparameter The location name. * @param requestBody The request body. @@ -247,7 +257,7 @@ Response virtualMachinesCancelOperationsWithRespo CancelOperationsRequest requestBody, Context context); /** - * virtualMachinesCancelOperations: cancelOperations for a virtual machine. + * VirtualMachinesCancelOperations: Cancel a previously submitted (start/deallocate/hibernate) request. * * @param locationparameter The location name. * @param requestBody The request body. @@ -261,7 +271,8 @@ CancelOperationsResponseInner virtualMachinesCancelOperations(String locationpar CancelOperationsRequest requestBody); /** - * virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine. + * VirtualMachinesGetOperationErrors: Get error details on operation errors (like transient errors encountered, + * additional logs) if they exist. * * @param locationparameter The location name. * @param requestBody The request body. @@ -276,7 +287,8 @@ Response virtualMachinesGetOperationErrorsWithR GetOperationErrorsRequest requestBody, Context context); /** - * virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine. + * VirtualMachinesGetOperationErrors: Get error details on operation errors (like transient errors encountered, + * additional logs) if they exist. * * @param locationparameter The location name. * @param requestBody The request body. diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ComputeScheduleMgmtClientBuilder.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ComputeScheduleMgmtClientBuilder.java new file mode 100644 index 0000000000000..b57c5a1812d52 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ComputeScheduleMgmtClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 ComputeScheduleMgmtClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { ComputeScheduleMgmtClientImpl.class }) +public final class ComputeScheduleMgmtClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the ComputeScheduleMgmtClientBuilder. + */ + public ComputeScheduleMgmtClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * 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 ComputeScheduleMgmtClientBuilder. + */ + public ComputeScheduleMgmtClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the ComputeScheduleMgmtClientBuilder. + */ + public ComputeScheduleMgmtClientBuilder 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 ComputeScheduleMgmtClientBuilder. + */ + public ComputeScheduleMgmtClientBuilder 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 ComputeScheduleMgmtClientBuilder. + */ + public ComputeScheduleMgmtClientBuilder 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 ComputeScheduleMgmtClientBuilder. + */ + public ComputeScheduleMgmtClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ComputeScheduleMgmtClientImpl with the provided parameters. + * + * @return an instance of ComputeScheduleMgmtClientImpl. + */ + public ComputeScheduleMgmtClientImpl 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(); + ComputeScheduleMgmtClientImpl client = new ComputeScheduleMgmtClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ComputeScheduleMgmtClientImpl.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ComputeScheduleMgmtClientImpl.java new file mode 100644 index 0000000000000..ad546852c1fc3 --- /dev/null +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ComputeScheduleMgmtClientImpl.java @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.computeschedule.fluent.ComputeScheduleMgmtClient; +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 ComputeScheduleMgmtClientImpl type. + */ +@ServiceClient(builder = ComputeScheduleMgmtClientBuilder.class) +public final class ComputeScheduleMgmtClientImpl implements ComputeScheduleMgmtClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * 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; + } + + /** + * 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 ComputeScheduleMgmtClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + ComputeScheduleMgmtClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2024-10-01"; + 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(ComputeScheduleMgmtClientImpl.class); +} 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 index 66a9c4c4f30e3..682079658101d 100644 --- 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 @@ -42,25 +42,25 @@ public final class OperationsClientImpl implements OperationsClient { /** * The service client containing this operation class. */ - private final ComputeScheduleClientImpl client; + private final ComputeScheduleMgmtClientImpl client; /** * Initializes an instance of OperationsClientImpl. * * @param client the instance of the service client containing this operation class. */ - OperationsClientImpl(ComputeScheduleClientImpl client) { + OperationsClientImpl(ComputeScheduleMgmtClientImpl client) { this.service = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for ComputeScheduleClientOperations to be used by the proxy service to - * perform REST calls. + * The interface defining all the services for ComputeScheduleMgmtClientOperations to be used by the proxy service + * to perform REST calls. */ @Host("{endpoint}") - @ServiceInterface(name = "ComputeScheduleClien") + @ServiceInterface(name = "ComputeScheduleMgmtC") public interface OperationsService { @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.ComputeSchedule/operations") 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 index 37c4ee2f76783..8f0038fa7f2e7 100644 --- 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 @@ -51,25 +51,25 @@ public final class ScheduledActionsClientImpl implements ScheduledActionsClient /** * The service client containing this operation class. */ - private final ComputeScheduleClientImpl client; + private final ComputeScheduleMgmtClientImpl client; /** * Initializes an instance of ScheduledActionsClientImpl. * * @param client the instance of the service client containing this operation class. */ - ScheduledActionsClientImpl(ComputeScheduleClientImpl client) { + ScheduledActionsClientImpl(ComputeScheduleMgmtClientImpl client) { this.service = RestProxy.create(ScheduledActionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for ComputeScheduleClientScheduledActions to be used by the proxy service - * to perform REST calls. + * The interface defining all the services for ComputeScheduleMgmtClientScheduledActions to be used by the proxy + * service to perform REST calls. */ @Host("{endpoint}") - @ServiceInterface(name = "ComputeScheduleClien") + @ServiceInterface(name = "ComputeScheduleMgmtC") public interface ScheduledActionsService { @Post("/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitDeallocate") @ExpectedResponses({ 200 }) @@ -163,7 +163,8 @@ Mono> virtualMachinesGetOperationError } /** - * virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine. + * VirtualMachinesSubmitDeallocate: Schedule deallocate operation for a batch of virtual machines at datetime in + * future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -203,7 +204,8 @@ private Mono> virtualMachines } /** - * virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine. + * VirtualMachinesSubmitDeallocate: Schedule deallocate operation for a batch of virtual machines at datetime in + * future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -242,7 +244,8 @@ private Mono> virtualMachines } /** - * virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine. + * VirtualMachinesSubmitDeallocate: Schedule deallocate operation for a batch of virtual machines at datetime in + * future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -259,7 +262,8 @@ private Mono> virtualMachines } /** - * virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine. + * VirtualMachinesSubmitDeallocate: Schedule deallocate operation for a batch of virtual machines at datetime in + * future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -276,7 +280,8 @@ public Response virtualMachinesSubmitD } /** - * virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine. + * VirtualMachinesSubmitDeallocate: Schedule deallocate operation for a batch of virtual machines at datetime in + * future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -292,7 +297,8 @@ public DeallocateResourceOperationResponseInner virtualMachinesSubmitDeallocate( } /** - * virtualMachinesSubmitHibernate: submitHibernate for a virtual machine. + * VirtualMachinesSubmitHibernate: Schedule hibernate operation for a batch of virtual machines at datetime in + * future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -332,7 +338,8 @@ public DeallocateResourceOperationResponseInner virtualMachinesSubmitDeallocate( } /** - * virtualMachinesSubmitHibernate: submitHibernate for a virtual machine. + * VirtualMachinesSubmitHibernate: Schedule hibernate operation for a batch of virtual machines at datetime in + * future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -371,7 +378,8 @@ private Mono> virtualMachinesS } /** - * virtualMachinesSubmitHibernate: submitHibernate for a virtual machine. + * VirtualMachinesSubmitHibernate: Schedule hibernate operation for a batch of virtual machines at datetime in + * future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -388,7 +396,8 @@ private Mono virtualMachinesSubmitHiber } /** - * virtualMachinesSubmitHibernate: submitHibernate for a virtual machine. + * VirtualMachinesSubmitHibernate: Schedule hibernate operation for a batch of virtual machines at datetime in + * future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -405,7 +414,8 @@ public Response virtualMachinesSubmitHi } /** - * virtualMachinesSubmitHibernate: submitHibernate for a virtual machine. + * VirtualMachinesSubmitHibernate: Schedule hibernate operation for a batch of virtual machines at datetime in + * future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -421,7 +431,7 @@ public HibernateResourceOperationResponseInner virtualMachinesSubmitHibernate(St } /** - * virtualMachinesSubmitStart: submitStart for a virtual machine. + * VirtualMachinesSubmitStart: Schedule start operation for a batch of virtual machines at datetime in future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -460,7 +470,7 @@ public HibernateResourceOperationResponseInner virtualMachinesSubmitHibernate(St } /** - * virtualMachinesSubmitStart: submitStart for a virtual machine. + * VirtualMachinesSubmitStart: Schedule start operation for a batch of virtual machines at datetime in future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -498,7 +508,7 @@ private Mono> virtualMachinesSubmi } /** - * virtualMachinesSubmitStart: submitStart for a virtual machine. + * VirtualMachinesSubmitStart: Schedule start operation for a batch of virtual machines at datetime in future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -515,7 +525,7 @@ private Mono virtualMachinesSubmitStartAsyn } /** - * virtualMachinesSubmitStart: submitStart for a virtual machine. + * VirtualMachinesSubmitStart: Schedule start operation for a batch of virtual machines at datetime in future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -532,7 +542,7 @@ public Response virtualMachinesSubmitStartW } /** - * virtualMachinesSubmitStart: submitStart for a virtual machine. + * VirtualMachinesSubmitStart: Schedule start operation for a batch of virtual machines at datetime in future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -548,7 +558,8 @@ public StartResourceOperationResponseInner virtualMachinesSubmitStart(String loc } /** - * virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine. + * VirtualMachinesExecuteDeallocate: Execute deallocate operation for a batch of virtual machines, this operation is + * triggered as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -588,7 +599,8 @@ private Mono> virtualMachines } /** - * virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine. + * VirtualMachinesExecuteDeallocate: Execute deallocate operation for a batch of virtual machines, this operation is + * triggered as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -627,7 +639,8 @@ private Mono> virtualMachines } /** - * virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine. + * VirtualMachinesExecuteDeallocate: Execute deallocate operation for a batch of virtual machines, this operation is + * triggered as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -644,7 +657,8 @@ private Mono> virtualMachines } /** - * virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine. + * VirtualMachinesExecuteDeallocate: Execute deallocate operation for a batch of virtual machines, this operation is + * triggered as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -661,7 +675,8 @@ public Response virtualMachinesExecute } /** - * virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine. + * VirtualMachinesExecuteDeallocate: Execute deallocate operation for a batch of virtual machines, this operation is + * triggered as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -677,7 +692,8 @@ public DeallocateResourceOperationResponseInner virtualMachinesExecuteDeallocate } /** - * virtualMachinesExecuteHibernate: executeHibernate for a virtual machine. + * VirtualMachinesExecuteHibernate: Execute hibernate operation for a batch of virtual machines, this operation is + * triggered as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -717,7 +733,8 @@ private Mono> virtualMachinesE } /** - * virtualMachinesExecuteHibernate: executeHibernate for a virtual machine. + * VirtualMachinesExecuteHibernate: Execute hibernate operation for a batch of virtual machines, this operation is + * triggered as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -756,7 +773,8 @@ private Mono> virtualMachinesE } /** - * virtualMachinesExecuteHibernate: executeHibernate for a virtual machine. + * VirtualMachinesExecuteHibernate: Execute hibernate operation for a batch of virtual machines, this operation is + * triggered as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -773,7 +791,8 @@ private Mono virtualMachinesExecuteHibe } /** - * virtualMachinesExecuteHibernate: executeHibernate for a virtual machine. + * VirtualMachinesExecuteHibernate: Execute hibernate operation for a batch of virtual machines, this operation is + * triggered as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -790,7 +809,8 @@ public Response virtualMachinesExecuteH } /** - * virtualMachinesExecuteHibernate: executeHibernate for a virtual machine. + * VirtualMachinesExecuteHibernate: Execute hibernate operation for a batch of virtual machines, this operation is + * triggered as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -806,7 +826,8 @@ public HibernateResourceOperationResponseInner virtualMachinesExecuteHibernate(S } /** - * virtualMachinesExecuteStart: executeStart for a virtual machine. + * VirtualMachinesExecuteStart: Execute start operation for a batch of virtual machines, this operation is triggered + * as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -845,7 +866,8 @@ public HibernateResourceOperationResponseInner virtualMachinesExecuteHibernate(S } /** - * virtualMachinesExecuteStart: executeStart for a virtual machine. + * VirtualMachinesExecuteStart: Execute start operation for a batch of virtual machines, this operation is triggered + * as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -883,7 +905,8 @@ private Mono> virtualMachinesExecu } /** - * virtualMachinesExecuteStart: executeStart for a virtual machine. + * VirtualMachinesExecuteStart: Execute start operation for a batch of virtual machines, this operation is triggered + * as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -900,7 +923,8 @@ private Mono virtualMachinesExecuteStartAsy } /** - * virtualMachinesExecuteStart: executeStart for a virtual machine. + * VirtualMachinesExecuteStart: Execute start operation for a batch of virtual machines, this operation is triggered + * as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -917,7 +941,8 @@ public Response virtualMachinesExecuteStart } /** - * virtualMachinesExecuteStart: executeStart for a virtual machine. + * VirtualMachinesExecuteStart: Execute start operation for a batch of virtual machines, this operation is triggered + * as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -933,7 +958,7 @@ public StartResourceOperationResponseInner virtualMachinesExecuteStart(String lo } /** - * virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine. + * VirtualMachinesGetOperationStatus: Polling endpoint to read status of operations performed on virtual machines. * * @param locationparameter The location name. * @param requestBody The request body. @@ -973,7 +998,7 @@ private Mono> virtualMachinesGetOperat } /** - * virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine. + * VirtualMachinesGetOperationStatus: Polling endpoint to read status of operations performed on virtual machines. * * @param locationparameter The location name. * @param requestBody The request body. @@ -1012,7 +1037,7 @@ private Mono> virtualMachinesGetOperat } /** - * virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine. + * VirtualMachinesGetOperationStatus: Polling endpoint to read status of operations performed on virtual machines. * * @param locationparameter The location name. * @param requestBody The request body. @@ -1029,7 +1054,7 @@ private Mono virtualMachinesGetOperationStatusA } /** - * virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine. + * VirtualMachinesGetOperationStatus: Polling endpoint to read status of operations performed on virtual machines. * * @param locationparameter The location name. * @param requestBody The request body. @@ -1046,7 +1071,7 @@ public Response virtualMachinesGetOperationStat } /** - * virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine. + * VirtualMachinesGetOperationStatus: Polling endpoint to read status of operations performed on virtual machines. * * @param locationparameter The location name. * @param requestBody The request body. @@ -1062,7 +1087,7 @@ public GetOperationStatusResponseInner virtualMachinesGetOperationStatus(String } /** - * virtualMachinesCancelOperations: cancelOperations for a virtual machine. + * VirtualMachinesCancelOperations: Cancel a previously submitted (start/deallocate/hibernate) request. * * @param locationparameter The location name. * @param requestBody The request body. @@ -1102,7 +1127,7 @@ private Mono> virtualMachinesCancelOpera } /** - * virtualMachinesCancelOperations: cancelOperations for a virtual machine. + * VirtualMachinesCancelOperations: Cancel a previously submitted (start/deallocate/hibernate) request. * * @param locationparameter The location name. * @param requestBody The request body. @@ -1141,7 +1166,7 @@ private Mono> virtualMachinesCancelOpera } /** - * virtualMachinesCancelOperations: cancelOperations for a virtual machine. + * VirtualMachinesCancelOperations: Cancel a previously submitted (start/deallocate/hibernate) request. * * @param locationparameter The location name. * @param requestBody The request body. @@ -1158,7 +1183,7 @@ private Mono virtualMachinesCancelOperationsAsync } /** - * virtualMachinesCancelOperations: cancelOperations for a virtual machine. + * VirtualMachinesCancelOperations: Cancel a previously submitted (start/deallocate/hibernate) request. * * @param locationparameter The location name. * @param requestBody The request body. @@ -1175,7 +1200,7 @@ public Response virtualMachinesCancelOperationsWi } /** - * virtualMachinesCancelOperations: cancelOperations for a virtual machine. + * VirtualMachinesCancelOperations: Cancel a previously submitted (start/deallocate/hibernate) request. * * @param locationparameter The location name. * @param requestBody The request body. @@ -1191,7 +1216,8 @@ public CancelOperationsResponseInner virtualMachinesCancelOperations(String loca } /** - * virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine. + * VirtualMachinesGetOperationErrors: Get error details on operation errors (like transient errors encountered, + * additional logs) if they exist. * * @param locationparameter The location name. * @param requestBody The request body. @@ -1231,7 +1257,8 @@ private Mono> virtualMachinesGetOperat } /** - * virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine. + * VirtualMachinesGetOperationErrors: Get error details on operation errors (like transient errors encountered, + * additional logs) if they exist. * * @param locationparameter The location name. * @param requestBody The request body. @@ -1270,7 +1297,8 @@ private Mono> virtualMachinesGetOperat } /** - * virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine. + * VirtualMachinesGetOperationErrors: Get error details on operation errors (like transient errors encountered, + * additional logs) if they exist. * * @param locationparameter The location name. * @param requestBody The request body. @@ -1287,7 +1315,8 @@ private Mono virtualMachinesGetOperationErrorsA } /** - * virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine. + * VirtualMachinesGetOperationErrors: Get error details on operation errors (like transient errors encountered, + * additional logs) if they exist. * * @param locationparameter The location name. * @param requestBody The request body. @@ -1304,7 +1333,8 @@ public Response virtualMachinesGetOperationErro } /** - * virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine. + * VirtualMachinesGetOperationErrors: Get error details on operation errors (like transient errors encountered, + * additional logs) if they exist. * * @param locationparameter The location name. * @param requestBody The request body. 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 index 1c900af06a0da..c06204cf83751 100644 --- 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 @@ -24,7 +24,7 @@ public final class CancelOperationsRequest implements JsonSerializable operationIds; /* - * Correlationid item + * CorrelationId item */ private String correlationid; @@ -55,7 +55,7 @@ public CancelOperationsRequest withOperationIds(List operationIds) { } /** - * Get the correlationid property: Correlationid item. + * Get the correlationid property: CorrelationId item. * * @return the correlationid value. */ @@ -64,7 +64,7 @@ public String correlationid() { } /** - * Set the correlationid property: Correlationid item. + * Set the correlationid property: CorrelationId item. * * @param correlationid the correlationid value to set. * @return the CancelOperationsRequest object itself. 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 index 8f90faf2f07fc..43941ca73e6f8 100644 --- 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 @@ -28,7 +28,7 @@ public final class ExecuteDeallocateRequest implements JsonSerializable operationIds; /* - * Correlationid item + * CorrelationId item */ private String correlationid; @@ -55,7 +55,7 @@ public GetOperationStatusRequest withOperationIds(List operationIds) { } /** - * Get the correlationid property: Correlationid item. + * Get the correlationid property: CorrelationId item. * * @return the correlationid value. */ @@ -64,7 +64,7 @@ public String correlationid() { } /** - * Set the correlationid property: Correlationid item. + * Set the correlationid property: CorrelationId item. * * @param correlationid the correlationid value to set. * @return the GetOperationStatusRequest object itself. diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/OperationErrorDetails.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/OperationErrorDetails.java index 32260c6692bb5..de568ea3f9b26 100644 --- a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/OperationErrorDetails.java +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/models/OperationErrorDetails.java @@ -28,7 +28,12 @@ public final class OperationErrorDetails implements JsonSerializable CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); } else if ("timeStamp".equals(fieldName)) { deserializedOperationErrorDetails.timeStamp = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("azureOperationName".equals(fieldName)) { + deserializedOperationErrorDetails.azureOperationName = reader.getString(); } else if ("crpOperationId".equals(fieldName)) { deserializedOperationErrorDetails.crpOperationId = reader.getString(); } else { 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 index 80cd9c0d6d631..9b3edd43ed469 100644 --- 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 @@ -47,7 +47,7 @@ public final class OperationState extends ExpandableStringEnum { public static final OperationState FAILED = fromString("Failed"); /** - * Operations that have been cancelled by the user. + * Operations that have been Cancelled by the user. */ public static final OperationState CANCELLED = fromString("Cancelled"); 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 index 2ba6652f40158..2a036ccfdbad6 100644 --- 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 @@ -55,6 +55,11 @@ public final class ResourceOperationDetails implements JsonSerializable { + /* + * The deadline for the operation + */ + private OffsetDateTime deadline; + /* * The deadline for the operation */ private OffsetDateTime deadLine; + /* + * The timezone for the operation + */ + private String timezone; + /* * The timezone for the operation */ @@ -41,6 +51,26 @@ public final class Schedule implements JsonSerializable { 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 deadLine property: The deadline for the operation. * @@ -61,6 +91,26 @@ public Schedule withDeadLine(OffsetDateTime 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 timeZone property: The timezone for the operation. * @@ -107,14 +157,6 @@ public Schedule withDeadlineType(DeadlineType deadlineType) { * @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")); @@ -129,10 +171,13 @@ public void validate() { @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); + jsonWriter.writeStringField("deadlineType", this.deadlineType == null ? null : this.deadlineType.toString()); + jsonWriter.writeStringField("deadline", + this.deadline == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.deadline)); jsonWriter.writeStringField("deadLine", this.deadLine == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.deadLine)); + jsonWriter.writeStringField("timezone", this.timezone); jsonWriter.writeStringField("timeZone", this.timeZone); - jsonWriter.writeStringField("deadlineType", this.deadlineType == null ? null : this.deadlineType.toString()); return jsonWriter.writeEndObject(); } @@ -152,13 +197,18 @@ public static Schedule fromJson(JsonReader jsonReader) throws IOException { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("deadLine".equals(fieldName)) { + if ("deadlineType".equals(fieldName)) { + deserializedSchedule.deadlineType = DeadlineType.fromString(reader.getString()); + } else if ("deadline".equals(fieldName)) { + deserializedSchedule.deadline = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("deadLine".equals(fieldName)) { deserializedSchedule.deadLine = reader .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("timezone".equals(fieldName)) { + deserializedSchedule.timezone = reader.getString(); } else if ("timeZone".equals(fieldName)) { deserializedSchedule.timeZone = reader.getString(); - } else if ("deadlineType".equals(fieldName)) { - deserializedSchedule.deadlineType = DeadlineType.fromString(reader.getString()); } else { reader.skipChildren(); } 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 index ac835771e9905..f768a804cc5b2 100644 --- 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 @@ -12,7 +12,8 @@ */ public interface ScheduledActions { /** - * virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine. + * VirtualMachinesSubmitDeallocate: Schedule deallocate operation for a batch of virtual machines at datetime in + * future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -26,7 +27,8 @@ Response virtualMachinesSubmitDeallocateWit SubmitDeallocateRequest requestBody, Context context); /** - * virtualMachinesSubmitDeallocate: submitDeallocate for a virtual machine. + * VirtualMachinesSubmitDeallocate: Schedule deallocate operation for a batch of virtual machines at datetime in + * future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -39,7 +41,8 @@ DeallocateResourceOperationResponse virtualMachinesSubmitDeallocate(String locat SubmitDeallocateRequest requestBody); /** - * virtualMachinesSubmitHibernate: submitHibernate for a virtual machine. + * VirtualMachinesSubmitHibernate: Schedule hibernate operation for a batch of virtual machines at datetime in + * future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -53,7 +56,8 @@ Response virtualMachinesSubmitHibernateWithR SubmitHibernateRequest requestBody, Context context); /** - * virtualMachinesSubmitHibernate: submitHibernate for a virtual machine. + * VirtualMachinesSubmitHibernate: Schedule hibernate operation for a batch of virtual machines at datetime in + * future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -66,7 +70,7 @@ HibernateResourceOperationResponse virtualMachinesSubmitHibernate(String locatio SubmitHibernateRequest requestBody); /** - * virtualMachinesSubmitStart: submitStart for a virtual machine. + * VirtualMachinesSubmitStart: Schedule start operation for a batch of virtual machines at datetime in future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -80,7 +84,7 @@ Response virtualMachinesSubmitStartWithResponse( SubmitStartRequest requestBody, Context context); /** - * virtualMachinesSubmitStart: submitStart for a virtual machine. + * VirtualMachinesSubmitStart: Schedule start operation for a batch of virtual machines at datetime in future. * * @param locationparameter The location name. * @param requestBody The request body. @@ -92,7 +96,8 @@ Response virtualMachinesSubmitStartWithResponse( StartResourceOperationResponse virtualMachinesSubmitStart(String locationparameter, SubmitStartRequest requestBody); /** - * virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine. + * VirtualMachinesExecuteDeallocate: Execute deallocate operation for a batch of virtual machines, this operation is + * triggered as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -106,7 +111,8 @@ Response virtualMachinesExecuteDeallocateWi ExecuteDeallocateRequest requestBody, Context context); /** - * virtualMachinesExecuteDeallocate: executeDeallocate for a virtual machine. + * VirtualMachinesExecuteDeallocate: Execute deallocate operation for a batch of virtual machines, this operation is + * triggered as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -119,7 +125,8 @@ DeallocateResourceOperationResponse virtualMachinesExecuteDeallocate(String loca ExecuteDeallocateRequest requestBody); /** - * virtualMachinesExecuteHibernate: executeHibernate for a virtual machine. + * VirtualMachinesExecuteHibernate: Execute hibernate operation for a batch of virtual machines, this operation is + * triggered as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -133,7 +140,8 @@ Response virtualMachinesExecuteHibernateWith ExecuteHibernateRequest requestBody, Context context); /** - * virtualMachinesExecuteHibernate: executeHibernate for a virtual machine. + * VirtualMachinesExecuteHibernate: Execute hibernate operation for a batch of virtual machines, this operation is + * triggered as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -146,7 +154,8 @@ HibernateResourceOperationResponse virtualMachinesExecuteHibernate(String locati ExecuteHibernateRequest requestBody); /** - * virtualMachinesExecuteStart: executeStart for a virtual machine. + * VirtualMachinesExecuteStart: Execute start operation for a batch of virtual machines, this operation is triggered + * as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -160,7 +169,8 @@ Response virtualMachinesExecuteStartWithResponse ExecuteStartRequest requestBody, Context context); /** - * virtualMachinesExecuteStart: executeStart for a virtual machine. + * VirtualMachinesExecuteStart: Execute start operation for a batch of virtual machines, this operation is triggered + * as soon as Computeschedule receives it. * * @param locationparameter The location name. * @param requestBody The request body. @@ -173,7 +183,7 @@ StartResourceOperationResponse virtualMachinesExecuteStart(String locationparame ExecuteStartRequest requestBody); /** - * virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine. + * VirtualMachinesGetOperationStatus: Polling endpoint to read status of operations performed on virtual machines. * * @param locationparameter The location name. * @param requestBody The request body. @@ -187,7 +197,7 @@ Response virtualMachinesGetOperationStatusWithRespon GetOperationStatusRequest requestBody, Context context); /** - * virtualMachinesGetOperationStatus: getOperationStatus for a virtual machine. + * VirtualMachinesGetOperationStatus: Polling endpoint to read status of operations performed on virtual machines. * * @param locationparameter The location name. * @param requestBody The request body. @@ -200,7 +210,7 @@ GetOperationStatusResponse virtualMachinesGetOperationStatus(String locationpara GetOperationStatusRequest requestBody); /** - * virtualMachinesCancelOperations: cancelOperations for a virtual machine. + * VirtualMachinesCancelOperations: Cancel a previously submitted (start/deallocate/hibernate) request. * * @param locationparameter The location name. * @param requestBody The request body. @@ -214,7 +224,7 @@ Response virtualMachinesCancelOperationsWithResponse(S CancelOperationsRequest requestBody, Context context); /** - * virtualMachinesCancelOperations: cancelOperations for a virtual machine. + * VirtualMachinesCancelOperations: Cancel a previously submitted (start/deallocate/hibernate) request. * * @param locationparameter The location name. * @param requestBody The request body. @@ -227,7 +237,8 @@ CancelOperationsResponse virtualMachinesCancelOperations(String locationparamete CancelOperationsRequest requestBody); /** - * virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine. + * VirtualMachinesGetOperationErrors: Get error details on operation errors (like transient errors encountered, + * additional logs) if they exist. * * @param locationparameter The location name. * @param requestBody The request body. @@ -241,7 +252,8 @@ Response virtualMachinesGetOperationErrorsWithRespon GetOperationErrorsRequest requestBody, Context context); /** - * virtualMachinesGetOperationErrors: getOperationErrors associated with an operation on a virtual machine. + * VirtualMachinesGetOperationErrors: Get error details on operation errors (like transient errors encountered, + * additional logs) if they exist. * * @param locationparameter The location name. * @param requestBody The request body. 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 index 09f9b03ed7292..2e2326dd3073e 100644 --- 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 @@ -33,7 +33,7 @@ public final class SubmitDeallocateRequest implements JsonSerializable Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); @@ -34,6 +32,5 @@ public void testList() throws Exception { PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); - Assertions.assertEquals(ActionType.INTERNAL, response.iterator().next().actionType()); } } diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/ResourcesTests.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/ResourcesTests.java index 30ca995d588cc..ae5a055fa2e08 100644 --- a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/ResourcesTests.java +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/ResourcesTests.java @@ -12,14 +12,14 @@ public final class ResourcesTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - Resources model = BinaryData.fromString("{\"ids\":[\"jcny\"]}").toObject(Resources.class); - Assertions.assertEquals("jcny", model.ids().get(0)); + Resources model = BinaryData.fromString("{\"ids\":[\"k\",\"vd\"]}").toObject(Resources.class); + Assertions.assertEquals("k", model.ids().get(0)); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - Resources model = new Resources().withIds(Arrays.asList("jcny")); + Resources model = new Resources().withIds(Arrays.asList("k", "vd")); model = BinaryData.fromObject(model).toObject(Resources.class); - Assertions.assertEquals("jcny", model.ids().get(0)); + Assertions.assertEquals("k", model.ids().get(0)); } } diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/RetryPolicyTests.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/RetryPolicyTests.java index aa1eeceff2cc1..d2f0ab029712a 100644 --- a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/RetryPolicyTests.java +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/RetryPolicyTests.java @@ -11,17 +11,17 @@ public final class RetryPolicyTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - RetryPolicy model = BinaryData.fromString("{\"retryCount\":1674535960,\"retryWindowInMinutes\":70776342}") + RetryPolicy model = BinaryData.fromString("{\"retryCount\":257838249,\"retryWindowInMinutes\":355535904}") .toObject(RetryPolicy.class); - Assertions.assertEquals(1674535960, model.retryCount()); - Assertions.assertEquals(70776342, model.retryWindowInMinutes()); + Assertions.assertEquals(257838249, model.retryCount()); + Assertions.assertEquals(355535904, model.retryWindowInMinutes()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - RetryPolicy model = new RetryPolicy().withRetryCount(1674535960).withRetryWindowInMinutes(70776342); + RetryPolicy model = new RetryPolicy().withRetryCount(257838249).withRetryWindowInMinutes(355535904); model = BinaryData.fromObject(model).toObject(RetryPolicy.class); - Assertions.assertEquals(1674535960, model.retryCount()); - Assertions.assertEquals(70776342, model.retryWindowInMinutes()); + Assertions.assertEquals(257838249, model.retryCount()); + Assertions.assertEquals(355535904, model.retryWindowInMinutes()); } } diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/ScheduleTests.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/ScheduleTests.java index ec48ee5393982..5f59d8e6e37ac 100644 --- a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/ScheduleTests.java +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/ScheduleTests.java @@ -13,22 +13,28 @@ public final class ScheduleTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { - Schedule model = BinaryData - .fromString("{\"deadLine\":\"2021-06-10T17:14:25Z\",\"timeZone\":\"rtfw\",\"deadlineType\":\"Unknown\"}") + Schedule model = BinaryData.fromString( + "{\"deadline\":\"2021-11-30T01:16:03Z\",\"deadLine\":\"2021-08-06T18:49:52Z\",\"timezone\":\"czbysc\",\"timeZone\":\"q\",\"deadlineType\":\"Unknown\"}") .toObject(Schedule.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-10T17:14:25Z"), model.deadLine()); - Assertions.assertEquals("rtfw", model.timeZone()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-30T01:16:03Z"), model.deadline()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-06T18:49:52Z"), model.deadLine()); + Assertions.assertEquals("czbysc", model.timezone()); + Assertions.assertEquals("q", model.timeZone()); Assertions.assertEquals(DeadlineType.UNKNOWN, model.deadlineType()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { - Schedule model = new Schedule().withDeadLine(OffsetDateTime.parse("2021-06-10T17:14:25Z")) - .withTimeZone("rtfw") + Schedule model = new Schedule().withDeadline(OffsetDateTime.parse("2021-11-30T01:16:03Z")) + .withDeadLine(OffsetDateTime.parse("2021-08-06T18:49:52Z")) + .withTimezone("czbysc") + .withTimeZone("q") .withDeadlineType(DeadlineType.UNKNOWN); model = BinaryData.fromObject(model).toObject(Schedule.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-06-10T17:14:25Z"), model.deadLine()); - Assertions.assertEquals("rtfw", model.timeZone()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-30T01:16:03Z"), model.deadline()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-06T18:49:52Z"), model.deadLine()); + Assertions.assertEquals("czbysc", model.timezone()); + Assertions.assertEquals("q", model.timeZone()); Assertions.assertEquals(DeadlineType.UNKNOWN, model.deadlineType()); } } diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/SubmitDeallocateRequestTests.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/SubmitDeallocateRequestTests.java index fc681a74892cc..925e6fdc48b4f 100644 --- a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/SubmitDeallocateRequestTests.java +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/SubmitDeallocateRequestTests.java @@ -20,37 +20,45 @@ public final class SubmitDeallocateRequestTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { SubmitDeallocateRequest model = BinaryData.fromString( - "{\"schedule\":{\"deadLine\":\"2021-10-11T02:15:13Z\",\"timeZone\":\"ijbpzvgnwzsymgl\",\"deadlineType\":\"InitiateAt\"},\"executionParameters\":{\"optimizationPreference\":\"Cost\",\"retryPolicy\":{\"retryCount\":2049014083,\"retryWindowInMinutes\":1760407196}},\"resources\":{\"ids\":[\"bihanuf\",\"fcbjysagithxqha\",\"ifpikxwczby\",\"cnpqxuhivyqniwby\"]},\"correlationid\":\"rkxvdum\"}") + "{\"schedule\":{\"deadline\":\"2021-09-06T02:12:49Z\",\"deadLine\":\"2021-12-03T06:58:55Z\",\"timezone\":\"zvgnwzs\",\"timeZone\":\"glzufc\",\"deadlineType\":\"CompleteBy\"},\"executionParameters\":{\"optimizationPreference\":\"CostAvailabilityBalanced\",\"retryPolicy\":{\"retryCount\":1757371466,\"retryWindowInMinutes\":1730607260}},\"resources\":{\"ids\":[\"nufhf\",\"bj\",\"s\",\"git\"]},\"correlationid\":\"xqhabi\"}") .toObject(SubmitDeallocateRequest.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-11T02:15:13Z"), model.schedule().deadLine()); - Assertions.assertEquals("ijbpzvgnwzsymgl", model.schedule().timeZone()); - Assertions.assertEquals(DeadlineType.INITIATE_AT, model.schedule().deadlineType()); - Assertions.assertEquals(OptimizationPreference.COST, model.executionParameters().optimizationPreference()); - Assertions.assertEquals(2049014083, model.executionParameters().retryPolicy().retryCount()); - Assertions.assertEquals(1760407196, model.executionParameters().retryPolicy().retryWindowInMinutes()); - Assertions.assertEquals("bihanuf", model.resources().ids().get(0)); - Assertions.assertEquals("rkxvdum", model.correlationid()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-06T02:12:49Z"), model.schedule().deadline()); + Assertions.assertEquals(OffsetDateTime.parse("2021-12-03T06:58:55Z"), model.schedule().deadLine()); + Assertions.assertEquals("zvgnwzs", model.schedule().timezone()); + Assertions.assertEquals("glzufc", model.schedule().timeZone()); + Assertions.assertEquals(DeadlineType.COMPLETE_BY, model.schedule().deadlineType()); + Assertions.assertEquals(OptimizationPreference.COST_AVAILABILITY_BALANCED, + model.executionParameters().optimizationPreference()); + Assertions.assertEquals(1757371466, model.executionParameters().retryPolicy().retryCount()); + Assertions.assertEquals(1730607260, model.executionParameters().retryPolicy().retryWindowInMinutes()); + Assertions.assertEquals("nufhf", model.resources().ids().get(0)); + Assertions.assertEquals("xqhabi", model.correlationid()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { SubmitDeallocateRequest model = new SubmitDeallocateRequest() - .withSchedule(new Schedule().withDeadLine(OffsetDateTime.parse("2021-10-11T02:15:13Z")) - .withTimeZone("ijbpzvgnwzsymgl") - .withDeadlineType(DeadlineType.INITIATE_AT)) - .withExecutionParameters(new ExecutionParameters().withOptimizationPreference(OptimizationPreference.COST) - .withRetryPolicy(new RetryPolicy().withRetryCount(2049014083).withRetryWindowInMinutes(1760407196))) - .withResources( - new Resources().withIds(Arrays.asList("bihanuf", "fcbjysagithxqha", "ifpikxwczby", "cnpqxuhivyqniwby"))) - .withCorrelationid("rkxvdum"); + .withSchedule(new Schedule().withDeadline(OffsetDateTime.parse("2021-09-06T02:12:49Z")) + .withDeadLine(OffsetDateTime.parse("2021-12-03T06:58:55Z")) + .withTimezone("zvgnwzs") + .withTimeZone("glzufc") + .withDeadlineType(DeadlineType.COMPLETE_BY)) + .withExecutionParameters( + new ExecutionParameters().withOptimizationPreference(OptimizationPreference.COST_AVAILABILITY_BALANCED) + .withRetryPolicy(new RetryPolicy().withRetryCount(1757371466).withRetryWindowInMinutes(1730607260))) + .withResources(new Resources().withIds(Arrays.asList("nufhf", "bj", "s", "git"))) + .withCorrelationid("xqhabi"); model = BinaryData.fromObject(model).toObject(SubmitDeallocateRequest.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-10-11T02:15:13Z"), model.schedule().deadLine()); - Assertions.assertEquals("ijbpzvgnwzsymgl", model.schedule().timeZone()); - Assertions.assertEquals(DeadlineType.INITIATE_AT, model.schedule().deadlineType()); - Assertions.assertEquals(OptimizationPreference.COST, model.executionParameters().optimizationPreference()); - Assertions.assertEquals(2049014083, model.executionParameters().retryPolicy().retryCount()); - Assertions.assertEquals(1760407196, model.executionParameters().retryPolicy().retryWindowInMinutes()); - Assertions.assertEquals("bihanuf", model.resources().ids().get(0)); - Assertions.assertEquals("rkxvdum", model.correlationid()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-06T02:12:49Z"), model.schedule().deadline()); + Assertions.assertEquals(OffsetDateTime.parse("2021-12-03T06:58:55Z"), model.schedule().deadLine()); + Assertions.assertEquals("zvgnwzs", model.schedule().timezone()); + Assertions.assertEquals("glzufc", model.schedule().timeZone()); + Assertions.assertEquals(DeadlineType.COMPLETE_BY, model.schedule().deadlineType()); + Assertions.assertEquals(OptimizationPreference.COST_AVAILABILITY_BALANCED, + model.executionParameters().optimizationPreference()); + Assertions.assertEquals(1757371466, model.executionParameters().retryPolicy().retryCount()); + Assertions.assertEquals(1730607260, model.executionParameters().retryPolicy().retryWindowInMinutes()); + Assertions.assertEquals("nufhf", model.resources().ids().get(0)); + Assertions.assertEquals("xqhabi", model.correlationid()); } } diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/SubmitHibernateRequestTests.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/SubmitHibernateRequestTests.java index c9f27469eebd9..1a8513f1280c1 100644 --- a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/SubmitHibernateRequestTests.java +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/SubmitHibernateRequestTests.java @@ -20,40 +20,45 @@ public final class SubmitHibernateRequestTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { SubmitHibernateRequest model = BinaryData.fromString( - "{\"schedule\":{\"deadLine\":\"2021-11-13T06:20:15Z\",\"timeZone\":\"ahbc\",\"deadlineType\":\"InitiateAt\"},\"executionParameters\":{\"optimizationPreference\":\"CostAvailabilityBalanced\",\"retryPolicy\":{\"retryCount\":1276886479,\"retryWindowInMinutes\":491201544}},\"resources\":{\"ids\":[\"gexpaojakhmsbz\",\"hcrzevd\",\"hlxaolthqtr\",\"qjbpfzfsin\"]},\"correlationid\":\"gvfcj\"}") + "{\"schedule\":{\"deadline\":\"2021-01-15T00:39:28Z\",\"deadLine\":\"2021-04-04T07:45:50Z\",\"timezone\":\"dio\",\"timeZone\":\"pslwejdpvw\",\"deadlineType\":\"CompleteBy\"},\"executionParameters\":{\"optimizationPreference\":\"CostAvailabilityBalanced\",\"retryPolicy\":{\"retryCount\":1977100929,\"retryWindowInMinutes\":1527303417}},\"resources\":{\"ids\":[\"tazak\",\"j\",\"ahbc\",\"yffdfdos\"]},\"correlationid\":\"gexpaojakhmsbz\"}") .toObject(SubmitHibernateRequest.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-13T06:20:15Z"), model.schedule().deadLine()); - Assertions.assertEquals("ahbc", model.schedule().timeZone()); - Assertions.assertEquals(DeadlineType.INITIATE_AT, model.schedule().deadlineType()); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-15T00:39:28Z"), model.schedule().deadline()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-04T07:45:50Z"), model.schedule().deadLine()); + Assertions.assertEquals("dio", model.schedule().timezone()); + Assertions.assertEquals("pslwejdpvw", model.schedule().timeZone()); + Assertions.assertEquals(DeadlineType.COMPLETE_BY, model.schedule().deadlineType()); Assertions.assertEquals(OptimizationPreference.COST_AVAILABILITY_BALANCED, model.executionParameters().optimizationPreference()); - Assertions.assertEquals(1276886479, model.executionParameters().retryPolicy().retryCount()); - Assertions.assertEquals(491201544, model.executionParameters().retryPolicy().retryWindowInMinutes()); - Assertions.assertEquals("gexpaojakhmsbz", model.resources().ids().get(0)); - Assertions.assertEquals("gvfcj", model.correlationid()); + Assertions.assertEquals(1977100929, model.executionParameters().retryPolicy().retryCount()); + Assertions.assertEquals(1527303417, model.executionParameters().retryPolicy().retryWindowInMinutes()); + Assertions.assertEquals("tazak", model.resources().ids().get(0)); + Assertions.assertEquals("gexpaojakhmsbz", model.correlationid()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { SubmitHibernateRequest model = new SubmitHibernateRequest() - .withSchedule(new Schedule().withDeadLine(OffsetDateTime.parse("2021-11-13T06:20:15Z")) - .withTimeZone("ahbc") - .withDeadlineType(DeadlineType.INITIATE_AT)) + .withSchedule(new Schedule().withDeadline(OffsetDateTime.parse("2021-01-15T00:39:28Z")) + .withDeadLine(OffsetDateTime.parse("2021-04-04T07:45:50Z")) + .withTimezone("dio") + .withTimeZone("pslwejdpvw") + .withDeadlineType(DeadlineType.COMPLETE_BY)) .withExecutionParameters( new ExecutionParameters().withOptimizationPreference(OptimizationPreference.COST_AVAILABILITY_BALANCED) - .withRetryPolicy(new RetryPolicy().withRetryCount(1276886479).withRetryWindowInMinutes(491201544))) - .withResources( - new Resources().withIds(Arrays.asList("gexpaojakhmsbz", "hcrzevd", "hlxaolthqtr", "qjbpfzfsin"))) - .withCorrelationid("gvfcj"); + .withRetryPolicy(new RetryPolicy().withRetryCount(1977100929).withRetryWindowInMinutes(1527303417))) + .withResources(new Resources().withIds(Arrays.asList("tazak", "j", "ahbc", "yffdfdos"))) + .withCorrelationid("gexpaojakhmsbz"); model = BinaryData.fromObject(model).toObject(SubmitHibernateRequest.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-11-13T06:20:15Z"), model.schedule().deadLine()); - Assertions.assertEquals("ahbc", model.schedule().timeZone()); - Assertions.assertEquals(DeadlineType.INITIATE_AT, model.schedule().deadlineType()); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-15T00:39:28Z"), model.schedule().deadline()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-04T07:45:50Z"), model.schedule().deadLine()); + Assertions.assertEquals("dio", model.schedule().timezone()); + Assertions.assertEquals("pslwejdpvw", model.schedule().timeZone()); + Assertions.assertEquals(DeadlineType.COMPLETE_BY, model.schedule().deadlineType()); Assertions.assertEquals(OptimizationPreference.COST_AVAILABILITY_BALANCED, model.executionParameters().optimizationPreference()); - Assertions.assertEquals(1276886479, model.executionParameters().retryPolicy().retryCount()); - Assertions.assertEquals(491201544, model.executionParameters().retryPolicy().retryWindowInMinutes()); - Assertions.assertEquals("gexpaojakhmsbz", model.resources().ids().get(0)); - Assertions.assertEquals("gvfcj", model.correlationid()); + Assertions.assertEquals(1977100929, model.executionParameters().retryPolicy().retryCount()); + Assertions.assertEquals(1527303417, model.executionParameters().retryPolicy().retryWindowInMinutes()); + Assertions.assertEquals("tazak", model.resources().ids().get(0)); + Assertions.assertEquals("gexpaojakhmsbz", model.correlationid()); } } diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/SubmitStartRequestTests.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/SubmitStartRequestTests.java index 4688dc9e1fd1f..0657427af1932 100644 --- a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/SubmitStartRequestTests.java +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/test/java/com/azure/resourcemanager/computeschedule/generated/SubmitStartRequestTests.java @@ -20,39 +20,45 @@ public final class SubmitStartRequestTests { @org.junit.jupiter.api.Test public void testDeserialize() throws Exception { SubmitStartRequest model = BinaryData.fromString( - "{\"schedule\":{\"deadLine\":\"2021-05-28T01:58:06Z\",\"timeZone\":\"yhuybbkpod\",\"deadlineType\":\"InitiateAt\"},\"executionParameters\":{\"optimizationPreference\":\"Availability\",\"retryPolicy\":{\"retryCount\":895630833,\"retryWindowInMinutes\":1290742637}},\"resources\":{\"ids\":[\"mihe\",\"gnarxzxtheo\",\"usivye\"]},\"correlationid\":\"cciqihnhungbwjz\"}") + "{\"schedule\":{\"deadline\":\"2021-11-24T18:52:18Z\",\"deadLine\":\"2021-10-29T01:56:29Z\",\"timezone\":\"hpf\",\"timeZone\":\"ypininm\",\"deadlineType\":\"InitiateAt\"},\"executionParameters\":{\"optimizationPreference\":\"CostAvailabilityBalanced\",\"retryPolicy\":{\"retryCount\":1439394091,\"retryWindowInMinutes\":1813280112}},\"resources\":{\"ids\":[\"depoog\",\"nuvamiheogna\",\"xzxtheo\"]},\"correlationid\":\"usivye\"}") .toObject(SubmitStartRequest.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-28T01:58:06Z"), model.schedule().deadLine()); - Assertions.assertEquals("yhuybbkpod", model.schedule().timeZone()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-24T18:52:18Z"), model.schedule().deadline()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-29T01:56:29Z"), model.schedule().deadLine()); + Assertions.assertEquals("hpf", model.schedule().timezone()); + Assertions.assertEquals("ypininm", model.schedule().timeZone()); Assertions.assertEquals(DeadlineType.INITIATE_AT, model.schedule().deadlineType()); - Assertions.assertEquals(OptimizationPreference.AVAILABILITY, + Assertions.assertEquals(OptimizationPreference.COST_AVAILABILITY_BALANCED, model.executionParameters().optimizationPreference()); - Assertions.assertEquals(895630833, model.executionParameters().retryPolicy().retryCount()); - Assertions.assertEquals(1290742637, model.executionParameters().retryPolicy().retryWindowInMinutes()); - Assertions.assertEquals("mihe", model.resources().ids().get(0)); - Assertions.assertEquals("cciqihnhungbwjz", model.correlationid()); + Assertions.assertEquals(1439394091, model.executionParameters().retryPolicy().retryCount()); + Assertions.assertEquals(1813280112, model.executionParameters().retryPolicy().retryWindowInMinutes()); + Assertions.assertEquals("depoog", model.resources().ids().get(0)); + Assertions.assertEquals("usivye", model.correlationid()); } @org.junit.jupiter.api.Test public void testSerialize() throws Exception { SubmitStartRequest model = new SubmitStartRequest() - .withSchedule(new Schedule().withDeadLine(OffsetDateTime.parse("2021-05-28T01:58:06Z")) - .withTimeZone("yhuybbkpod") + .withSchedule(new Schedule().withDeadline(OffsetDateTime.parse("2021-11-24T18:52:18Z")) + .withDeadLine(OffsetDateTime.parse("2021-10-29T01:56:29Z")) + .withTimezone("hpf") + .withTimeZone("ypininm") .withDeadlineType(DeadlineType.INITIATE_AT)) .withExecutionParameters( - new ExecutionParameters().withOptimizationPreference(OptimizationPreference.AVAILABILITY) - .withRetryPolicy(new RetryPolicy().withRetryCount(895630833).withRetryWindowInMinutes(1290742637))) - .withResources(new Resources().withIds(Arrays.asList("mihe", "gnarxzxtheo", "usivye"))) - .withCorrelationid("cciqihnhungbwjz"); + new ExecutionParameters().withOptimizationPreference(OptimizationPreference.COST_AVAILABILITY_BALANCED) + .withRetryPolicy(new RetryPolicy().withRetryCount(1439394091).withRetryWindowInMinutes(1813280112))) + .withResources(new Resources().withIds(Arrays.asList("depoog", "nuvamiheogna", "xzxtheo"))) + .withCorrelationid("usivye"); model = BinaryData.fromObject(model).toObject(SubmitStartRequest.class); - Assertions.assertEquals(OffsetDateTime.parse("2021-05-28T01:58:06Z"), model.schedule().deadLine()); - Assertions.assertEquals("yhuybbkpod", model.schedule().timeZone()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-24T18:52:18Z"), model.schedule().deadline()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-29T01:56:29Z"), model.schedule().deadLine()); + Assertions.assertEquals("hpf", model.schedule().timezone()); + Assertions.assertEquals("ypininm", model.schedule().timeZone()); Assertions.assertEquals(DeadlineType.INITIATE_AT, model.schedule().deadlineType()); - Assertions.assertEquals(OptimizationPreference.AVAILABILITY, + Assertions.assertEquals(OptimizationPreference.COST_AVAILABILITY_BALANCED, model.executionParameters().optimizationPreference()); - Assertions.assertEquals(895630833, model.executionParameters().retryPolicy().retryCount()); - Assertions.assertEquals(1290742637, model.executionParameters().retryPolicy().retryWindowInMinutes()); - Assertions.assertEquals("mihe", model.resources().ids().get(0)); - Assertions.assertEquals("cciqihnhungbwjz", model.correlationid()); + Assertions.assertEquals(1439394091, model.executionParameters().retryPolicy().retryCount()); + Assertions.assertEquals(1813280112, model.executionParameters().retryPolicy().retryWindowInMinutes()); + Assertions.assertEquals("depoog", model.resources().ids().get(0)); + Assertions.assertEquals("usivye", model.correlationid()); } } diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/tsp-location.yaml b/sdk/computeschedule/azure-resourcemanager-computeschedule/tsp-location.yaml index be9e75debb247..15e780964f87d 100644 --- a/sdk/computeschedule/azure-resourcemanager-computeschedule/tsp-location.yaml +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/computeschedule/ComputeSchedule.Management -commit: d79d73bea550b643c312dde6a7e817840c1ac914 +commit: 63685369d3d7bdee95c51fb111c410c2cb5be8ec repo: Azure/azure-rest-api-specs additionalDirectories: From 73c6df21948b9e8b7212a6b79abacf95aaf872cc Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Wed, 22 Jan 2025 06:27:38 +0000 Subject: [PATCH 2/4] [Automation] Generate Fluent Lite from TypeSpec computeschedule --- .../CHANGELOG.md | 28 +- .../README.md | 2 +- .../pom.xml | 2 +- .../fluent/ComputeScheduleClient.java | 62 ---- .../ComputeScheduleClientBuilder.java | 138 -------- .../ComputeScheduleClientImpl.java | 304 ------------------ 6 files changed, 26 insertions(+), 510 deletions(-) delete mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/ComputeScheduleClient.java delete mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ComputeScheduleClientBuilder.java delete mode 100644 sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ComputeScheduleClientImpl.java diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/CHANGELOG.md b/sdk/computeschedule/azure-resourcemanager-computeschedule/CHANGELOG.md index 77001876f3836..12c51413e4be6 100644 --- a/sdk/computeschedule/azure-resourcemanager-computeschedule/CHANGELOG.md +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/CHANGELOG.md @@ -1,16 +1,36 @@ # Release History -## 1.0.0-beta.1 (2025-01-22) +## 1.0.0 (2025-01-22) - Azure Resource Manager Compute Schedule client library for Java. This package contains Microsoft Azure SDK for Compute Schedule Management SDK. Microsoft.ComputeSchedule Resource Provider management API. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Breaking Changes + +#### `models.OperationErrorDetails` was modified + +* `java.time.OffsetDateTime errorDetails()` -> `java.lang.String errorDetails()` + +#### `ComputeScheduleManager` was modified + +* `fluent.ComputeScheduleClient serviceClient()` -> `fluent.ComputeScheduleMgmtClient serviceClient()` + ### Features Added -### Breaking Changes +#### `models.OperationErrorDetails` was modified + +* `azureOperationName()` was added +* `timestamp()` was added + +#### `models.ResourceOperationDetails` was modified + +* `timezone()` was added -### Bugs Fixed +#### `models.Schedule` was modified -### Other Changes +* `timezone()` was added +* `withTimezone(java.lang.String)` was added +* `withDeadline(java.time.OffsetDateTime)` was added +* `deadline()` was added ## 1.0.0-beta.1 (2024-09-25) diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/README.md b/sdk/computeschedule/azure-resourcemanager-computeschedule/README.md index 040bb09afcb5e..d377cdb695775 100644 --- a/sdk/computeschedule/azure-resourcemanager-computeschedule/README.md +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/README.md @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-computeschedule - 1.0.0-beta.1 + 1.0.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/pom.xml b/sdk/computeschedule/azure-resourcemanager-computeschedule/pom.xml index 5076c3e7d8e4a..996753d3c1138 100644 --- a/sdk/computeschedule/azure-resourcemanager-computeschedule/pom.xml +++ b/sdk/computeschedule/azure-resourcemanager-computeschedule/pom.xml @@ -14,7 +14,7 @@ com.azure.resourcemanager azure-resourcemanager-computeschedule - 1.0.0-beta.1 + 1.0.0 jar Microsoft Azure SDK for Compute Schedule Management diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/ComputeScheduleClient.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/ComputeScheduleClient.java deleted file mode 100644 index 849747a27a1c4..0000000000000 --- a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/fluent/ComputeScheduleClient.java +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec Code Generator. - -package com.azure.resourcemanager.computeschedule.fluent; - -import com.azure.core.http.HttpPipeline; -import java.time.Duration; - -/** - * The interface for ComputeScheduleClient class. - */ -public interface ComputeScheduleClient { - /** - * Gets Service host. - * - * @return the endpoint value. - */ - String getEndpoint(); - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - String getApiVersion(); - - /** - * Gets The ID of the target subscription. The value must be an UUID. - * - * @return the subscriptionId value. - */ - String getSubscriptionId(); - - /** - * 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/implementation/ComputeScheduleClientBuilder.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ComputeScheduleClientBuilder.java deleted file mode 100644 index 863157199db28..0000000000000 --- a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ComputeScheduleClientBuilder.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec 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 ComputeScheduleClientImpl type. - */ -@ServiceClientBuilder(serviceClients = { ComputeScheduleClientImpl.class }) -public final class ComputeScheduleClientBuilder { - /* - * Service host - */ - private String endpoint; - - /** - * Sets Service host. - * - * @param endpoint the endpoint value. - * @return the ComputeScheduleClientBuilder. - */ - public ComputeScheduleClientBuilder endpoint(String endpoint) { - this.endpoint = endpoint; - return this; - } - - /* - * 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 ComputeScheduleClientBuilder. - */ - public ComputeScheduleClientBuilder subscriptionId(String subscriptionId) { - this.subscriptionId = subscriptionId; - return this; - } - - /* - * The environment to connect to - */ - private AzureEnvironment environment; - - /** - * Sets The environment to connect to. - * - * @param environment the environment value. - * @return the ComputeScheduleClientBuilder. - */ - public ComputeScheduleClientBuilder 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 ComputeScheduleClientBuilder. - */ - public ComputeScheduleClientBuilder 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 ComputeScheduleClientBuilder. - */ - public ComputeScheduleClientBuilder 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 ComputeScheduleClientBuilder. - */ - public ComputeScheduleClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { - this.serializerAdapter = serializerAdapter; - return this; - } - - /** - * Builds an instance of ComputeScheduleClientImpl with the provided parameters. - * - * @return an instance of ComputeScheduleClientImpl. - */ - public ComputeScheduleClientImpl 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(); - ComputeScheduleClientImpl client = new ComputeScheduleClientImpl(localPipeline, localSerializerAdapter, - localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); - return client; - } -} diff --git a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ComputeScheduleClientImpl.java b/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ComputeScheduleClientImpl.java deleted file mode 100644 index 531f90f13b5c7..0000000000000 --- a/sdk/computeschedule/azure-resourcemanager-computeschedule/src/main/java/com/azure/resourcemanager/computeschedule/implementation/ComputeScheduleClientImpl.java +++ /dev/null @@ -1,304 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) TypeSpec 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.PollResult; -import com.azure.core.management.polling.PollerFactory; -import com.azure.core.util.Context; -import com.azure.core.util.CoreUtils; -import com.azure.core.util.logging.ClientLogger; -import com.azure.core.util.polling.AsyncPollResponse; -import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.serializer.SerializerAdapter; -import com.azure.core.util.serializer.SerializerEncoding; -import com.azure.resourcemanager.computeschedule.fluent.ComputeScheduleClient; -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 ComputeScheduleClientImpl type. - */ -@ServiceClient(builder = ComputeScheduleClientBuilder.class) -public final class ComputeScheduleClientImpl implements ComputeScheduleClient { - /** - * Service host. - */ - private final String endpoint; - - /** - * Gets Service host. - * - * @return the endpoint value. - */ - public String getEndpoint() { - return this.endpoint; - } - - /** - * Version parameter. - */ - private final String apiVersion; - - /** - * Gets Version parameter. - * - * @return the apiVersion value. - */ - public String getApiVersion() { - return this.apiVersion; - } - - /** - * 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; - } - - /** - * 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 ComputeScheduleClient client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - * @param serializerAdapter The serializer to serialize an object into a string. - * @param defaultPollInterval The default poll interval for long-running operation. - * @param environment The Azure environment. - * @param endpoint Service host. - * @param subscriptionId The ID of the target subscription. The value must be an UUID. - */ - ComputeScheduleClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, - Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { - this.httpPipeline = httpPipeline; - this.serializerAdapter = serializerAdapter; - this.defaultPollInterval = defaultPollInterval; - this.endpoint = endpoint; - this.subscriptionId = subscriptionId; - this.apiVersion = "2024-08-15-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(ComputeScheduleClientImpl.class); -} From 508703829a08a4558481afc01c9da59ad2bca78f Mon Sep 17 00:00:00 2001 From: Xiaofei Cao <92354331+XiaofeiCao@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:50:52 +0800 Subject: [PATCH 3/4] Update log version from 1.0.0-beta.1 to 1.0.0 --- .../resourcemanager/computeschedule/ComputeScheduleManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 25c3f4eb7a7df..5b2b122fc9c72 100644 --- 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 @@ -209,7 +209,7 @@ public ComputeScheduleManager authenticate(TokenCredential credential, AzureProf .append("-") .append("com.azure.resourcemanager.computeschedule") .append("/") - .append("1.0.0-beta.1"); + .append("1.0.0"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version")) From e79922bca1b86f4d010f1b0b7a469075c39b3cb8 Mon Sep 17 00:00:00 2001 From: Xiaofei Cao <92354331+XiaofeiCao@users.noreply.github.com> Date: Wed, 22 Jan 2025 15:41:31 +0800 Subject: [PATCH 4/4] Update version to 1.0.0-beta.1 --- .../resourcemanager/computeschedule/ComputeScheduleManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 5b2b122fc9c72..25c3f4eb7a7df 100644 --- 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 @@ -209,7 +209,7 @@ public ComputeScheduleManager authenticate(TokenCredential credential, AzureProf .append("-") .append("com.azure.resourcemanager.computeschedule") .append("/") - .append("1.0.0"); + .append("1.0.0-beta.1"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version"))