diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/CHANGELOG.md b/sdk/durabletask/azure-resourcemanager-durabletask/CHANGELOG.md index 4a2da4f896d1..c06a2a64398c 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/CHANGELOG.md +++ b/sdk/durabletask/azure-resourcemanager-durabletask/CHANGELOG.md @@ -1,14 +1,26 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.2 (2025-04-21) + +- Azure Resource Manager Durable Task client library for Java. This package contains Microsoft Azure SDK for Durable Task Management SDK. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Features Added -### Breaking Changes +* `models.RetentionPolicyProperties` was added + +* `models.RetentionPolicies` was added + +* `models.RetentionPolicyDetails` was added + +* `implementation.models.RetentionPolicyListResult` was added + +* `models.RetentionPolicy` was added + +* `models.PurgeableOrchestrationState` was added -### Bugs Fixed +#### `DurableTaskManager` was modified -### Other Changes +* `retentionPolicies()` was added ## 1.0.0-beta.1 (2025-03-25) diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/README.md b/sdk/durabletask/azure-resourcemanager-durabletask/README.md index 6cf809f2d101..2599cc1f1adb 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/README.md +++ b/sdk/durabletask/azure-resourcemanager-durabletask/README.md @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-durabletask - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/SAMPLE.md b/sdk/durabletask/azure-resourcemanager-durabletask/SAMPLE.md index 748c0976d3d1..413790f6dc95 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/SAMPLE.md +++ b/sdk/durabletask/azure-resourcemanager-durabletask/SAMPLE.md @@ -5,6 +5,14 @@ - [List](#operations_list) +## RetentionPolicies + +- [CreateOrReplace](#retentionpolicies_createorreplace) +- [Delete](#retentionpolicies_delete) +- [Get](#retentionpolicies_get) +- [ListByScheduler](#retentionpolicies_listbyscheduler) +- [Update](#retentionpolicies_update) + ## Schedulers - [CreateOrUpdate](#schedulers_createorupdate) @@ -22,13 +30,83 @@ - [ListByScheduler](#taskhubs_listbyscheduler) ### Operations_List +```java +import com.azure.resourcemanager.durabletask.fluent.models.RetentionPolicyInner; +import com.azure.resourcemanager.durabletask.models.PurgeableOrchestrationState; +import com.azure.resourcemanager.durabletask.models.RetentionPolicyDetails; +import com.azure.resourcemanager.durabletask.models.RetentionPolicyProperties; +import java.util.Arrays; + +/** + * Samples for RetentionPolicies CreateOrReplace. + */ +public final class RetentionPoliciesCreateOrReplaceSamples { + /* + * x-ms-original-file: 2025-04-01-preview/RetentionPolicies_CreateOrReplace_MaximumSet_Gen.json + */ + /** + * Sample code: RetentionPolicies_CreateOrReplace_MaximumSet. + * + * @param manager Entry point to DurableTaskManager. + */ + public static void + retentionPoliciesCreateOrReplaceMaximumSet(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { + manager.retentionPolicies() + .createOrReplace("rgdurabletask", "testscheduler", + new RetentionPolicyInner().withProperties(new RetentionPolicyProperties() + .withRetentionPolicies(Arrays.asList(new RetentionPolicyDetails().withRetentionPeriodInDays(30), + new RetentionPolicyDetails().withRetentionPeriodInDays(10) + .withOrchestrationState(PurgeableOrchestrationState.FAILED)))), + com.azure.core.util.Context.NONE); + } +} +``` + +### RetentionPolicies_CreateOrReplace + +```java +import com.azure.resourcemanager.durabletask.fluent.models.RetentionPolicyInner; +import com.azure.resourcemanager.durabletask.models.PurgeableOrchestrationState; +import com.azure.resourcemanager.durabletask.models.RetentionPolicyDetails; +import com.azure.resourcemanager.durabletask.models.RetentionPolicyProperties; +import java.util.Arrays; + +/** + * Samples for RetentionPolicies Update. + */ +public final class RetentionPoliciesUpdateSamples { + /* + * x-ms-original-file: 2025-04-01-preview/RetentionPolicies_Update_MaximumSet_Gen.json + */ + /** + * Sample code: RetentionPolicies_Update_MaximumSet. + * + * @param manager Entry point to DurableTaskManager. + */ + public static void + retentionPoliciesUpdateMaximumSet(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { + manager.retentionPolicies() + .update("rgdurabletask", "testscheduler", + new RetentionPolicyInner().withProperties(new RetentionPolicyProperties() + .withRetentionPolicies(Arrays.asList(new RetentionPolicyDetails().withRetentionPeriodInDays(30), + new RetentionPolicyDetails().withRetentionPeriodInDays(10) + .withOrchestrationState(PurgeableOrchestrationState.FAILED), + new RetentionPolicyDetails().withRetentionPeriodInDays(24) + .withOrchestrationState(PurgeableOrchestrationState.COMPLETED)))), + com.azure.core.util.Context.NONE); + } +} +``` + +### RetentionPolicies_Delete + ```java /** * Samples for Schedulers GetByResourceGroup. */ public final class SchedulersGetByResourceGroupSamples { /* - * x-ms-original-file: 2024-10-01-preview/Schedulers_Get.json + * x-ms-original-file: 2025-04-01-preview/Schedulers_Get.json */ /** * Sample code: Schedulers_Get. @@ -42,7 +120,7 @@ public final class SchedulersGetByResourceGroupSamples { } ``` -### Schedulers_CreateOrUpdate +### RetentionPolicies_Get ```java /** @@ -50,7 +128,7 @@ public final class SchedulersGetByResourceGroupSamples { */ public final class OperationsListSamples { /* - * x-ms-original-file: 2024-10-01-preview/Operations_List.json + * x-ms-original-file: 2025-04-01-preview/Operations_List.json */ /** * Sample code: Operations_List. @@ -63,49 +141,50 @@ public final class OperationsListSamples { } ``` -### Schedulers_Delete +### RetentionPolicies_ListByScheduler ```java /** - * Samples for Schedulers ListByResourceGroup. + * Samples for RetentionPolicies Delete. */ -public final class SchedulersListByResourceGroupSamples { +public final class RetentionPoliciesDeleteSamples { /* - * x-ms-original-file: 2024-10-01-preview/Schedulers_ListByResourceGroup.json + * x-ms-original-file: 2025-04-01-preview/RetentionPolicies_Delete_MaximumSet_Gen.json */ /** - * Sample code: Schedulers_ListByResourceGroup. + * Sample code: RetentionPolicies_Delete_MaximumSet. * * @param manager Entry point to DurableTaskManager. */ - public static void schedulersListByResourceGroup(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { - manager.schedulers().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); + public static void + retentionPoliciesDeleteMaximumSet(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { + manager.retentionPolicies().delete("rgdurabletask", "testcheduler", com.azure.core.util.Context.NONE); } } ``` -### Schedulers_GetByResourceGroup +### RetentionPolicies_Update ```java /** - * Samples for TaskHubs Delete. + * Samples for Schedulers ListByResourceGroup. */ -public final class TaskHubsDeleteSamples { +public final class SchedulersListByResourceGroupSamples { /* - * x-ms-original-file: 2024-10-01-preview/TaskHubs_Delete.json + * x-ms-original-file: 2025-04-01-preview/Schedulers_ListByResourceGroup.json */ /** - * Sample code: TaskHubs_Delete. + * Sample code: Schedulers_ListByResourceGroup. * * @param manager Entry point to DurableTaskManager. */ - public static void taskHubsDelete(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { - manager.taskHubs().delete("rgopenapi", "testscheduler", "testtuskhub", com.azure.core.util.Context.NONE); + public static void schedulersListByResourceGroup(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { + manager.schedulers().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); } } ``` -### Schedulers_List +### Schedulers_CreateOrUpdate ```java /** @@ -113,7 +192,7 @@ public final class TaskHubsDeleteSamples { */ public final class TaskHubsListBySchedulerSamples { /* - * x-ms-original-file: 2024-10-01-preview/TaskHubs_ListByScheduler.json + * x-ms-original-file: 2025-04-01-preview/TaskHubs_ListByScheduler.json */ /** * Sample code: TaskHubs_ListByScheduler. @@ -121,12 +200,12 @@ public final class TaskHubsListBySchedulerSamples { * @param manager Entry point to DurableTaskManager. */ public static void taskHubsListByScheduler(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { - manager.taskHubs().listByScheduler("rgopenapi", "testtaskhub", com.azure.core.util.Context.NONE); + manager.taskHubs().listByScheduler("rgopenapi", "testscheduler", com.azure.core.util.Context.NONE); } } ``` -### Schedulers_ListByResourceGroup +### Schedulers_Delete ```java import com.azure.resourcemanager.durabletask.models.TaskHubProperties; @@ -136,7 +215,7 @@ import com.azure.resourcemanager.durabletask.models.TaskHubProperties; */ public final class TaskHubsCreateOrUpdateSamples { /* - * x-ms-original-file: 2024-10-01-preview/TaskHubs_CreateOrUpdate.json + * x-ms-original-file: 2025-04-01-preview/TaskHubs_CreateOrUpdate.json */ /** * Sample code: TaskHubs_CreateOrUpdate. @@ -153,36 +232,37 @@ public final class TaskHubsCreateOrUpdateSamples { } ``` -### Schedulers_Update +### Schedulers_GetByResourceGroup ```java -import com.azure.resourcemanager.durabletask.models.SchedulerProperties; -import com.azure.resourcemanager.durabletask.models.SchedulerSku; +import com.azure.resourcemanager.durabletask.models.Scheduler; +import com.azure.resourcemanager.durabletask.models.SchedulerPropertiesUpdate; +import com.azure.resourcemanager.durabletask.models.SchedulerSkuUpdate; import java.util.Arrays; import java.util.HashMap; import java.util.Map; /** - * Samples for Schedulers CreateOrUpdate. + * Samples for Schedulers Update. */ -public final class SchedulersCreateOrUpdateSamples { +public final class SchedulersUpdateSamples { /* - * x-ms-original-file: 2024-10-01-preview/Schedulers_CreateOrUpdate.json + * x-ms-original-file: 2025-04-01-preview/Schedulers_Update.json */ /** - * Sample code: Schedulers_CreateOrUpdate. + * Sample code: Schedulers_Update. * * @param manager Entry point to DurableTaskManager. */ - public static void schedulersCreateOrUpdate(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { - manager.schedulers() - .define("testscheduler") - .withRegion("northcentralus") - .withExistingResourceGroup("rgopenapi") - .withTags(mapOf("key7131", "fakeTokenPlaceholder", "key2138", "fakeTokenPlaceholder")) - .withProperties(new SchedulerProperties().withIpAllowlist(Arrays.asList("10.0.0.0/8")) - .withSku(new SchedulerSku().withName("Dedicated"))) - .create(); + public static void schedulersUpdate(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { + Scheduler resource = manager.schedulers() + .getByResourceGroupWithResponse("rgopenapi", "testscheduler", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("hello", "world")) + .withProperties(new SchedulerPropertiesUpdate().withIpAllowlist(Arrays.asList("10.0.0.0/8")) + .withSku(new SchedulerSkuUpdate().withName("Dedicated").withCapacity(3))) + .apply(); } // Use "Map.of" if available @@ -199,59 +279,100 @@ public final class SchedulersCreateOrUpdateSamples { } ``` -### TaskHubs_CreateOrUpdate +### Schedulers_List ```java /** - * Samples for TaskHubs Get. + * Samples for Schedulers Delete. */ -public final class TaskHubsGetSamples { +public final class SchedulersDeleteSamples { /* - * x-ms-original-file: 2024-10-01-preview/TaskHubs_Get.json + * x-ms-original-file: 2025-04-01-preview/Schedulers_Delete.json */ /** - * Sample code: TaskHubs_Get. + * Sample code: Schedulers_Delete. * * @param manager Entry point to DurableTaskManager. */ - public static void taskHubsGet(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { - manager.taskHubs() - .getWithResponse("rgopenapi", "testscheduler", "testtuskhub", com.azure.core.util.Context.NONE); + public static void schedulersDelete(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { + manager.schedulers().delete("rgopenapi", "testscheduler", com.azure.core.util.Context.NONE); } } ``` -### TaskHubs_Delete +### Schedulers_ListByResourceGroup ```java -import com.azure.resourcemanager.durabletask.models.Scheduler; -import com.azure.resourcemanager.durabletask.models.SchedulerPropertiesUpdate; -import com.azure.resourcemanager.durabletask.models.SchedulerSkuUpdate; +/** + * Samples for RetentionPolicies ListByScheduler. + */ +public final class RetentionPoliciesListBySchedulerSamples { + /* + * x-ms-original-file: 2025-04-01-preview/RetentionPolicies_ListByScheduler_MaximumSet_Gen.json + */ + /** + * Sample code: RetentionPolicies_ListByScheduler_MaximumSet. + * + * @param manager Entry point to DurableTaskManager. + */ + public static void + retentionPoliciesListBySchedulerMaximumSet(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { + manager.retentionPolicies().listByScheduler("rgdurabletask", "myscheduler", com.azure.core.util.Context.NONE); + } +} +``` + +### Schedulers_Update + +```java +/** + * Samples for TaskHubs Delete. + */ +public final class TaskHubsDeleteSamples { + /* + * x-ms-original-file: 2025-04-01-preview/TaskHubs_Delete.json + */ + /** + * Sample code: TaskHubs_Delete. + * + * @param manager Entry point to DurableTaskManager. + */ + public static void taskHubsDelete(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { + manager.taskHubs().delete("rgopenapi", "testscheduler", "testtaskhub", com.azure.core.util.Context.NONE); + } +} +``` + +### TaskHubs_CreateOrUpdate + +```java +import com.azure.resourcemanager.durabletask.models.SchedulerProperties; +import com.azure.resourcemanager.durabletask.models.SchedulerSku; import java.util.Arrays; import java.util.HashMap; import java.util.Map; /** - * Samples for Schedulers Update. + * Samples for Schedulers CreateOrUpdate. */ -public final class SchedulersUpdateSamples { +public final class SchedulersCreateOrUpdateSamples { /* - * x-ms-original-file: 2024-10-01-preview/Schedulers_Update.json + * x-ms-original-file: 2025-04-01-preview/Schedulers_CreateOrUpdate.json */ /** - * Sample code: Schedulers_Update. + * Sample code: Schedulers_CreateOrUpdate. * * @param manager Entry point to DurableTaskManager. */ - public static void schedulersUpdate(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { - Scheduler resource = manager.schedulers() - .getByResourceGroupWithResponse("rgopenapi", "testscheduler", com.azure.core.util.Context.NONE) - .getValue(); - resource.update() - .withTags(mapOf("key8653", "fakeTokenPlaceholder")) - .withProperties(new SchedulerPropertiesUpdate().withIpAllowlist(Arrays.asList("10.0.0.0/8")) - .withSku(new SchedulerSkuUpdate().withName("Dedicated").withCapacity(10))) - .apply(); + public static void schedulersCreateOrUpdate(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { + manager.schedulers() + .define("testscheduler") + .withRegion("northcentralus") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf("department", "research", "development", "true")) + .withProperties(new SchedulerProperties().withIpAllowlist(Arrays.asList("10.0.0.0/8")) + .withSku(new SchedulerSku().withName("Dedicated"))) + .create(); } // Use "Map.of" if available @@ -268,23 +389,46 @@ public final class SchedulersUpdateSamples { } ``` +### TaskHubs_Delete + +```java +/** + * Samples for RetentionPolicies Get. + */ +public final class RetentionPoliciesGetSamples { + /* + * x-ms-original-file: 2025-04-01-preview/RetentionPolicies_Get_MaximumSet_Gen.json + */ + /** + * Sample code: RetentionPolicies_Get_MaximumSet. + * + * @param manager Entry point to DurableTaskManager. + */ + public static void + retentionPoliciesGetMaximumSet(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { + manager.retentionPolicies().getWithResponse("rgdurabletask", "testscheduler", com.azure.core.util.Context.NONE); + } +} +``` + ### TaskHubs_Get ```java /** - * Samples for Schedulers Delete. + * Samples for TaskHubs Get. */ -public final class SchedulersDeleteSamples { +public final class TaskHubsGetSamples { /* - * x-ms-original-file: 2024-10-01-preview/Schedulers_Delete.json + * x-ms-original-file: 2025-04-01-preview/TaskHubs_Get.json */ /** - * Sample code: Schedulers_Delete. + * Sample code: TaskHubs_Get. * * @param manager Entry point to DurableTaskManager. */ - public static void schedulersDelete(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { - manager.schedulers().delete("rgopenapi", "testscheduler", com.azure.core.util.Context.NONE); + public static void taskHubsGet(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { + manager.taskHubs() + .getWithResponse("rgopenapi", "testscheduler", "testtaskhub", com.azure.core.util.Context.NONE); } } ``` @@ -297,7 +441,7 @@ public final class SchedulersDeleteSamples { */ public final class SchedulersListSamples { /* - * x-ms-original-file: 2024-10-01-preview/Schedulers_ListBySubscription.json + * x-ms-original-file: 2025-04-01-preview/Schedulers_ListBySubscription.json */ /** * Sample code: Schedulers_ListBySubscription. diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/DurableTaskManager.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/DurableTaskManager.java index 745ad906acaf..0ad055c47ba3 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/DurableTaskManager.java +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/DurableTaskManager.java @@ -27,9 +27,11 @@ import com.azure.resourcemanager.durabletask.fluent.DurableTaskManagementClient; import com.azure.resourcemanager.durabletask.implementation.DurableTaskManagementClientBuilder; import com.azure.resourcemanager.durabletask.implementation.OperationsImpl; +import com.azure.resourcemanager.durabletask.implementation.RetentionPoliciesImpl; import com.azure.resourcemanager.durabletask.implementation.SchedulersImpl; import com.azure.resourcemanager.durabletask.implementation.TaskHubsImpl; import com.azure.resourcemanager.durabletask.models.Operations; +import com.azure.resourcemanager.durabletask.models.RetentionPolicies; import com.azure.resourcemanager.durabletask.models.Schedulers; import com.azure.resourcemanager.durabletask.models.TaskHubs; import java.time.Duration; @@ -50,6 +52,8 @@ public final class DurableTaskManager { private TaskHubs taskHubs; + private RetentionPolicies retentionPolicies; + private final DurableTaskManagementClient clientObject; private DurableTaskManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { @@ -301,6 +305,18 @@ public TaskHubs taskHubs() { return taskHubs; } + /** + * Gets the resource collection API of RetentionPolicies. + * + * @return Resource collection API of RetentionPolicies. + */ + public RetentionPolicies retentionPolicies() { + if (this.retentionPolicies == null) { + this.retentionPolicies = new RetentionPoliciesImpl(clientObject.getRetentionPolicies(), this); + } + return retentionPolicies; + } + /** * Gets wrapped service client DurableTaskManagementClient providing direct access to the underlying auto-generated * API implementation, based on Azure REST API. diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/fluent/DurableTaskManagementClient.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/fluent/DurableTaskManagementClient.java index af6454338db8..3905cde4e231 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/fluent/DurableTaskManagementClient.java +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/fluent/DurableTaskManagementClient.java @@ -66,4 +66,11 @@ public interface DurableTaskManagementClient { * @return the TaskHubsClient object. */ TaskHubsClient getTaskHubs(); + + /** + * Gets the RetentionPoliciesClient object to access its operations. + * + * @return the RetentionPoliciesClient object. + */ + RetentionPoliciesClient getRetentionPolicies(); } diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/fluent/RetentionPoliciesClient.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/fluent/RetentionPoliciesClient.java new file mode 100644 index 000000000000..a96325328633 --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/fluent/RetentionPoliciesClient.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.durabletask.fluent.models.RetentionPolicyInner; + +/** + * An instance of this class provides access to all the operations defined in RetentionPoliciesClient. + */ +public interface RetentionPoliciesClient { + /** + * Get a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Retention Policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String schedulerName, Context context); + + /** + * Get a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Retention Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RetentionPolicyInner get(String resourceGroupName, String schedulerName); + + /** + * Create or Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a retention policy resource belonging to the scheduler. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RetentionPolicyInner> beginCreateOrReplace(String resourceGroupName, + String schedulerName, RetentionPolicyInner resource); + + /** + * Create or Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a retention policy resource belonging to the scheduler. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RetentionPolicyInner> beginCreateOrReplace(String resourceGroupName, + String schedulerName, RetentionPolicyInner resource, Context context); + + /** + * Create or Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a retention policy resource belonging to the scheduler. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RetentionPolicyInner createOrReplace(String resourceGroupName, String schedulerName, RetentionPolicyInner resource); + + /** + * Create or Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a retention policy resource belonging to the scheduler. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RetentionPolicyInner createOrReplace(String resourceGroupName, String schedulerName, RetentionPolicyInner resource, + Context context); + + /** + * Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a retention policy resource belonging to the scheduler. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RetentionPolicyInner> beginUpdate(String resourceGroupName, + String schedulerName, RetentionPolicyInner properties); + + /** + * Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a retention policy resource belonging to the scheduler. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RetentionPolicyInner> beginUpdate(String resourceGroupName, + String schedulerName, RetentionPolicyInner properties, Context context); + + /** + * Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a retention policy resource belonging to the scheduler. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RetentionPolicyInner update(String resourceGroupName, String schedulerName, RetentionPolicyInner properties); + + /** + * Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a retention policy resource belonging to the scheduler. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RetentionPolicyInner update(String resourceGroupName, String schedulerName, RetentionPolicyInner properties, + Context context); + + /** + * Delete a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String schedulerName); + + /** + * Delete a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String schedulerName, Context context); + + /** + * Delete a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String schedulerName); + + /** + * Delete a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String schedulerName, Context context); + + /** + * List Retention Policies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a RetentionPolicy list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByScheduler(String resourceGroupName, String schedulerName); + + /** + * List Retention Policies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a RetentionPolicy list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByScheduler(String resourceGroupName, String schedulerName, + Context context); +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/fluent/models/RetentionPolicyInner.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/fluent/models/RetentionPolicyInner.java new file mode 100644 index 000000000000..b519e885cc33 --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/fluent/models/RetentionPolicyInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.durabletask.models.RetentionPolicyProperties; +import java.io.IOException; + +/** + * A retention policy resource belonging to the scheduler. + */ +@Fluent +public final class RetentionPolicyInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private RetentionPolicyProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of RetentionPolicyInner class. + */ + public RetentionPolicyInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public RetentionPolicyProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the RetentionPolicyInner object itself. + */ + public RetentionPolicyInner withProperties(RetentionPolicyProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RetentionPolicyInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RetentionPolicyInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RetentionPolicyInner. + */ + public static RetentionPolicyInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RetentionPolicyInner deserializedRetentionPolicyInner = new RetentionPolicyInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRetentionPolicyInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRetentionPolicyInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRetentionPolicyInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedRetentionPolicyInner.properties = RetentionPolicyProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedRetentionPolicyInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRetentionPolicyInner; + }); + } +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/implementation/DurableTaskManagementClientImpl.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/implementation/DurableTaskManagementClientImpl.java index c82b9a992003..a3ab3dbc59e5 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/implementation/DurableTaskManagementClientImpl.java +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/implementation/DurableTaskManagementClientImpl.java @@ -25,6 +25,7 @@ import com.azure.core.util.serializer.SerializerEncoding; import com.azure.resourcemanager.durabletask.fluent.DurableTaskManagementClient; import com.azure.resourcemanager.durabletask.fluent.OperationsClient; +import com.azure.resourcemanager.durabletask.fluent.RetentionPoliciesClient; import com.azure.resourcemanager.durabletask.fluent.SchedulersClient; import com.azure.resourcemanager.durabletask.fluent.TaskHubsClient; import java.io.IOException; @@ -167,6 +168,20 @@ public TaskHubsClient getTaskHubs() { return this.taskHubs; } + /** + * The RetentionPoliciesClient object to access its operations. + */ + private final RetentionPoliciesClient retentionPolicies; + + /** + * Gets the RetentionPoliciesClient object to access its operations. + * + * @return the RetentionPoliciesClient object. + */ + public RetentionPoliciesClient getRetentionPolicies() { + return this.retentionPolicies; + } + /** * Initializes an instance of DurableTaskManagementClient client. * @@ -184,10 +199,11 @@ public TaskHubsClient getTaskHubs() { this.defaultPollInterval = defaultPollInterval; this.endpoint = endpoint; this.subscriptionId = subscriptionId; - this.apiVersion = "2024-10-01-preview"; + this.apiVersion = "2025-04-01-preview"; this.operations = new OperationsClientImpl(this); this.schedulers = new SchedulersClientImpl(this); this.taskHubs = new TaskHubsClientImpl(this); + this.retentionPolicies = new RetentionPoliciesClientImpl(this); } /** diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/implementation/RetentionPoliciesClientImpl.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/implementation/RetentionPoliciesClientImpl.java new file mode 100644 index 000000000000..804a939cac0e --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/implementation/RetentionPoliciesClientImpl.java @@ -0,0 +1,1111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.durabletask.fluent.RetentionPoliciesClient; +import com.azure.resourcemanager.durabletask.fluent.models.RetentionPolicyInner; +import com.azure.resourcemanager.durabletask.implementation.models.RetentionPolicyListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in RetentionPoliciesClient. + */ +public final class RetentionPoliciesClientImpl implements RetentionPoliciesClient { + /** + * The proxy service used to perform REST calls. + */ + private final RetentionPoliciesService service; + + /** + * The service client containing this operation class. + */ + private final DurableTaskManagementClientImpl client; + + /** + * Initializes an instance of RetentionPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RetentionPoliciesClientImpl(DurableTaskManagementClientImpl client) { + this.service + = RestProxy.create(RetentionPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DurableTaskManagementClientRetentionPolicies to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DurableTaskManagemen") + public interface RetentionPoliciesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/retentionPolicies/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("schedulerName") String schedulerName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/retentionPolicies/default") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrReplace(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("schedulerName") String schedulerName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") RetentionPolicyInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/retentionPolicies/default") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("schedulerName") String schedulerName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") RetentionPolicyInner properties, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/retentionPolicies/default") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("schedulerName") String schedulerName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DurableTask/schedulers/{schedulerName}/retentionPolicies") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByScheduler(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("schedulerName") String schedulerName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySchedulerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Retention Policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String schedulerName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (schedulerName == null) { + return Mono.error(new IllegalArgumentException("Parameter schedulerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, schedulerName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Retention Policy along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String schedulerName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (schedulerName == null) { + return Mono.error(new IllegalArgumentException("Parameter schedulerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, schedulerName, accept, context); + } + + /** + * Get a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Retention Policy on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String schedulerName) { + return getWithResponseAsync(resourceGroupName, schedulerName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Retention Policy along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String schedulerName, + Context context) { + return getWithResponseAsync(resourceGroupName, schedulerName, context).block(); + } + + /** + * Get a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Retention Policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RetentionPolicyInner get(String resourceGroupName, String schedulerName) { + return getWithResponse(resourceGroupName, schedulerName, Context.NONE).getValue(); + } + + /** + * Create or Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a retention policy resource belonging to the scheduler along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrReplaceWithResponseAsync(String resourceGroupName, + String schedulerName, RetentionPolicyInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (schedulerName == null) { + return Mono.error(new IllegalArgumentException("Parameter schedulerName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrReplace(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, schedulerName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a retention policy resource belonging to the scheduler along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrReplaceWithResponseAsync(String resourceGroupName, + String schedulerName, RetentionPolicyInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (schedulerName == null) { + return Mono.error(new IllegalArgumentException("Parameter schedulerName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrReplace(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, schedulerName, contentType, accept, resource, context); + } + + /** + * Create or Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a retention policy resource belonging to the scheduler. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RetentionPolicyInner> + beginCreateOrReplaceAsync(String resourceGroupName, String schedulerName, RetentionPolicyInner resource) { + Mono>> mono + = createOrReplaceWithResponseAsync(resourceGroupName, schedulerName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + RetentionPolicyInner.class, RetentionPolicyInner.class, this.client.getContext()); + } + + /** + * Create or Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a retention policy resource belonging to the scheduler. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RetentionPolicyInner> beginCreateOrReplaceAsync( + String resourceGroupName, String schedulerName, RetentionPolicyInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrReplaceWithResponseAsync(resourceGroupName, schedulerName, resource, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + RetentionPolicyInner.class, RetentionPolicyInner.class, context); + } + + /** + * Create or Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a retention policy resource belonging to the scheduler. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RetentionPolicyInner> + beginCreateOrReplace(String resourceGroupName, String schedulerName, RetentionPolicyInner resource) { + return this.beginCreateOrReplaceAsync(resourceGroupName, schedulerName, resource).getSyncPoller(); + } + + /** + * Create or Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a retention policy resource belonging to the scheduler. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RetentionPolicyInner> beginCreateOrReplace( + String resourceGroupName, String schedulerName, RetentionPolicyInner resource, Context context) { + return this.beginCreateOrReplaceAsync(resourceGroupName, schedulerName, resource, context).getSyncPoller(); + } + + /** + * Create or Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a retention policy resource belonging to the scheduler on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrReplaceAsync(String resourceGroupName, String schedulerName, + RetentionPolicyInner resource) { + return beginCreateOrReplaceAsync(resourceGroupName, schedulerName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a retention policy resource belonging to the scheduler on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrReplaceAsync(String resourceGroupName, String schedulerName, + RetentionPolicyInner resource, Context context) { + return beginCreateOrReplaceAsync(resourceGroupName, schedulerName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a retention policy resource belonging to the scheduler. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RetentionPolicyInner createOrReplace(String resourceGroupName, String schedulerName, + RetentionPolicyInner resource) { + return createOrReplaceAsync(resourceGroupName, schedulerName, resource).block(); + } + + /** + * Create or Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a retention policy resource belonging to the scheduler. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RetentionPolicyInner createOrReplace(String resourceGroupName, String schedulerName, + RetentionPolicyInner resource, Context context) { + return createOrReplaceAsync(resourceGroupName, schedulerName, resource, context).block(); + } + + /** + * Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a retention policy resource belonging to the scheduler along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String schedulerName, + RetentionPolicyInner properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (schedulerName == null) { + return Mono.error(new IllegalArgumentException("Parameter schedulerName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, schedulerName, contentType, accept, properties, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a retention policy resource belonging to the scheduler along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String schedulerName, + RetentionPolicyInner properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (schedulerName == null) { + return Mono.error(new IllegalArgumentException("Parameter schedulerName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, schedulerName, contentType, accept, properties, context); + } + + /** + * Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a retention policy resource belonging to the scheduler. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RetentionPolicyInner> + beginUpdateAsync(String resourceGroupName, String schedulerName, RetentionPolicyInner properties) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, schedulerName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + RetentionPolicyInner.class, RetentionPolicyInner.class, this.client.getContext()); + } + + /** + * Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a retention policy resource belonging to the scheduler. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RetentionPolicyInner> beginUpdateAsync( + String resourceGroupName, String schedulerName, RetentionPolicyInner properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, schedulerName, properties, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + RetentionPolicyInner.class, RetentionPolicyInner.class, context); + } + + /** + * Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a retention policy resource belonging to the scheduler. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RetentionPolicyInner> beginUpdate(String resourceGroupName, + String schedulerName, RetentionPolicyInner properties) { + return this.beginUpdateAsync(resourceGroupName, schedulerName, properties).getSyncPoller(); + } + + /** + * Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a retention policy resource belonging to the scheduler. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RetentionPolicyInner> beginUpdate(String resourceGroupName, + String schedulerName, RetentionPolicyInner properties, Context context) { + return this.beginUpdateAsync(resourceGroupName, schedulerName, properties, context).getSyncPoller(); + } + + /** + * Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a retention policy resource belonging to the scheduler on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String schedulerName, + RetentionPolicyInner properties) { + return beginUpdateAsync(resourceGroupName, schedulerName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a retention policy resource belonging to the scheduler on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String schedulerName, + RetentionPolicyInner properties, Context context) { + return beginUpdateAsync(resourceGroupName, schedulerName, properties, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a retention policy resource belonging to the scheduler. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RetentionPolicyInner update(String resourceGroupName, String schedulerName, + RetentionPolicyInner properties) { + return updateAsync(resourceGroupName, schedulerName, properties).block(); + } + + /** + * Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a retention policy resource belonging to the scheduler. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RetentionPolicyInner update(String resourceGroupName, String schedulerName, RetentionPolicyInner properties, + Context context) { + return updateAsync(resourceGroupName, schedulerName, properties, context).block(); + } + + /** + * Delete a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String schedulerName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (schedulerName == null) { + return Mono.error(new IllegalArgumentException("Parameter schedulerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, schedulerName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String schedulerName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (schedulerName == null) { + return Mono.error(new IllegalArgumentException("Parameter schedulerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, schedulerName, accept, context); + } + + /** + * Delete a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String schedulerName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, schedulerName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String schedulerName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, schedulerName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String schedulerName) { + return this.beginDeleteAsync(resourceGroupName, schedulerName).getSyncPoller(); + } + + /** + * Delete a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String schedulerName, + Context context) { + return this.beginDeleteAsync(resourceGroupName, schedulerName, context).getSyncPoller(); + } + + /** + * Delete a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String schedulerName) { + return beginDeleteAsync(resourceGroupName, schedulerName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String schedulerName, Context context) { + return beginDeleteAsync(resourceGroupName, schedulerName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String schedulerName) { + deleteAsync(resourceGroupName, schedulerName).block(); + } + + /** + * Delete a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String schedulerName, Context context) { + deleteAsync(resourceGroupName, schedulerName, context).block(); + } + + /** + * List Retention Policies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a RetentionPolicy list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchedulerSinglePageAsync(String resourceGroupName, + String schedulerName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (schedulerName == null) { + return Mono.error(new IllegalArgumentException("Parameter schedulerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByScheduler(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, schedulerName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List Retention Policies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a RetentionPolicy list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchedulerSinglePageAsync(String resourceGroupName, + String schedulerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (schedulerName == null) { + return Mono.error(new IllegalArgumentException("Parameter schedulerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByScheduler(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, schedulerName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List Retention Policies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a RetentionPolicy list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySchedulerAsync(String resourceGroupName, String schedulerName) { + return new PagedFlux<>(() -> listBySchedulerSinglePageAsync(resourceGroupName, schedulerName), + nextLink -> listBySchedulerNextSinglePageAsync(nextLink)); + } + + /** + * List Retention Policies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a RetentionPolicy list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySchedulerAsync(String resourceGroupName, String schedulerName, + Context context) { + return new PagedFlux<>(() -> listBySchedulerSinglePageAsync(resourceGroupName, schedulerName, context), + nextLink -> listBySchedulerNextSinglePageAsync(nextLink, context)); + } + + /** + * List Retention Policies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a RetentionPolicy list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByScheduler(String resourceGroupName, String schedulerName) { + return new PagedIterable<>(listBySchedulerAsync(resourceGroupName, schedulerName)); + } + + /** + * List Retention Policies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a RetentionPolicy list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByScheduler(String resourceGroupName, String schedulerName, + Context context) { + return new PagedIterable<>(listBySchedulerAsync(resourceGroupName, schedulerName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a RetentionPolicy list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchedulerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listBySchedulerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a RetentionPolicy list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySchedulerNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listBySchedulerNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/implementation/RetentionPoliciesImpl.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/implementation/RetentionPoliciesImpl.java new file mode 100644 index 000000000000..c77daae36e12 --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/implementation/RetentionPoliciesImpl.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.durabletask.fluent.RetentionPoliciesClient; +import com.azure.resourcemanager.durabletask.fluent.models.RetentionPolicyInner; +import com.azure.resourcemanager.durabletask.models.RetentionPolicies; +import com.azure.resourcemanager.durabletask.models.RetentionPolicy; + +public final class RetentionPoliciesImpl implements RetentionPolicies { + private static final ClientLogger LOGGER = new ClientLogger(RetentionPoliciesImpl.class); + + private final RetentionPoliciesClient innerClient; + + private final com.azure.resourcemanager.durabletask.DurableTaskManager serviceManager; + + public RetentionPoliciesImpl(RetentionPoliciesClient innerClient, + com.azure.resourcemanager.durabletask.DurableTaskManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String schedulerName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, schedulerName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RetentionPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RetentionPolicy get(String resourceGroupName, String schedulerName) { + RetentionPolicyInner inner = this.serviceClient().get(resourceGroupName, schedulerName); + if (inner != null) { + return new RetentionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public RetentionPolicy createOrReplace(String resourceGroupName, String schedulerName, + RetentionPolicyInner resource) { + RetentionPolicyInner inner = this.serviceClient().createOrReplace(resourceGroupName, schedulerName, resource); + if (inner != null) { + return new RetentionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public RetentionPolicy createOrReplace(String resourceGroupName, String schedulerName, + RetentionPolicyInner resource, Context context) { + RetentionPolicyInner inner + = this.serviceClient().createOrReplace(resourceGroupName, schedulerName, resource, context); + if (inner != null) { + return new RetentionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public RetentionPolicy update(String resourceGroupName, String schedulerName, RetentionPolicyInner properties) { + RetentionPolicyInner inner = this.serviceClient().update(resourceGroupName, schedulerName, properties); + if (inner != null) { + return new RetentionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public RetentionPolicy update(String resourceGroupName, String schedulerName, RetentionPolicyInner properties, + Context context) { + RetentionPolicyInner inner = this.serviceClient().update(resourceGroupName, schedulerName, properties, context); + if (inner != null) { + return new RetentionPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String schedulerName) { + this.serviceClient().delete(resourceGroupName, schedulerName); + } + + public void delete(String resourceGroupName, String schedulerName, Context context) { + this.serviceClient().delete(resourceGroupName, schedulerName, context); + } + + public PagedIterable listByScheduler(String resourceGroupName, String schedulerName) { + PagedIterable inner + = this.serviceClient().listByScheduler(resourceGroupName, schedulerName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new RetentionPolicyImpl(inner1, this.manager())); + } + + public PagedIterable listByScheduler(String resourceGroupName, String schedulerName, + Context context) { + PagedIterable inner + = this.serviceClient().listByScheduler(resourceGroupName, schedulerName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new RetentionPolicyImpl(inner1, this.manager())); + } + + private RetentionPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.durabletask.DurableTaskManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/implementation/RetentionPolicyImpl.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/implementation/RetentionPolicyImpl.java new file mode 100644 index 000000000000..780522b3b3e8 --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/implementation/RetentionPolicyImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.durabletask.fluent.models.RetentionPolicyInner; +import com.azure.resourcemanager.durabletask.models.RetentionPolicy; +import com.azure.resourcemanager.durabletask.models.RetentionPolicyProperties; + +public final class RetentionPolicyImpl implements RetentionPolicy { + private RetentionPolicyInner innerObject; + + private final com.azure.resourcemanager.durabletask.DurableTaskManager serviceManager; + + RetentionPolicyImpl(RetentionPolicyInner innerObject, + com.azure.resourcemanager.durabletask.DurableTaskManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public RetentionPolicyProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public RetentionPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.durabletask.DurableTaskManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/implementation/models/RetentionPolicyListResult.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/implementation/models/RetentionPolicyListResult.java new file mode 100644 index 000000000000..c5ea9b5e4f51 --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/implementation/models/RetentionPolicyListResult.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.durabletask.fluent.models.RetentionPolicyInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a RetentionPolicy list operation. + */ +@Immutable +public final class RetentionPolicyListResult implements JsonSerializable { + /* + * The RetentionPolicy items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of RetentionPolicyListResult class. + */ + private RetentionPolicyListResult() { + } + + /** + * Get the value property: The RetentionPolicy items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property value in model RetentionPolicyListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RetentionPolicyListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RetentionPolicyListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RetentionPolicyListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RetentionPolicyListResult. + */ + public static RetentionPolicyListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RetentionPolicyListResult deserializedRetentionPolicyListResult = new RetentionPolicyListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> RetentionPolicyInner.fromJson(reader1)); + deserializedRetentionPolicyListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedRetentionPolicyListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRetentionPolicyListResult; + }); + } +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/models/PurgeableOrchestrationState.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/models/PurgeableOrchestrationState.java new file mode 100644 index 000000000000..ace107220ada --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/models/PurgeableOrchestrationState.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Purgeable orchestration state to be used in retention policies. + */ +public final class PurgeableOrchestrationState extends ExpandableStringEnum { + /** + * The orchestration is completed. + */ + public static final PurgeableOrchestrationState COMPLETED = fromString("Completed"); + + /** + * The orchestration is failed. + */ + public static final PurgeableOrchestrationState FAILED = fromString("Failed"); + + /** + * The orchestration is terminated. + */ + public static final PurgeableOrchestrationState TERMINATED = fromString("Terminated"); + + /** + * The orchestration is canceled. + */ + public static final PurgeableOrchestrationState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of PurgeableOrchestrationState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PurgeableOrchestrationState() { + } + + /** + * Creates or finds a PurgeableOrchestrationState from its string representation. + * + * @param name a name to look for. + * @return the corresponding PurgeableOrchestrationState. + */ + public static PurgeableOrchestrationState fromString(String name) { + return fromString(name, PurgeableOrchestrationState.class); + } + + /** + * Gets known PurgeableOrchestrationState values. + * + * @return known PurgeableOrchestrationState values. + */ + public static Collection values() { + return values(PurgeableOrchestrationState.class); + } +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/models/RetentionPolicies.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/models/RetentionPolicies.java new file mode 100644 index 000000000000..cafa36080cd8 --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/models/RetentionPolicies.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.durabletask.fluent.models.RetentionPolicyInner; + +/** + * Resource collection API of RetentionPolicies. + */ +public interface RetentionPolicies { + /** + * Get a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Retention Policy along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String schedulerName, Context context); + + /** + * Get a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Retention Policy. + */ + RetentionPolicy get(String resourceGroupName, String schedulerName); + + /** + * Create or Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a retention policy resource belonging to the scheduler. + */ + RetentionPolicy createOrReplace(String resourceGroupName, String schedulerName, RetentionPolicyInner resource); + + /** + * Create or Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a retention policy resource belonging to the scheduler. + */ + RetentionPolicy createOrReplace(String resourceGroupName, String schedulerName, RetentionPolicyInner resource, + Context context); + + /** + * Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a retention policy resource belonging to the scheduler. + */ + RetentionPolicy update(String resourceGroupName, String schedulerName, RetentionPolicyInner properties); + + /** + * Update a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a retention policy resource belonging to the scheduler. + */ + RetentionPolicy update(String resourceGroupName, String schedulerName, RetentionPolicyInner properties, + Context context); + + /** + * Delete a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String schedulerName); + + /** + * Delete a Retention Policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String schedulerName, Context context); + + /** + * List Retention Policies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a RetentionPolicy list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByScheduler(String resourceGroupName, String schedulerName); + + /** + * List Retention Policies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param schedulerName The name of the Scheduler. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a RetentionPolicy list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByScheduler(String resourceGroupName, String schedulerName, Context context); +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/models/RetentionPolicy.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/models/RetentionPolicy.java new file mode 100644 index 000000000000..03ffe8bdfa90 --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/models/RetentionPolicy.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.durabletask.fluent.models.RetentionPolicyInner; + +/** + * An immutable client-side representation of RetentionPolicy. + */ +public interface RetentionPolicy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + RetentionPolicyProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.durabletask.fluent.models.RetentionPolicyInner object. + * + * @return the inner object. + */ + RetentionPolicyInner innerModel(); +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/models/RetentionPolicyDetails.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/models/RetentionPolicyDetails.java new file mode 100644 index 000000000000..1c7ecb892b0d --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/models/RetentionPolicyDetails.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of a retention policy. + */ +@Fluent +public final class RetentionPolicyDetails implements JsonSerializable { + /* + * The retention period in days after which the orchestration will be purged automatically + */ + private int retentionPeriodInDays; + + /* + * The orchestration state to which this policy applies. If omitted, the policy applies to all purgeable + * orchestration states. + */ + private PurgeableOrchestrationState orchestrationState; + + /** + * Creates an instance of RetentionPolicyDetails class. + */ + public RetentionPolicyDetails() { + } + + /** + * Get the retentionPeriodInDays property: The retention period in days after which the orchestration will be purged + * automatically. + * + * @return the retentionPeriodInDays value. + */ + public int retentionPeriodInDays() { + return this.retentionPeriodInDays; + } + + /** + * Set the retentionPeriodInDays property: The retention period in days after which the orchestration will be purged + * automatically. + * + * @param retentionPeriodInDays the retentionPeriodInDays value to set. + * @return the RetentionPolicyDetails object itself. + */ + public RetentionPolicyDetails withRetentionPeriodInDays(int retentionPeriodInDays) { + this.retentionPeriodInDays = retentionPeriodInDays; + return this; + } + + /** + * Get the orchestrationState property: The orchestration state to which this policy applies. If omitted, the policy + * applies to all purgeable orchestration states. + * + * @return the orchestrationState value. + */ + public PurgeableOrchestrationState orchestrationState() { + return this.orchestrationState; + } + + /** + * Set the orchestrationState property: The orchestration state to which this policy applies. If omitted, the policy + * applies to all purgeable orchestration states. + * + * @param orchestrationState the orchestrationState value to set. + * @return the RetentionPolicyDetails object itself. + */ + public RetentionPolicyDetails withOrchestrationState(PurgeableOrchestrationState orchestrationState) { + this.orchestrationState = orchestrationState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeIntField("retentionPeriodInDays", this.retentionPeriodInDays); + jsonWriter.writeStringField("orchestrationState", + this.orchestrationState == null ? null : this.orchestrationState.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RetentionPolicyDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RetentionPolicyDetails if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RetentionPolicyDetails. + */ + public static RetentionPolicyDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RetentionPolicyDetails deserializedRetentionPolicyDetails = new RetentionPolicyDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("retentionPeriodInDays".equals(fieldName)) { + deserializedRetentionPolicyDetails.retentionPeriodInDays = reader.getInt(); + } else if ("orchestrationState".equals(fieldName)) { + deserializedRetentionPolicyDetails.orchestrationState + = PurgeableOrchestrationState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedRetentionPolicyDetails; + }); + } +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/models/RetentionPolicyProperties.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/models/RetentionPolicyProperties.java new file mode 100644 index 000000000000..ab1212371608 --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/java/com/azure/resourcemanager/durabletask/models/RetentionPolicyProperties.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The retention policy settings for the resource. + */ +@Fluent +public final class RetentionPolicyProperties implements JsonSerializable { + /* + * The status of the last operation + */ + private ProvisioningState provisioningState; + + /* + * The orchestration retention policies + */ + private List retentionPolicies; + + /** + * Creates an instance of RetentionPolicyProperties class. + */ + public RetentionPolicyProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the retentionPolicies property: The orchestration retention policies. + * + * @return the retentionPolicies value. + */ + public List retentionPolicies() { + return this.retentionPolicies; + } + + /** + * Set the retentionPolicies property: The orchestration retention policies. + * + * @param retentionPolicies the retentionPolicies value to set. + * @return the RetentionPolicyProperties object itself. + */ + public RetentionPolicyProperties withRetentionPolicies(List retentionPolicies) { + this.retentionPolicies = retentionPolicies; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (retentionPolicies() != null) { + retentionPolicies().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("retentionPolicies", this.retentionPolicies, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RetentionPolicyProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RetentionPolicyProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RetentionPolicyProperties. + */ + public static RetentionPolicyProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RetentionPolicyProperties deserializedRetentionPolicyProperties = new RetentionPolicyProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedRetentionPolicyProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("retentionPolicies".equals(fieldName)) { + List retentionPolicies + = reader.readArray(reader1 -> RetentionPolicyDetails.fromJson(reader1)); + deserializedRetentionPolicyProperties.retentionPolicies = retentionPolicies; + } else { + reader.skipChildren(); + } + } + + return deserializedRetentionPolicyProperties; + }); + } +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-durabletask/proxy-config.json b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-durabletask/proxy-config.json index 4b7b3074fd51..5ff5841f3b3a 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-durabletask/proxy-config.json +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-durabletask/proxy-config.json @@ -1 +1 @@ -[["com.azure.resourcemanager.durabletask.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.durabletask.implementation.SchedulersClientImpl$SchedulersService"],["com.azure.resourcemanager.durabletask.implementation.TaskHubsClientImpl$TaskHubsService"]] \ No newline at end of file +[["com.azure.resourcemanager.durabletask.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.durabletask.implementation.RetentionPoliciesClientImpl$RetentionPoliciesService"],["com.azure.resourcemanager.durabletask.implementation.SchedulersClientImpl$SchedulersService"],["com.azure.resourcemanager.durabletask.implementation.TaskHubsClientImpl$TaskHubsService"]] \ No newline at end of file diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/OperationsListSamples.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/OperationsListSamples.java index b231a18a548f..b195ec8539a3 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/OperationsListSamples.java +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/OperationsListSamples.java @@ -9,7 +9,7 @@ */ public final class OperationsListSamples { /* - * x-ms-original-file: 2024-10-01-preview/Operations_List.json + * x-ms-original-file: 2025-04-01-preview/Operations_List.json */ /** * Sample code: Operations_List. diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesCreateOrReplaceSamples.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesCreateOrReplaceSamples.java new file mode 100644 index 000000000000..06906f98f460 --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesCreateOrReplaceSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.generated; + +import com.azure.resourcemanager.durabletask.fluent.models.RetentionPolicyInner; +import com.azure.resourcemanager.durabletask.models.PurgeableOrchestrationState; +import com.azure.resourcemanager.durabletask.models.RetentionPolicyDetails; +import com.azure.resourcemanager.durabletask.models.RetentionPolicyProperties; +import java.util.Arrays; + +/** + * Samples for RetentionPolicies CreateOrReplace. + */ +public final class RetentionPoliciesCreateOrReplaceSamples { + /* + * x-ms-original-file: 2025-04-01-preview/RetentionPolicies_CreateOrReplace_MaximumSet_Gen.json + */ + /** + * Sample code: RetentionPolicies_CreateOrReplace_MaximumSet. + * + * @param manager Entry point to DurableTaskManager. + */ + public static void + retentionPoliciesCreateOrReplaceMaximumSet(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { + manager.retentionPolicies() + .createOrReplace("rgdurabletask", "testscheduler", + new RetentionPolicyInner().withProperties(new RetentionPolicyProperties() + .withRetentionPolicies(Arrays.asList(new RetentionPolicyDetails().withRetentionPeriodInDays(30), + new RetentionPolicyDetails().withRetentionPeriodInDays(10) + .withOrchestrationState(PurgeableOrchestrationState.FAILED)))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesDeleteSamples.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesDeleteSamples.java new file mode 100644 index 000000000000..153cacf5f7d2 --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.generated; + +/** + * Samples for RetentionPolicies Delete. + */ +public final class RetentionPoliciesDeleteSamples { + /* + * x-ms-original-file: 2025-04-01-preview/RetentionPolicies_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: RetentionPolicies_Delete_MaximumSet. + * + * @param manager Entry point to DurableTaskManager. + */ + public static void + retentionPoliciesDeleteMaximumSet(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { + manager.retentionPolicies().delete("rgdurabletask", "testcheduler", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesGetSamples.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesGetSamples.java new file mode 100644 index 000000000000..f3e483a409df --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.generated; + +/** + * Samples for RetentionPolicies Get. + */ +public final class RetentionPoliciesGetSamples { + /* + * x-ms-original-file: 2025-04-01-preview/RetentionPolicies_Get_MaximumSet_Gen.json + */ + /** + * Sample code: RetentionPolicies_Get_MaximumSet. + * + * @param manager Entry point to DurableTaskManager. + */ + public static void + retentionPoliciesGetMaximumSet(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { + manager.retentionPolicies().getWithResponse("rgdurabletask", "testscheduler", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesListBySchedulerSamples.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesListBySchedulerSamples.java new file mode 100644 index 000000000000..4da1ecac539d --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesListBySchedulerSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.generated; + +/** + * Samples for RetentionPolicies ListByScheduler. + */ +public final class RetentionPoliciesListBySchedulerSamples { + /* + * x-ms-original-file: 2025-04-01-preview/RetentionPolicies_ListByScheduler_MaximumSet_Gen.json + */ + /** + * Sample code: RetentionPolicies_ListByScheduler_MaximumSet. + * + * @param manager Entry point to DurableTaskManager. + */ + public static void + retentionPoliciesListBySchedulerMaximumSet(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { + manager.retentionPolicies().listByScheduler("rgdurabletask", "myscheduler", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesUpdateSamples.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesUpdateSamples.java new file mode 100644 index 000000000000..926d9d2a63c6 --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesUpdateSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.generated; + +import com.azure.resourcemanager.durabletask.fluent.models.RetentionPolicyInner; +import com.azure.resourcemanager.durabletask.models.PurgeableOrchestrationState; +import com.azure.resourcemanager.durabletask.models.RetentionPolicyDetails; +import com.azure.resourcemanager.durabletask.models.RetentionPolicyProperties; +import java.util.Arrays; + +/** + * Samples for RetentionPolicies Update. + */ +public final class RetentionPoliciesUpdateSamples { + /* + * x-ms-original-file: 2025-04-01-preview/RetentionPolicies_Update_MaximumSet_Gen.json + */ + /** + * Sample code: RetentionPolicies_Update_MaximumSet. + * + * @param manager Entry point to DurableTaskManager. + */ + public static void + retentionPoliciesUpdateMaximumSet(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { + manager.retentionPolicies() + .update("rgdurabletask", "testscheduler", + new RetentionPolicyInner().withProperties(new RetentionPolicyProperties() + .withRetentionPolicies(Arrays.asList(new RetentionPolicyDetails().withRetentionPeriodInDays(30), + new RetentionPolicyDetails().withRetentionPeriodInDays(10) + .withOrchestrationState(PurgeableOrchestrationState.FAILED), + new RetentionPolicyDetails().withRetentionPeriodInDays(24) + .withOrchestrationState(PurgeableOrchestrationState.COMPLETED)))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersCreateOrUpdateSamples.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersCreateOrUpdateSamples.java index d0df8bda6d24..f6524412b0f7 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersCreateOrUpdateSamples.java +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersCreateOrUpdateSamples.java @@ -15,7 +15,7 @@ */ public final class SchedulersCreateOrUpdateSamples { /* - * x-ms-original-file: 2024-10-01-preview/Schedulers_CreateOrUpdate.json + * x-ms-original-file: 2025-04-01-preview/Schedulers_CreateOrUpdate.json */ /** * Sample code: Schedulers_CreateOrUpdate. @@ -27,7 +27,7 @@ public static void schedulersCreateOrUpdate(com.azure.resourcemanager.durabletas .define("testscheduler") .withRegion("northcentralus") .withExistingResourceGroup("rgopenapi") - .withTags(mapOf("key7131", "fakeTokenPlaceholder", "key2138", "fakeTokenPlaceholder")) + .withTags(mapOf("department", "research", "development", "true")) .withProperties(new SchedulerProperties().withIpAllowlist(Arrays.asList("10.0.0.0/8")) .withSku(new SchedulerSku().withName("Dedicated"))) .create(); diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersDeleteSamples.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersDeleteSamples.java index 82c1efe618d7..37bc3accaf39 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersDeleteSamples.java +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersDeleteSamples.java @@ -9,7 +9,7 @@ */ public final class SchedulersDeleteSamples { /* - * x-ms-original-file: 2024-10-01-preview/Schedulers_Delete.json + * x-ms-original-file: 2025-04-01-preview/Schedulers_Delete.json */ /** * Sample code: Schedulers_Delete. diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersGetByResourceGroupSamples.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersGetByResourceGroupSamples.java index 6b6280411acb..f00d2efb6c96 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersGetByResourceGroupSamples.java +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersGetByResourceGroupSamples.java @@ -9,7 +9,7 @@ */ public final class SchedulersGetByResourceGroupSamples { /* - * x-ms-original-file: 2024-10-01-preview/Schedulers_Get.json + * x-ms-original-file: 2025-04-01-preview/Schedulers_Get.json */ /** * Sample code: Schedulers_Get. diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersListByResourceGroupSamples.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersListByResourceGroupSamples.java index b11f8064e235..1b02ac03eedb 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersListByResourceGroupSamples.java +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersListByResourceGroupSamples.java @@ -9,7 +9,7 @@ */ public final class SchedulersListByResourceGroupSamples { /* - * x-ms-original-file: 2024-10-01-preview/Schedulers_ListByResourceGroup.json + * x-ms-original-file: 2025-04-01-preview/Schedulers_ListByResourceGroup.json */ /** * Sample code: Schedulers_ListByResourceGroup. diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersListSamples.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersListSamples.java index b7e12f4e0d2a..0062243196a8 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersListSamples.java +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersListSamples.java @@ -9,7 +9,7 @@ */ public final class SchedulersListSamples { /* - * x-ms-original-file: 2024-10-01-preview/Schedulers_ListBySubscription.json + * x-ms-original-file: 2025-04-01-preview/Schedulers_ListBySubscription.json */ /** * Sample code: Schedulers_ListBySubscription. diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersUpdateSamples.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersUpdateSamples.java index 38c7b4d39441..add01c80fdbd 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersUpdateSamples.java +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/SchedulersUpdateSamples.java @@ -16,7 +16,7 @@ */ public final class SchedulersUpdateSamples { /* - * x-ms-original-file: 2024-10-01-preview/Schedulers_Update.json + * x-ms-original-file: 2025-04-01-preview/Schedulers_Update.json */ /** * Sample code: Schedulers_Update. @@ -28,9 +28,9 @@ public static void schedulersUpdate(com.azure.resourcemanager.durabletask.Durabl .getByResourceGroupWithResponse("rgopenapi", "testscheduler", com.azure.core.util.Context.NONE) .getValue(); resource.update() - .withTags(mapOf("key8653", "fakeTokenPlaceholder")) + .withTags(mapOf("hello", "world")) .withProperties(new SchedulerPropertiesUpdate().withIpAllowlist(Arrays.asList("10.0.0.0/8")) - .withSku(new SchedulerSkuUpdate().withName("Dedicated").withCapacity(10))) + .withSku(new SchedulerSkuUpdate().withName("Dedicated").withCapacity(3))) .apply(); } diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/TaskHubsCreateOrUpdateSamples.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/TaskHubsCreateOrUpdateSamples.java index dfc27f36976c..06e199a27877 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/TaskHubsCreateOrUpdateSamples.java +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/TaskHubsCreateOrUpdateSamples.java @@ -11,7 +11,7 @@ */ public final class TaskHubsCreateOrUpdateSamples { /* - * x-ms-original-file: 2024-10-01-preview/TaskHubs_CreateOrUpdate.json + * x-ms-original-file: 2025-04-01-preview/TaskHubs_CreateOrUpdate.json */ /** * Sample code: TaskHubs_CreateOrUpdate. diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/TaskHubsDeleteSamples.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/TaskHubsDeleteSamples.java index b0f04ead9c06..9de2d92062de 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/TaskHubsDeleteSamples.java +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/TaskHubsDeleteSamples.java @@ -9,7 +9,7 @@ */ public final class TaskHubsDeleteSamples { /* - * x-ms-original-file: 2024-10-01-preview/TaskHubs_Delete.json + * x-ms-original-file: 2025-04-01-preview/TaskHubs_Delete.json */ /** * Sample code: TaskHubs_Delete. @@ -17,6 +17,6 @@ public final class TaskHubsDeleteSamples { * @param manager Entry point to DurableTaskManager. */ public static void taskHubsDelete(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { - manager.taskHubs().delete("rgopenapi", "testscheduler", "testtuskhub", com.azure.core.util.Context.NONE); + manager.taskHubs().delete("rgopenapi", "testscheduler", "testtaskhub", com.azure.core.util.Context.NONE); } } diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/TaskHubsGetSamples.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/TaskHubsGetSamples.java index 6f73418b94db..abea000506fd 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/TaskHubsGetSamples.java +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/TaskHubsGetSamples.java @@ -9,7 +9,7 @@ */ public final class TaskHubsGetSamples { /* - * x-ms-original-file: 2024-10-01-preview/TaskHubs_Get.json + * x-ms-original-file: 2025-04-01-preview/TaskHubs_Get.json */ /** * Sample code: TaskHubs_Get. @@ -18,6 +18,6 @@ public final class TaskHubsGetSamples { */ public static void taskHubsGet(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { manager.taskHubs() - .getWithResponse("rgopenapi", "testscheduler", "testtuskhub", com.azure.core.util.Context.NONE); + .getWithResponse("rgopenapi", "testscheduler", "testtaskhub", com.azure.core.util.Context.NONE); } } diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/TaskHubsListBySchedulerSamples.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/TaskHubsListBySchedulerSamples.java index 817352d06a54..0d9a4475a508 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/TaskHubsListBySchedulerSamples.java +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/samples/java/com/azure/resourcemanager/durabletask/generated/TaskHubsListBySchedulerSamples.java @@ -9,7 +9,7 @@ */ public final class TaskHubsListBySchedulerSamples { /* - * x-ms-original-file: 2024-10-01-preview/TaskHubs_ListByScheduler.json + * x-ms-original-file: 2025-04-01-preview/TaskHubs_ListByScheduler.json */ /** * Sample code: TaskHubs_ListByScheduler. @@ -17,6 +17,6 @@ public final class TaskHubsListBySchedulerSamples { * @param manager Entry point to DurableTaskManager. */ public static void taskHubsListByScheduler(com.azure.resourcemanager.durabletask.DurableTaskManager manager) { - manager.taskHubs().listByScheduler("rgopenapi", "testtaskhub", com.azure.core.util.Context.NONE); + manager.taskHubs().listByScheduler("rgopenapi", "testscheduler", com.azure.core.util.Context.NONE); } } diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/OperationsListMockTests.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/OperationsListMockTests.java index 60302523b17c..e63bc5c44daa 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/OperationsListMockTests.java +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/OperationsListMockTests.java @@ -21,7 +21,7 @@ public final class OperationsListMockTests { @Test public void testList() throws Exception { String responseStr - = "{\"value\":[{\"name\":\"umkdosvqwhbmd\",\"isDataAction\":false,\"display\":{\"provider\":\"ddgmb\",\"resource\":\"ex\",\"operation\":\"bhtqqrolfpfpsa\",\"description\":\"bquxigjy\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}]}"; + = "{\"value\":[{\"name\":\"tnwu\",\"isDataAction\":false,\"display\":{\"provider\":\"x\",\"resource\":\"izuckyfihrfidfvz\",\"operation\":\"zuhtymwisdkfthwx\",\"description\":\"t\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesCreateOrReplaceMockTests.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesCreateOrReplaceMockTests.java new file mode 100644 index 000000000000..1417f77c5992 --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesCreateOrReplaceMockTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.durabletask.DurableTaskManager; +import com.azure.resourcemanager.durabletask.fluent.models.RetentionPolicyInner; +import com.azure.resourcemanager.durabletask.models.PurgeableOrchestrationState; +import com.azure.resourcemanager.durabletask.models.RetentionPolicy; +import com.azure.resourcemanager.durabletask.models.RetentionPolicyDetails; +import com.azure.resourcemanager.durabletask.models.RetentionPolicyProperties; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class RetentionPoliciesCreateOrReplaceMockTests { + @Test + public void testCreateOrReplace() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"retentionPolicies\":[{\"retentionPeriodInDays\":1879062252,\"orchestrationState\":\"Terminated\"},{\"retentionPeriodInDays\":1856393411,\"orchestrationState\":\"Failed\"},{\"retentionPeriodInDays\":442163665,\"orchestrationState\":\"Failed\"}]},\"id\":\"ggzfbu\",\"name\":\"fmvfaxkffeiit\",\"type\":\"lvmezyvshxmzsbbz\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DurableTaskManager manager = DurableTaskManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + RetentionPolicy response = manager.retentionPolicies() + .createOrReplace("zdobpxjmflbvvnch", "kcciwwzjuqkhr", + new RetentionPolicyInner().withProperties(new RetentionPolicyProperties().withRetentionPolicies( + Arrays.asList(new RetentionPolicyDetails().withRetentionPeriodInDays(481973669) + .withOrchestrationState(PurgeableOrchestrationState.CANCELED)))), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals(1879062252, response.properties().retentionPolicies().get(0).retentionPeriodInDays()); + Assertions.assertEquals(PurgeableOrchestrationState.TERMINATED, + response.properties().retentionPolicies().get(0).orchestrationState()); + } +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesGetWithResponseMockTests.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesGetWithResponseMockTests.java new file mode 100644 index 000000000000..129cd872f7fe --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesGetWithResponseMockTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.durabletask.DurableTaskManager; +import com.azure.resourcemanager.durabletask.models.PurgeableOrchestrationState; +import com.azure.resourcemanager.durabletask.models.RetentionPolicy; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class RetentionPoliciesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Deleting\",\"retentionPolicies\":[{\"retentionPeriodInDays\":1829419035,\"orchestrationState\":\"Completed\"}]},\"id\":\"ulexxbczwtr\",\"name\":\"wiqzbqjvsovmyo\",\"type\":\"acspkwl\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DurableTaskManager manager = DurableTaskManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + RetentionPolicy response = manager.retentionPolicies() + .getWithResponse("poczvyifqrvkdvjs", "lrmv", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals(1829419035, response.properties().retentionPolicies().get(0).retentionPeriodInDays()); + Assertions.assertEquals(PurgeableOrchestrationState.COMPLETED, + response.properties().retentionPolicies().get(0).orchestrationState()); + } +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesListBySchedulerMockTests.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesListBySchedulerMockTests.java new file mode 100644 index 000000000000..f4b4d3f1a66e --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesListBySchedulerMockTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.durabletask.DurableTaskManager; +import com.azure.resourcemanager.durabletask.models.PurgeableOrchestrationState; +import com.azure.resourcemanager.durabletask.models.RetentionPolicy; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class RetentionPoliciesListBySchedulerMockTests { + @Test + public void testListByScheduler() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Failed\",\"retentionPolicies\":[{\"retentionPeriodInDays\":2127806039,\"orchestrationState\":\"Canceled\"},{\"retentionPeriodInDays\":1232407744,\"orchestrationState\":\"Completed\"},{\"retentionPeriodInDays\":1859867828,\"orchestrationState\":\"Canceled\"}]},\"id\":\"g\",\"name\":\"lpbuxwgipwhonowk\",\"type\":\"shwankixzbinje\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DurableTaskManager manager = DurableTaskManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.retentionPolicies() + .listByScheduler("yhxdeoejzicwi", "sjttgzfbish", com.azure.core.util.Context.NONE); + + Assertions.assertEquals(2127806039, + response.iterator().next().properties().retentionPolicies().get(0).retentionPeriodInDays()); + Assertions.assertEquals(PurgeableOrchestrationState.CANCELED, + response.iterator().next().properties().retentionPolicies().get(0).orchestrationState()); + } +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesUpdateMockTests.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesUpdateMockTests.java new file mode 100644 index 000000000000..2b468703bdf8 --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPoliciesUpdateMockTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.durabletask.DurableTaskManager; +import com.azure.resourcemanager.durabletask.fluent.models.RetentionPolicyInner; +import com.azure.resourcemanager.durabletask.models.PurgeableOrchestrationState; +import com.azure.resourcemanager.durabletask.models.RetentionPolicy; +import com.azure.resourcemanager.durabletask.models.RetentionPolicyDetails; +import com.azure.resourcemanager.durabletask.models.RetentionPolicyProperties; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class RetentionPoliciesUpdateMockTests { + @Test + public void testUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"retentionPolicies\":[{\"retentionPeriodInDays\":2138211196,\"orchestrationState\":\"Terminated\"},{\"retentionPeriodInDays\":523665642,\"orchestrationState\":\"Terminated\"},{\"retentionPeriodInDays\":1866473569,\"orchestrationState\":\"Terminated\"}]},\"id\":\"ukgjnpiucgygevq\",\"name\":\"ntypmrbpizcdrqj\",\"type\":\"dpydn\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DurableTaskManager manager = DurableTaskManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + RetentionPolicy response = manager.retentionPolicies() + .update("ggi", "rxwburv", + new RetentionPolicyInner().withProperties(new RetentionPolicyProperties().withRetentionPolicies( + Arrays.asList(new RetentionPolicyDetails().withRetentionPeriodInDays(1875025396) + .withOrchestrationState(PurgeableOrchestrationState.TERMINATED)))), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals(2138211196, response.properties().retentionPolicies().get(0).retentionPeriodInDays()); + Assertions.assertEquals(PurgeableOrchestrationState.TERMINATED, + response.properties().retentionPolicies().get(0).orchestrationState()); + } +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPolicyDetailsTests.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPolicyDetailsTests.java new file mode 100644 index 000000000000..365dabac4833 --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPolicyDetailsTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.durabletask.models.PurgeableOrchestrationState; +import com.azure.resourcemanager.durabletask.models.RetentionPolicyDetails; +import org.junit.jupiter.api.Assertions; + +public final class RetentionPolicyDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RetentionPolicyDetails model + = BinaryData.fromString("{\"retentionPeriodInDays\":68812306,\"orchestrationState\":\"Failed\"}") + .toObject(RetentionPolicyDetails.class); + Assertions.assertEquals(68812306, model.retentionPeriodInDays()); + Assertions.assertEquals(PurgeableOrchestrationState.FAILED, model.orchestrationState()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RetentionPolicyDetails model = new RetentionPolicyDetails().withRetentionPeriodInDays(68812306) + .withOrchestrationState(PurgeableOrchestrationState.FAILED); + model = BinaryData.fromObject(model).toObject(RetentionPolicyDetails.class); + Assertions.assertEquals(68812306, model.retentionPeriodInDays()); + Assertions.assertEquals(PurgeableOrchestrationState.FAILED, model.orchestrationState()); + } +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPolicyInnerTests.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPolicyInnerTests.java new file mode 100644 index 000000000000..9228575b947b --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPolicyInnerTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.durabletask.fluent.models.RetentionPolicyInner; +import com.azure.resourcemanager.durabletask.models.PurgeableOrchestrationState; +import com.azure.resourcemanager.durabletask.models.RetentionPolicyDetails; +import com.azure.resourcemanager.durabletask.models.RetentionPolicyProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RetentionPolicyInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RetentionPolicyInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Succeeded\",\"retentionPolicies\":[{\"retentionPeriodInDays\":102076266,\"orchestrationState\":\"Canceled\"},{\"retentionPeriodInDays\":398629650,\"orchestrationState\":\"Terminated\"},{\"retentionPeriodInDays\":958772842,\"orchestrationState\":\"Completed\"},{\"retentionPeriodInDays\":1168655887,\"orchestrationState\":\"Completed\"}]},\"id\":\"f\",\"name\":\"dgmb\",\"type\":\"bexppb\"}") + .toObject(RetentionPolicyInner.class); + Assertions.assertEquals(102076266, model.properties().retentionPolicies().get(0).retentionPeriodInDays()); + Assertions.assertEquals(PurgeableOrchestrationState.CANCELED, + model.properties().retentionPolicies().get(0).orchestrationState()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RetentionPolicyInner model = new RetentionPolicyInner() + .withProperties(new RetentionPolicyProperties().withRetentionPolicies(Arrays.asList( + new RetentionPolicyDetails().withRetentionPeriodInDays(102076266) + .withOrchestrationState(PurgeableOrchestrationState.CANCELED), + new RetentionPolicyDetails().withRetentionPeriodInDays(398629650) + .withOrchestrationState(PurgeableOrchestrationState.TERMINATED), + new RetentionPolicyDetails().withRetentionPeriodInDays(958772842) + .withOrchestrationState(PurgeableOrchestrationState.COMPLETED), + new RetentionPolicyDetails().withRetentionPeriodInDays(1168655887) + .withOrchestrationState(PurgeableOrchestrationState.COMPLETED)))); + model = BinaryData.fromObject(model).toObject(RetentionPolicyInner.class); + Assertions.assertEquals(102076266, model.properties().retentionPolicies().get(0).retentionPeriodInDays()); + Assertions.assertEquals(PurgeableOrchestrationState.CANCELED, + model.properties().retentionPolicies().get(0).orchestrationState()); + } +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPolicyListResultTests.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPolicyListResultTests.java new file mode 100644 index 000000000000..76547aa40a51 --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPolicyListResultTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.durabletask.implementation.models.RetentionPolicyListResult; +import com.azure.resourcemanager.durabletask.models.PurgeableOrchestrationState; +import org.junit.jupiter.api.Assertions; + +public final class RetentionPolicyListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RetentionPolicyListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\",\"retentionPolicies\":[{\"retentionPeriodInDays\":1939362977,\"orchestrationState\":\"Canceled\"},{\"retentionPeriodInDays\":917498996,\"orchestrationState\":\"Terminated\"}]},\"id\":\"aoyfhrtxilnerkuj\",\"name\":\"s\",\"type\":\"l\"},{\"properties\":{\"provisioningState\":\"Succeeded\",\"retentionPolicies\":[{\"retentionPeriodInDays\":1398747720,\"orchestrationState\":\"Canceled\"},{\"retentionPeriodInDays\":1479576759,\"orchestrationState\":\"Canceled\"},{\"retentionPeriodInDays\":1113809263,\"orchestrationState\":\"Failed\"}]},\"id\":\"prbnwbxgjvtbv\",\"name\":\"ysszdnrujqguh\",\"type\":\"uouq\"}],\"nextLink\":\"rwzwbng\"}") + .toObject(RetentionPolicyListResult.class); + Assertions.assertEquals(1939362977, + model.value().get(0).properties().retentionPolicies().get(0).retentionPeriodInDays()); + Assertions.assertEquals(PurgeableOrchestrationState.CANCELED, + model.value().get(0).properties().retentionPolicies().get(0).orchestrationState()); + Assertions.assertEquals("rwzwbng", model.nextLink()); + } +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPolicyPropertiesTests.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPolicyPropertiesTests.java new file mode 100644 index 000000000000..9f08aa1fdabc --- /dev/null +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/RetentionPolicyPropertiesTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.durabletask.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.durabletask.models.PurgeableOrchestrationState; +import com.azure.resourcemanager.durabletask.models.RetentionPolicyDetails; +import com.azure.resourcemanager.durabletask.models.RetentionPolicyProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RetentionPolicyPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RetentionPolicyProperties model = BinaryData.fromString( + "{\"provisioningState\":\"Provisioning\",\"retentionPolicies\":[{\"retentionPeriodInDays\":367130174,\"orchestrationState\":\"Canceled\"},{\"retentionPeriodInDays\":159244134,\"orchestrationState\":\"Terminated\"}]}") + .toObject(RetentionPolicyProperties.class); + Assertions.assertEquals(367130174, model.retentionPolicies().get(0).retentionPeriodInDays()); + Assertions.assertEquals(PurgeableOrchestrationState.CANCELED, + model.retentionPolicies().get(0).orchestrationState()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RetentionPolicyProperties model = new RetentionPolicyProperties().withRetentionPolicies(Arrays.asList( + new RetentionPolicyDetails().withRetentionPeriodInDays(367130174) + .withOrchestrationState(PurgeableOrchestrationState.CANCELED), + new RetentionPolicyDetails().withRetentionPeriodInDays(159244134) + .withOrchestrationState(PurgeableOrchestrationState.TERMINATED))); + model = BinaryData.fromObject(model).toObject(RetentionPolicyProperties.class); + Assertions.assertEquals(367130174, model.retentionPolicies().get(0).retentionPeriodInDays()); + Assertions.assertEquals(PurgeableOrchestrationState.CANCELED, + model.retentionPolicies().get(0).orchestrationState()); + } +} diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/SchedulersCreateOrUpdateMockTests.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/SchedulersCreateOrUpdateMockTests.java index 589396cf9e1b..8eb2b293a8bf 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/SchedulersCreateOrUpdateMockTests.java +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/SchedulersCreateOrUpdateMockTests.java @@ -26,7 +26,7 @@ public final class SchedulersCreateOrUpdateMockTests { @Test public void testCreateOrUpdate() throws Exception { String responseStr - = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"endpoint\":\"z\",\"ipAllowlist\":[\"vvtpgvdfgio\",\"kftutqxlngxlefg\",\"gnxkrxdqmidtth\"],\"sku\":{\"name\":\"rvqdra\",\"capacity\":1546969178,\"redundancyState\":\"None\"}},\"location\":\"gehoqfbowskany\",\"tags\":{\"ynhz\":\"lcuiywgqywgndr\",\"pec\":\"pphrcgynco\",\"lzevgbmqjqab\":\"vmmcoofs\",\"mivkwlzuvcc\":\"y\"},\"id\":\"wnfnbacf\",\"name\":\"onlebxetqgtzxdpn\",\"type\":\"bqqwxrj\"}"; + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"endpoint\":\"nwsubisnj\",\"ipAllowlist\":[\"pmng\",\"zscxaqwo\",\"chcbonqvpkvlrxnj\",\"ase\"],\"sku\":{\"name\":\"pheoflokeyy\",\"capacity\":354708232,\"redundancyState\":\"Zone\"}},\"location\":\"lwtgrhpdj\",\"tags\":{\"lhbxxhejjzzvdud\":\"masxazjpqyegu\",\"pwlbjnpg\":\"wdslfhotwmcy\",\"nltyfsoppusuesnz\":\"cftadeh\"},\"id\":\"dejbavo\",\"name\":\"xzdmohctb\",\"type\":\"vudwx\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); @@ -36,19 +36,21 @@ public void testCreateOrUpdate() throws Exception { new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); Scheduler response = manager.schedulers() - .define("dkexxppofm") - .withRegion("ddntwndei") - .withExistingResourceGroup("qsycbkbfkgu") - .withTags(mapOf("pzaoqvuhr", "w", "hjq", "cffcyddglmj", "hix", "wpyeicxmqciwqvh", "og", "igdtopbob")) - .withProperties(new SchedulerProperties().withIpAllowlist(Arrays.asList("ocjjxhvpmouexh")) - .withSku(new SchedulerSku().withName("zxibqeoj").withCapacity(799299355))) + .define("a") + .withRegion("gehoqfbowskany") + .withExistingResourceGroup("w") + .withTags( + mapOf("ynhz", "lcuiywgqywgndr", "pec", "pphrcgynco", "lzevgbmqjqab", "vmmcoofs", "mivkwlzuvcc", "y")) + .withProperties(new SchedulerProperties() + .withIpAllowlist(Arrays.asList("vvtpgvdfgio", "kftutqxlngxlefg", "gnxkrxdqmidtth")) + .withSku(new SchedulerSku().withName("rvqdra").withCapacity(1546969178))) .create(); - Assertions.assertEquals("gehoqfbowskany", response.location()); - Assertions.assertEquals("lcuiywgqywgndr", response.tags().get("ynhz")); - Assertions.assertEquals("vvtpgvdfgio", response.properties().ipAllowlist().get(0)); - Assertions.assertEquals("rvqdra", response.properties().sku().name()); - Assertions.assertEquals(1546969178, response.properties().sku().capacity()); + Assertions.assertEquals("lwtgrhpdj", response.location()); + Assertions.assertEquals("masxazjpqyegu", response.tags().get("lhbxxhejjzzvdud")); + Assertions.assertEquals("pmng", response.properties().ipAllowlist().get(0)); + Assertions.assertEquals("pheoflokeyy", response.properties().sku().name()); + Assertions.assertEquals(354708232, response.properties().sku().capacity()); } // Use "Map.of" if available diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/SchedulersGetByResourceGroupWithResponseMockTests.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/SchedulersGetByResourceGroupWithResponseMockTests.java index 2bf1fd150685..5cfa723c17cc 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/SchedulersGetByResourceGroupWithResponseMockTests.java +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/SchedulersGetByResourceGroupWithResponseMockTests.java @@ -21,7 +21,7 @@ public final class SchedulersGetByResourceGroupWithResponseMockTests { @Test public void testGetByResourceGroupWithResponse() throws Exception { String responseStr - = "{\"properties\":{\"provisioningState\":\"Provisioning\",\"endpoint\":\"fqawrlyxw\",\"ipAllowlist\":[\"cpr\",\"nwbxgjvtbvpyssz\"],\"sku\":{\"name\":\"nruj\",\"capacity\":1719389036,\"redundancyState\":\"None\"}},\"location\":\"ouqfprwz\",\"tags\":{\"itnwuizgazxufi\":\"g\",\"hr\":\"uckyf\",\"zwdzuh\":\"idf\",\"wxmnteiwao\":\"ymwisdkft\"},\"id\":\"vkmijcmmxdcuf\",\"name\":\"fsrpymzidnse\",\"type\":\"cxtbzsg\"}"; + = "{\"properties\":{\"provisioningState\":\"Updating\",\"endpoint\":\"zsgfyccsnewmd\",\"ipAllowlist\":[\"jeiachboosfl\"],\"sku\":{\"name\":\"ro\",\"capacity\":1593237527,\"redundancyState\":\"None\"}},\"location\":\"ehzzvypyqrim\",\"tags\":{\"dqxhcrmnohjtckwh\":\"pvswjdkirso\",\"gr\":\"soifiyipjxsqw\",\"qabnmoc\":\"bznorcjxvsnby\"},\"id\":\"cyshurzafbljjgp\",\"name\":\"toqcjmklja\",\"type\":\"bqidtqaj\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); @@ -31,13 +31,13 @@ public void testGetByResourceGroupWithResponse() throws Exception { new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); Scheduler response = manager.schedulers() - .getByResourceGroupWithResponse("o", "fhrtxilnerkujysv", com.azure.core.util.Context.NONE) + .getByResourceGroupWithResponse("pvkmijcmmxdcuf", "fsrpymzidnse", com.azure.core.util.Context.NONE) .getValue(); - Assertions.assertEquals("ouqfprwz", response.location()); - Assertions.assertEquals("g", response.tags().get("itnwuizgazxufi")); - Assertions.assertEquals("cpr", response.properties().ipAllowlist().get(0)); - Assertions.assertEquals("nruj", response.properties().sku().name()); - Assertions.assertEquals(1719389036, response.properties().sku().capacity()); + Assertions.assertEquals("ehzzvypyqrim", response.location()); + Assertions.assertEquals("pvswjdkirso", response.tags().get("dqxhcrmnohjtckwh")); + Assertions.assertEquals("jeiachboosfl", response.properties().ipAllowlist().get(0)); + Assertions.assertEquals("ro", response.properties().sku().name()); + Assertions.assertEquals(1593237527, response.properties().sku().capacity()); } } diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/SchedulersListByResourceGroupMockTests.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/SchedulersListByResourceGroupMockTests.java index ba67d4eee52a..ad0df0a408d3 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/SchedulersListByResourceGroupMockTests.java +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/SchedulersListByResourceGroupMockTests.java @@ -22,7 +22,7 @@ public final class SchedulersListByResourceGroupMockTests { @Test public void testListByResourceGroup() throws Exception { String responseStr - = "{\"value\":[{\"properties\":{\"provisioningState\":\"Updating\",\"endpoint\":\"mdwzjeiachboo\",\"ipAllowlist\":[\"lnrosfqp\",\"eeh\",\"zvypyqrimzinp\",\"swjdkirso\"],\"sku\":{\"name\":\"dqxhcrmnohjtckwh\",\"capacity\":1629637737,\"redundancyState\":\"Zone\"}},\"location\":\"yip\",\"tags\":{\"rcjxvsnbyxqabn\":\"qwpgrjbzn\",\"hurzafblj\":\"ocpcy\"},\"id\":\"gpbtoqcjmklj\",\"name\":\"vbqid\",\"type\":\"qajzyulpkudjkr\"}]}"; + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Deleting\",\"endpoint\":\"hfepgzgqex\",\"ipAllowlist\":[\"ocxscpaierhhbcs\"],\"sku\":{\"name\":\"l\",\"capacity\":1936652093,\"redundancyState\":\"Zone\"}},\"location\":\"j\",\"tags\":{\"jionpimexgstxgc\":\"xobnbdxkqpxok\"},\"id\":\"odgmaajrmvdjwz\",\"name\":\"lovmclwhijcoe\",\"type\":\"ctbzaq\"}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); @@ -32,12 +32,12 @@ public void testListByResourceGroup() throws Exception { new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); PagedIterable response - = manager.schedulers().listByResourceGroup("yc", com.azure.core.util.Context.NONE); + = manager.schedulers().listByResourceGroup("yulpkudjkr", com.azure.core.util.Context.NONE); - Assertions.assertEquals("yip", response.iterator().next().location()); - Assertions.assertEquals("qwpgrjbzn", response.iterator().next().tags().get("rcjxvsnbyxqabn")); - Assertions.assertEquals("lnrosfqp", response.iterator().next().properties().ipAllowlist().get(0)); - Assertions.assertEquals("dqxhcrmnohjtckwh", response.iterator().next().properties().sku().name()); - Assertions.assertEquals(1629637737, response.iterator().next().properties().sku().capacity()); + Assertions.assertEquals("j", response.iterator().next().location()); + Assertions.assertEquals("xobnbdxkqpxok", response.iterator().next().tags().get("jionpimexgstxgc")); + Assertions.assertEquals("ocxscpaierhhbcs", response.iterator().next().properties().ipAllowlist().get(0)); + Assertions.assertEquals("l", response.iterator().next().properties().sku().name()); + Assertions.assertEquals(1936652093, response.iterator().next().properties().sku().capacity()); } } diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/SchedulersListMockTests.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/SchedulersListMockTests.java index 4e987a2264b5..dbf3a6f14ec6 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/SchedulersListMockTests.java +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/SchedulersListMockTests.java @@ -22,7 +22,7 @@ public final class SchedulersListMockTests { @Test public void testList() throws Exception { String responseStr - = "{\"value\":[{\"properties\":{\"provisioningState\":\"Deleting\",\"endpoint\":\"hfepgzgqex\",\"ipAllowlist\":[\"ocxscpaierhhbcs\"],\"sku\":{\"name\":\"l\",\"capacity\":1936652093,\"redundancyState\":\"Zone\"}},\"location\":\"j\",\"tags\":{\"jionpimexgstxgc\":\"xobnbdxkqpxok\"},\"id\":\"odgmaajrmvdjwz\",\"name\":\"lovmclwhijcoe\",\"type\":\"ctbzaq\"}]}"; + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Updating\",\"endpoint\":\"bkbfkgukdkex\",\"ipAllowlist\":[\"pofm\",\"axcfjpgddtocjjx\",\"vpmouexhdzxib\",\"eojnxqbzvddn\"],\"sku\":{\"name\":\"wndeicbtwnp\",\"capacity\":1464431072,\"redundancyState\":\"Zone\"}},\"location\":\"hrhcffcyddglmjth\",\"tags\":{\"hix\":\"wpyeicxmqciwqvh\"},\"id\":\"igdtopbob\",\"name\":\"og\",\"type\":\"m\"}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); @@ -33,10 +33,10 @@ public void testList() throws Exception { PagedIterable response = manager.schedulers().list(com.azure.core.util.Context.NONE); - Assertions.assertEquals("j", response.iterator().next().location()); - Assertions.assertEquals("xobnbdxkqpxok", response.iterator().next().tags().get("jionpimexgstxgc")); - Assertions.assertEquals("ocxscpaierhhbcs", response.iterator().next().properties().ipAllowlist().get(0)); - Assertions.assertEquals("l", response.iterator().next().properties().sku().name()); - Assertions.assertEquals(1936652093, response.iterator().next().properties().sku().capacity()); + Assertions.assertEquals("hrhcffcyddglmjth", response.iterator().next().location()); + Assertions.assertEquals("wpyeicxmqciwqvh", response.iterator().next().tags().get("hix")); + Assertions.assertEquals("pofm", response.iterator().next().properties().ipAllowlist().get(0)); + Assertions.assertEquals("wndeicbtwnp", response.iterator().next().properties().sku().name()); + Assertions.assertEquals(1464431072, response.iterator().next().properties().sku().capacity()); } } diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/TaskHubsCreateOrUpdateMockTests.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/TaskHubsCreateOrUpdateMockTests.java index 8a8966355e9a..ff0832fab3d0 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/TaskHubsCreateOrUpdateMockTests.java +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/TaskHubsCreateOrUpdateMockTests.java @@ -21,7 +21,7 @@ public final class TaskHubsCreateOrUpdateMockTests { @Test public void testCreateOrUpdate() throws Exception { String responseStr - = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"dashboardUrl\":\"glhslazj\"},\"id\":\"ggd\",\"name\":\"jixhbk\",\"type\":\"ofqweykhmenevfye\"}"; + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"dashboardUrl\":\"cfsf\"},\"id\":\"ymddys\",\"name\":\"kiiuxhqyudxor\",\"type\":\"qn\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); @@ -31,8 +31,8 @@ public void testCreateOrUpdate() throws Exception { new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); TaskHub response = manager.taskHubs() - .define("cftadeh") - .withExistingScheduler("wmc", "npwlbjnpg") + .define("jmcmatuokthfu") + .withExistingScheduler("a", "oaeupfhyhltrpmo") .withProperties(new TaskHubProperties()) .create(); diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/TaskHubsGetWithResponseMockTests.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/TaskHubsGetWithResponseMockTests.java index e49e6f0b5833..ac812c9b95b1 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/TaskHubsGetWithResponseMockTests.java +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/TaskHubsGetWithResponseMockTests.java @@ -20,7 +20,7 @@ public final class TaskHubsGetWithResponseMockTests { @Test public void testGetWithResponse() throws Exception { String responseStr - = "{\"properties\":{\"provisioningState\":\"Accepted\",\"dashboardUrl\":\"seiphe\"},\"id\":\"lokeyy\",\"name\":\"enjbdlwtgrhp\",\"type\":\"jp\"}"; + = "{\"properties\":{\"provisioningState\":\"Accepted\",\"dashboardUrl\":\"e\"},\"id\":\"hmenevfyexfwhybc\",\"name\":\"bvyvdcsity\",\"type\":\"naamde\"}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); @@ -30,7 +30,7 @@ public void testGetWithResponse() throws Exception { new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); TaskHub response = manager.taskHubs() - .getWithResponse("eallnwsubisnj", "mpmngnzscxaqwoo", "hcbonqvpkvlr", com.azure.core.util.Context.NONE) + .getWithResponse("ndnvo", "gujjugwdkcglh", "lazjdyggdtjixhbk", com.azure.core.util.Context.NONE) .getValue(); } diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/TaskHubsListBySchedulerMockTests.java b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/TaskHubsListBySchedulerMockTests.java index 0e500b20dbde..0688b7b1907a 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/TaskHubsListBySchedulerMockTests.java +++ b/sdk/durabletask/azure-resourcemanager-durabletask/src/test/java/com/azure/resourcemanager/durabletask/generated/TaskHubsListBySchedulerMockTests.java @@ -21,7 +21,7 @@ public final class TaskHubsListBySchedulerMockTests { @Test public void testListByScheduler() throws Exception { String responseStr - = "{\"value\":[{\"properties\":{\"provisioningState\":\"Accepted\",\"dashboardUrl\":\"b\"},\"id\":\"hejjz\",\"name\":\"v\",\"type\":\"udgwdslfho\"}]}"; + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Updating\",\"dashboardUrl\":\"eyyvxyqjpkcat\"},\"id\":\"ngj\",\"name\":\"rcczsqpjhvmd\",\"type\":\"jvnysounqe\"}]}"; HttpClient httpClient = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); @@ -31,7 +31,7 @@ public void testListByScheduler() throws Exception { new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); PagedIterable response - = manager.taskHubs().listByScheduler("umasxazjpq", "e", com.azure.core.util.Context.NONE); + = manager.taskHubs().listByScheduler("tehfiqscjeypvh", "zrkgqhcjrefovg", com.azure.core.util.Context.NONE); } } diff --git a/sdk/durabletask/azure-resourcemanager-durabletask/tsp-location.yaml b/sdk/durabletask/azure-resourcemanager-durabletask/tsp-location.yaml index 9920a1975d01..ba9fb5105f17 100644 --- a/sdk/durabletask/azure-resourcemanager-durabletask/tsp-location.yaml +++ b/sdk/durabletask/azure-resourcemanager-durabletask/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/durabletask/DurableTask.Management -commit: 631fafee30edfd6275cc01ee61d1a128f2c2cfdd +commit: 65ea9a38c20488eb047876e4207713aa4a392f82 repo: Azure/azure-rest-api-specs additionalDirectories: